Noise n => BiQuad b => dac; Impulse p => b; PRC perry; // substring parser Skot skot; // stdin line grabber 1 => b.eqzs; 1 => int running; string out[6]; int i; float cnum,cval; 0.0 => float mix; 0.0 => float gain; 1.0 / 440.0 => float period; 0.0 => float modphase; 0.0 => float vibrato; -1.0 => float tempzrad; -1.0 => float tempzfreq; spork ~ do_impulse(); while( running ) { skot.prompt( "" ) => now; // prompt for line while( skot.more() ) // loop over lines { skot.getLine() => perry.set; // set the line 0 => i; while( perry.more() ) // process line { perry.next( out[i] ); // get all fields i + 1 => i; } } if (out[0]=="ExitProgram") { // check for Exit 0 => running; <<< "ExitProgram", running >>>; } else if (out[0]=="NoteOn") { Std.atof(out[3])/128.0 => gain => b.a0; } else if (out[0]=="NoteOff") 0.0 => gain => b.a0; else if (out[0]=="Reso1") Std.atof(out[3])/128.0 => b.prad; else if (out[0]=="PitchBend") Std.mtof(Std.atof(out[3])) => b.pfreq; else if (out[0]=="AfterTouch") { Std.atof(out[3])/128.0 => gain => b.a0; } else if (out[0]=="ZReso1") { if (Std.atof(out[3])==-1.0) { 1 => b.eqzs; -1.0 => tempzrad; -1.0 => tempzfreq; } else { Std.atof(out[3])/128.0 => b.zrad => tempzrad; } } else if (out[0]=="ZPitch1") { if (Std.atof(out[3])==-1.0) { 1 => b.eqzs; -1.0 => tempzrad; -1.0 => tempzfreq; } else { Std.mtof(Std.atof(out[3])) => b.zfreq => tempzfreq; } } else if (out[0]=="Mix") { Std.atof(out[3])/128.0 => mix; 0.2 * mix => n.gain; (1.0 - mix) => p.gain; } else if (out[0]=="VPitch") { 1.0 / Std.mtof(Std.atof(out[3])) => period; } else if (out[0]=="Vibrato") { 0.0003 * Std.atof(out[3]) / 128.0 => vibrato; } else if (out[0]=="EqualGainZeroes") { 1 => b.eqzs; -1.0 => tempzrad; -1.0 => tempzfreq; } <<< b.pfreq(), b.prad(), tempzfreq, tempzrad >>>; } fun void do_impulse() { while (running) { 1.0 => p.next; modphase + period => modphase; (period + vibrato * Math.sin(6.28 * modphase * 6.0)) * second => now; } }