4 => int voices; Gain gain => dac; 0.8 => gain.gain; BeeThree bt[voices]; for (0 => int i; i < voices; i++) { BeeThree voice => gain; voice.noteOff(1.0); voice @=> bt[i]; } class Procedure { fun void run() { // empty } } class FloatProcedure { fun void run(float value) { // empty } } // sporked for each voice class Play extends FloatProcedure { 0 => int voice; 500::ms => dur length; fun void run(float value) { value => bt[voice].freq; bt[voice].noteOn(1.0); length => now; bt[voice].noteOff(1.0); } } // play all voices class PlayVoices extends FloatProcedure { 0 => int voice; 500::ms => dur length; fun void run(float value) { Play play; length => play.length; voice => play.voice; spork ~ play.run(value); voice++; } fun void finish() { length => now; 0 => voice; } } // play all the notes in a chord simultaneously class PlayChord extends Procedure { //Chord @ chord; 500::ms => dur length; PlayVoices playVoices; fun void run() { //<<>>; length => playVoices.length; //chord.forEach(playVoices); playVoices.run(440.0); playVoices.finish(); } } PlayChord playCmaj; PlayChord playAmin; 2::second => now; playCmaj @=> Procedure cLoop; playAmin @=> Procedure aLoop; cLoop.run(); aLoop.run(); <<<"done">>>;