| 1 |
// 43.ck : midi event (fail-correct) |
| 2 |
|
| 3 |
sinosc s => DelayL z => dac; |
| 4 |
|
| 5 |
MidiIn min; |
| 6 |
MidiMsg msg; |
| 7 |
|
| 8 |
0.0::second => z.delay; |
| 9 |
//0.02::second => z.max => z.delay; |
| 10 |
|
| 11 |
// open - see 'chuck --probe' |
| 12 |
if( !min.open( 0 ) ) |
| 13 |
me.exit(); |
| 14 |
|
| 15 |
// inifinite time loop |
| 16 |
while( true ) |
| 17 |
{ |
| 18 |
// wait on MIDI event |
| 19 |
min => now; |
| 20 |
|
| 21 |
// there should be one or more msg if we get here |
| 22 |
while( min.recv( msg ) ) |
| 23 |
{ |
| 24 |
// print out some data |
| 25 |
<<<msg.data3>>>; |
| 26 |
if( msg.data1 == 144 ) // note on |
| 27 |
{ |
| 28 |
<<<msg.data1>>>; |
| 29 |
0.75 * std.mtof(msg.data2) => s.freq; |
| 30 |
msg.data3 / 128.0 => s.gain; |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|