| 1 |
// patch |
| 2 |
BlowHole hole => dac; |
| 3 |
|
| 4 |
// scale |
| 5 |
[0, 2, 4, 7, 9, 11] @=> int scale[]; |
| 6 |
|
| 7 |
// infinite time loop |
| 8 |
while( true ) |
| 9 |
{ |
| 10 |
// change parameters |
| 11 |
if( Math.random2f(0,1) > .75 ) |
| 12 |
{ |
| 13 |
Math.random2f( 0, 128 ) => float stiffness; |
| 14 |
Math.random2f( 0, 128 ) => float noisegain; |
| 15 |
Math.random2f( 0, 128 ) => float tonehole; |
| 16 |
Math.random2f( 0, 128 ) => float register; |
| 17 |
Math.random2f( 0, 128 ) => float pressure; |
| 18 |
|
| 19 |
<<< "going...", "" >>>; |
| 20 |
<<< "reed stiffness:", stiffness, "/ 128.0" >>>; |
| 21 |
<<< "noise gain:", noisegain, "/ 128.0" >>>; |
| 22 |
<<< "tonehole state:", tonehole, "/ 128.0" >>>; |
| 23 |
<<< "register state:", register, "/ 128.0" >>>; |
| 24 |
<<< "breath pressue:", pressure, "/ 128.0" >>>; |
| 25 |
|
| 26 |
// reed stiffness |
| 27 |
hole.controlChange( 2, stiffness ); |
| 28 |
// noise gain |
| 29 |
hole.controlChange( 4, noisegain ); |
| 30 |
// tonehole state |
| 31 |
hole.controlChange( 11, tonehole ); |
| 32 |
// register state |
| 33 |
hole.controlChange( 1, register ); |
| 34 |
// breath pressue |
| 35 |
hole.controlChange( 128, pressure ); |
| 36 |
} |
| 37 |
|
| 38 |
// set freq |
| 39 |
scale[Math.random2(0,scale.size()-1)] => int note; |
| 40 |
33 + Math.random2(0,4)*12 + note => Std.mtof => hole.freq; |
| 41 |
<<< "note: ", Std.ftom( hole.freq() ) >>>; |
| 42 |
|
| 43 |
// go |
| 44 |
.8 => hole.noteOn; |
| 45 |
|
| 46 |
// advance time |
| 47 |
1::second => now; |
| 48 |
} |