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