*** empty log message ***
[chuck-blob.git] / v2 / examples / stk / saxofony.ck
blob14515a0810f73940ca23b0ea3c5808142953f65a
1 // STK Saxofony
3 // patch
4 Saxofony sax => JCRev r => dac;
5 .5 => r.gain;
6 .05 => r.mix;
8 // our notes
9 [ 61, 63, 65, 66, 68 ] @=> int notes[];
11 // infinite time-loop
12 while( true )
14     // set
15     Std.rand2f( 0, 1 ) => sax.stiffness;
16     Std.rand2f( 0, 1 ) => sax.aperture;
17     Std.rand2f( 0, 1 ) => sax.noiseGain;
18     Std.rand2f( 0, 1 ) => sax.blowPosition;
19     Std.rand2f( 0, 12 ) => sax.vibratoFreq;
20     Std.rand2f( 0, 1 ) => sax.vibratoGain;
21     Std.rand2f( 0, 1 ) => sax.pressure;
23     // print
24     <<< "---", "" >>>;
25     <<< "stiffness:", sax.stiffness() >>>;
26     <<< "aperture:", sax.aperture() >>>;
27     <<< "noiseGain:", sax.noiseGain() >>>;
28     <<< "blowPosition:", sax.blowPosition() >>>;
29     <<< "vibratoFreq:", sax.vibratoFreq() >>>;
30     <<< "vibratoGain:", sax.vibratoGain() >>>;
31     <<< "pressure:", sax.pressure() >>>;
33     // factor
34     Std.rand2f( .75, 2 ) => float factor;
36     for( int i; i < notes.cap(); i++ )
37     {
38         play( 12 + notes[i], Std.rand2f( .6, .9 ) );
39         300::ms * factor => now;
40     }
43 // basic play function (add more arguments as needed)
44 fun void play( float note, float velocity )
46     // start the note
47     Std.mtof( note ) => sax.freq;
48     velocity => sax.noteOn;