udderbot
Joined: Jul 15, 2007 Posts: 6 Location: suburbia
Audio files: 1
|
Posted: Sun Jul 15, 2007 9:20 pm Post subject:
|
 |
|
I saw this subject and knew I would eventually get around to having some microtonal ChucK examples.
Basically, this makes an equal-tempered mandolin play slowly drifting moment-of-symmetry-esque rhythms. Play with the initial variables a bit. You might even consider it educationally valuable!
Code: |
//rhythm mos explorer
// manifestation 0: equal-tuned mando-handbells
//period (tempo)
.56::second => dur p;
//generator (initial value, fraction of 1)
1. => float g;
//number of notes patterning (also tones per octave)
7 => int e;
//the change to g and/or p each iteration of period
fun void delta()
{
0.01 +=> g;
}
//each boop sporked plays one multiplier (m) of the period...
// only activates notes (no noteOff)
// queries global variables g and p each time anew
fun void boop( float m, float freq, StkInstrument v)
{
//Std.fabs(m)*p => now;
v => dac;
freq => v.freq;
dur begin;
while ( true )
{
if ( m <0> begin;
} else {
if ( m == 0 )
{ 0::second => begin; }
else {
g*m%1 * p => begin; } }
begin => now;
v.noteOn(0.6);
p - begin => now;
}
}
// make a Mandolin with random timbre, chuck to dac
fun StkInstrument mandome()
{
Mandolin m;
Std.rand2f( 0, 1 ) => m.bodySize;
Std.rand2f( 0, 1 ) => m.pluckPos;
0.3 => m.stringDamping;
m => dac;
return m;
}
// iterative version.
fun void multispork(int n)
{
for(0=>int i; i < n; i++)
{
spork ~ boop( i-(n/2), Std.mtof(57.+(12.*i/n)), mandome());
}
}
// sequence-of-notes version (make sure size is the same as n!)
[ 57., 59., 61., 57., 59., 57., 53. ]@=> float arr[];
fun void multispork2(int n)
{
for(0=>int i; i < n; i++)
{
spork ~ boop( i-(n/2), Std.mtof(arr[i]), mandome());
}
}
multispork(e);
while (true)
{
delta();
p => now; }
// a favorite: g-delta = 2/9., eq5
|
On my music-dedicated 333-Mhz I am limited to 7 notes before garbage synthesis; on my 1 Ghz iMac (running 11 other programs at the same time) it seems able to handle up to 18.
More (and less) at http://scalesmith.blogspot.com
Tell me what you do with it! I plan on doing all sorts of things...
edit: un-mangled by disabling HTML. Thanks Kassen! Last edited by udderbot on Mon Jul 16, 2007 10:07 am; edited 1 time in total |
|
Kassen
Janitor


Joined: Jul 06, 2004 Posts: 7678 Location: The Hague, NL
G2 patch files: 3
|
Posted: Sun Jul 15, 2007 9:39 pm Post subject:
|
 |
|
Welcome, udderbot!
Looks very interesting, could you perhaps repost this while turning the "disable HTML" flag on? It's below the text field when you make a new post. You can also edit all your own posts.
Sadly the board will try to render HTML even within "CODE" blocks which messes up ChucK code because of the triangular brackets we use.
We (well, realy I personally but it works) recomend ChucKists to disable HTML when posting altogether in their profile. _________________ Kassen |
|