| 1 |
// STK BandedWG |
| 2 |
|
| 3 |
// patch |
| 4 |
BandedWG bwg => dac; |
| 5 |
|
| 6 |
// scale |
| 7 |
[0, 2, 4, 7, 8, 11] @=> int scale[]; |
| 8 |
|
| 9 |
// infinite time loop |
| 10 |
while( true ) |
| 11 |
{ |
| 12 |
// ding! |
| 13 |
Math.random2f( 0, 1 ) => bwg.pluck; |
| 14 |
Math.random2f( 0, 128 ) => float bowPressure; |
| 15 |
Math.random2f( 0, 128 ) => float bowMotion; |
| 16 |
Math.random2f( 0, 128 ) => float strikePosition; |
| 17 |
Math.random2f( 0, 128 ) => float vibratoFreq; |
| 18 |
Math.random2f( 0, 128 ) => float gain; |
| 19 |
Math.random2f( 0, 128 ) => float bowVelocity; |
| 20 |
Math.random2f( 0, 128 ) => float setStriking; |
| 21 |
Math.random2f( 0, 3 ) => float preset; |
| 22 |
|
| 23 |
Math.random2f( 0, 1) => bwg.bowRate; |
| 24 |
|
| 25 |
bwg.controlChange( 2, bowPressure); |
| 26 |
bwg.controlChange( 4, bowMotion); |
| 27 |
bwg.controlChange( 8, strikePosition); |
| 28 |
bwg.controlChange( 11, vibratoFreq); |
| 29 |
bwg.controlChange( 1, gain); |
| 30 |
bwg.controlChange( 128, bowVelocity); |
| 31 |
bwg.controlChange( 64, setStriking); |
| 32 |
|
| 33 |
<<< "---", "" >>>; |
| 34 |
<<< "strike position:", bwg.strikePosition() >>>; |
| 35 |
<<< "bow rate:", bwg.bowRate() >>>; |
| 36 |
<<< "bow Pressure:", bwg.bowPressure() >>>; |
| 37 |
|
| 38 |
// set freq |
| 39 |
scale[Math.random2(0,scale.size()-1)] => int winner; |
| 40 |
57 + Math.random2(0,2)*12 + winner => Std.mtof => bwg.freq; |
| 41 |
// go |
| 42 |
.8 => bwg.noteOn; |
| 43 |
|
| 44 |
// advance time |
| 45 |
1::second => now; |
| 46 |
1.0 => bwg.noteOff; |
| 47 |
.5::second => now; |
| 48 |
|
| 49 |
<<< "pluck -> bow", "" >>>; |
| 50 |
|
| 51 |
.8 => bwg.startBowing; |
| 52 |
1::second => now; |
| 53 |
1.0 => bwg.stopBowing; |
| 54 |
|
| 55 |
<<< "--", "" >>>; |
| 56 |
bwg.controlChange(16, Math.random2(0, 3)); |
| 57 |
|
| 58 |
<<< "preset:", bwg.preset() >>>; |
| 59 |
<<< "strike position:", bwg.strikePosition() >>>; |
| 60 |
<<< "bow rate:", bwg.bowRate() >>>; |
| 61 |
<<< "bow Pressure:", bwg.bowPressure() >>>; |
| 62 |
|
| 63 |
// set freq |
| 64 |
57 + Math.random2(0,2)*12 + winner => Std.mtof => bwg.freq; |
| 65 |
// go |
| 66 |
.8 => bwg.noteOn; |
| 67 |
|
| 68 |
// advance time |
| 69 |
1::second => now; |
| 70 |
1.0 => bwg.noteOff; |
| 71 |
.5::second => now; |
| 72 |
|
| 73 |
<<< "pluck -> bow", "" >>>; |
| 74 |
|
| 75 |
.8 => bwg.startBowing; |
| 76 |
1::second => now; |
| 77 |
1.0 => bwg.stopBowing; |
| 78 |
} |