public class Harmony { BeeThree flute => NRev n => ResonZ r => dac.chan(0); n.mix(0.05); r.Q(0.3); r.gain(.45); BPM t; // key of the song, with 0 being key of C and 11 being key of B 0 => int key; // int for which octave above/below midde C -1 => int octave; (octave*12) + key => key; //harmony pitch int hPitch; fun void playVerse() { while(true) { playHarmonyNote("VI"); playHarmonyNote("V"); playHarmonyNote("IV"); playHarmonyNote("V"); } } fun void playChorus() { while(true) { playHarmonyNote("I"); playHarmonyNote("III"); playHarmonyNote("IV"); playHarmonyNote("V"); } } fun void playHarmonyNote(string chord) { if(chord == "I") { 67 + key => hPitch; } else if(chord == "II") { 69 + key => hPitch; } else if(chord == "III") { 71 + key => hPitch; } else if(chord == "IV") { 72 + key => hPitch; } else if(chord == "V") { 74 + key => hPitch; } else if(chord == "VI") { 76 + key => hPitch; } else if(chord == "VII") { 77 + key => hPitch; } Std.mtof(hPitch) => flute.freq; flute.noteOff(1); t.halfNote => now; flute.noteOn(1); t.halfNote => now; } } Harmony h; spork ~ h.playVerse(); while(1) { 1::second => now; }