175::ms => dur tempoOneEighthNote; tempoOneEighthNote * 0.75 => dur fastEighthNote; tempoOneEighthNote => dur eighthNote; 2 * eighthNote => dur quarterNote; 2 * quarterNote => dur halfNote; 60 => int key; 3 * halfNote => now; playOpeningMotif(); playFirstTheme(); playSurpriseCadence(); playFirstTransition(); setTempo(tempoOneEighthNote); playSecondTheme(); playDevelopment(); playDevelopmentTheme1(); playDevelopmentTheme2(); playDevelopmentTheme3(); playDevelopmentTheme4(); playDevelopmentTheme5(); playDevelopmentTheme6(); playCallResponse(); playReturnToRecap(); playFirstThemeRecap(); playSecondTransition(); playSecondThemeRecap(); playTransitionToCoda(); playBuildupToCodaTheme(); playCodaTheme(); playBuildupToLastFermata(); playEnding(); fun void playOpeningMotif() { HevyMetl violin1 => NRev r => dac; HevyMetl violin2 => r; HevyMetl bassTop => r; HevyMetl bassBot => r; r.mix(0.02); [3, 1, 1, 3, 1] @=> int reps[]; 5 * halfNote => dur firstFermata; 7 * halfNote => dur secondFermata; [eighthNote, firstFermata, eighthNote, eighthNote, secondFermata] @=> dur durs[]; spork ~ playNotes(violin1, [7, 3, -101, 5, 2], durs, reps, 0.85, 0.9); spork ~ playNotes(violin2, [-5, -9, -101, -7, -10], durs, reps, 0.85, 0.9); spork ~ playNotes(bassTop, [-17, -21, -101, -19, -22], durs, reps, 0.85, 0.9); playNotes(bassBot, [-29, -33, -101, -31, -34], durs, reps, 0.85, 0.9); halfNote => now; } fun void playFirstTheme() { [-100, 7, 3, 8, 7, 15, 12, -100, 7, 2, 8, 7, 17, 14, 19, 17, 15, 14, 19, 17, 15, 14, 19, 17, 15, -101, 12, -101] @=> int firstThemePitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, 3 * halfNote - eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, halfNote + halfNote + eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote, quarterNote, quarterNote] @=> dur firstThemeDurs[]; [1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1] @=> int firstThemeReps[]; BandedWG bwg => NRev r => dac; r.mix(0.2); playNotes(bwg, firstThemePitches, firstThemeDurs, firstThemeReps, 2.0, 0.95); } fun void playSurpriseCadence() { halfNote + quarterNote => now; HevyMetl violin1 => NRev r => dac; HevyMetl violin2 => r; HevyMetl bassTop => r; HevyMetl bassBot => r; r.mix(0.05); [1, 1, 3, 1] @=> int reps[]; 4 * halfNote + quarterNote => dur extraFermataTime; 7 * halfNote => dur secondFermata; spork ~ playNotes(violin1, [19, -101, 8, 5], [quarterNote + extraFermataTime, eighthNote, eighthNote, secondFermata], reps, 0.85, 0.95); spork ~ playNotes(violin2, [11, -101, -4, -7], [quarterNote, extraFermataTime + eighthNote, eighthNote, secondFermata], reps, 0.85, 0.95); spork ~ playNotes(bassTop, [-17, -101, -16, -19], [quarterNote, extraFermataTime + eighthNote, eighthNote, secondFermata], reps, 0.85, 0.95); playNotes(bassBot, changeOctave([-17, -101, -16, -19], -1), [quarterNote, extraFermataTime + eighthNote, eighthNote, secondFermata], reps, 0.85, 0.95); halfNote => now; } fun void playSecondTheme() { spork ~ playHornCall([10, 3, 5, -2]); 4 * halfNote => now; playSecondTheme1(); playSecondTheme4(); playSecondTheme5(); } fun void playDevelopment() { playDevelopmentHornCall(); } fun void playFirstTheme1(StkInstrument inst, int pitches[]) { inst => NRev r => dac; 2.0 => inst.gain; 0.5 => float velocity; r.mix(0.2); [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, halfNote + eighthNote] @=> dur durations[]; [3, 1, 3, 1, 3, 1] @=> int iterations[]; playNotes(inst, pitches, durations, iterations, velocity, 0.9); } fun void playFirstTheme2(int pitches[]) { BandedWG inst => NRev r => dac; 2.0 => inst.gain; 0.5 => float velocity; r.mix(0.2); for (0 => int i; i < pitches.cap(); i++) { Std.mtof(key + pitches[i]) => inst.freq; if (i == 2) { velocity => inst.noteOn; halfNote => now; if (i == pitches.cap() - 1) eighthNote +=> now; velocity => inst.noteOff; } else { 1 => int nReps; if (i == 0) 2 => nReps; repeat (nReps) { velocity => inst.noteOn; eighthNote => now; velocity => inst.noteOff; } } } } fun void playNotes(StkInstrument inst, int pitches[], dur durOfEachPitch, float velocity, float playRatio) { playNotes(inst, pitches, getUniformDurArr(pitches.cap(), durOfEachPitch), getUniformIntArr(pitches.cap(), 1), velocity, playRatio); } fun void playNotes(StkInstrument inst, int pitches[], dur durations[], int iterations[], float velocity, float playRatio) { 1.0 - playRatio => float pauseRatio; for (0 => int i; i < pitches.cap(); i++) { if (key + pitches[i] >= 0) { for (0 => int j; j < iterations[i]; j++) { Std.mtof(key + pitches[i]) => inst.freq; velocity => inst.noteOn; playRatio * durations[i] => now; velocity => inst.noteOff; pauseRatio * durations[i] => now; } } else { velocity => inst.noteOff; for (0 => int j; j < iterations[i]; j++) { durations[i] => now; } } } } fun void playPFNotes(StkInstrument inst, int pitches[], dur durOfEachPitch, float velocity, float playRatio) { playPFNotes(inst, pitches, getUniformDurArr(pitches.cap(), durOfEachPitch), getUniformIntArr(pitches.cap(), 1), velocity, playRatio); } fun void playPFNotes(StkInstrument pf, int pitches[], dur durations[], int iterations[], float velocity, float playRatio) { for (0 => int i; i < pitches.cap(); i++) { pitches[i] - 7 => pitches[i]; } playNotes(pf, pitches, durations, iterations, velocity, playRatio); } fun void playBassMotifWithRests(int pitches[], StkInstrument inst, StkInstrument inst2) { eighthNote => now; playBassMotif(pitches, inst, inst2); quarterNote => now; } fun void playBassMotif(int pitches[], StkInstrument inst, StkInstrument inst2) { 0.3 => inst.gain; 0.3 => inst2.gain; spork ~ playNotes(inst, pitches, [eighthNote, quarterNote], [3, 1], 0.8, 0.9); spork ~ playNotes(inst2, changeOctave(pitches, -1), [eighthNote, quarterNote], [3, 1], 0.8, 0.9); 3 * eighthNote + quarterNote => now; } fun void playBassNotes(int pitches[], dur durations[]) { HevyMetl inst => dac; HevyMetl inst2 => dac; 0.3 => inst.gain; 0.3 => inst2.gain; spork ~ playNotes(inst, pitches, durations, getUniformIntArr(pitches.cap(), 1), 0.9, 0.9); playNotes(inst2, changeOctave(pitches, -1), durations, getUniformIntArr(pitches.cap(), 1), 0.9, 0.9); } fun void playFirstTransition() { BandedWG violin1 => NRev r => dac; r.mix(0.2); HevyMetl bassTop => dac; HevyMetl bassBot => dac; 1.0 => bassTop.noteOff; 1.0 => bassBot.noteOff; setTempo(1.75 * tempoOneEighthNote); [-101, 8, 5, 2, -1, -4, -5] @=> int pitches1[]; getUniformDurArr(pitches1.cap(), eighthNote) @=> dur durs1[]; [1, 3, 1, 3, 1, 3, 1] @=> int reps1[]; spork ~ playNotes(violin1, pitches1, durs1, reps1, 1.0, 0.95); 3 * halfNote => now; setTempo(0.8 * tempoOneEighthNote); spork ~ playBassMotifWithRests([-17, -12], bassTop, bassBot); halfNote => now; getUniformDurArr(pitches1.cap(), eighthNote) @=> durs1; spork ~ playNotes(violin1, pitches1, durs1, reps1, 3.0, 0.95); 3 * halfNote => now; spork ~ playBassMotifWithRests([-17, -12], bassTop, bassBot); halfNote => now; setTempo(0.75 * tempoOneEighthNote); spork ~ playAscent(); halfNote => now; playBassMotifWithRests([-12, -12], bassTop, bassBot); playBassMotifWithRests([-12, -12], bassTop, bassBot); HevyMetl top => dac; HevyMetl bot => dac; 0.3 => float startGain; (1.0 - startGain) / 6 => float delta; for (0 => int i; i < 6; i++) { startGain + i * delta => top.gain; startGain + i * delta => bot.gain; Std.mtof(key - 12) => top.freq; Std.mtof(key - 24) => bot.freq; 0.3 + i * 0.1 => top.gain; 0.3 + i * 0.1 => bot.gain; 1.0 => top.noteOn; 1.0 => bot.noteOn; quarterNote => now; 1.0 => top.noteOff; 1.0 => bot.noteOff; quarterNote => now; } playForte(); } fun void playAscent() { HevyMetl inst => NRev r => dac; r.mix(0.02); 0.4 => float startGain; startGain => inst.gain; [3, 7, 12, 12, 11, 14, 14, 12, 15, 14, 17, 16, 19, 17, 20, 19, 22, 20, 24, 23, 26] @=> int pitches[]; [eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote] @=> dur durations[]; [1, 1, 2, 1, 3, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1] @=> int iterations[]; spork ~ playNotes(inst, pitches, durations, iterations, 0.8, 0.8); (1.5 - startGain) / 11 => float delta; for (0 => int i; i < 11; i++) { halfNote => now; startGain + i * delta => inst.gain; } 1.5 => inst.gain; } fun void playForte() { HevyMetl inst => dac; 1.5 => inst.gain; [24, 27, 24, 19, 15, 12, 7, 3, 0, -1, 29, 26, 23, 19, 17, 14, 11, 7, 5, 2, -1, 0, 0, 27, 24, 21, 18, 15, 12, 9, 9, -100, 10, -100] @=> int pitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + halfNote, quarterNote, quarterNote] @=> dur durations[]; [1, 3, 1, 3, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1] @=> int iterations[]; spork ~ playForteBass(); playNotes(inst, pitches, durations, iterations, 0.9, 0.9); } fun void playForteBass() { 3 => int nInsts; HevyMetl insts[nInsts]; for (0 => int i; i < nInsts; i++) { 0.8 => insts[i].gain; insts[i] => dac; 1.0 => insts[i].noteOff; } int pitches[3][6]; [-24, -24, -29, -29, -24, -24, -24, -100, -22, -100] @=> pitches[0]; [-12, -12, -17, -17, -12, -12, -12, -100, -10, -100] @=> pitches[1]; [-24, -24, -29, -29, -24, -24] @=> pitches[2]; [3 * halfNote + eighthNote, eighthNote, 3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, 3 * quarterNote, quarterNote, quarterNote] @=> dur durations[]; [1, 3, 1, 1, 2, 16, 1, 1, 1, 1] @=> int iterations[]; spork ~ playNotes(insts[0], pitches[0], durations, iterations, 0.9, 0.9); spork ~ playNotes(insts[1], pitches[1], durations, iterations, 0.9, 0.9); 19 * halfNote => now; } fun void playHornCall(int pitches[]) { PercFlut pf => dac; 1.0 => pf.gain; 1.0 => pf.noteOff; eighthNote => now; for (0 => int i; i < pitches.cap(); i++) { pitches[i] - 7 => pitches[i]; } [eighthNote, halfNote, halfNote, 14 * halfNote] @=> dur durations[]; [3, 1, 1, 1] @=> int iterations[]; playNotes(pf, pitches, durations, iterations, 0.8, 0.9); } fun void playSecondTheme1() { 63 => key; Clarinet cl => NRev rev => dac; 0.001 => cl.rate; 0.8 => cl.pressure; PercFlut accInstTop => dac; PercFlut accInstBot => dac; HevyMetl bassTop => dac; HevyMetl bassBot => dac; 1.0 => bassTop.noteOff; 1.0 => bassBot.noteOff; 0.5 => cl.gain; 0.3 => accInstTop.gain; 0.3 => accInstBot.gain; rev.mix(0.1); playSecondTheme1Notes(cl, accInstTop, accInstBot, bassTop, bassBot, 0); cl =< rev; Wurley w => rev; playSecondTheme1Notes(w, accInstTop, accInstBot, bassTop, bassBot, 0); w =< rev; cl => rev; playSecondTheme1Notes(cl, accInstTop, accInstBot, bassTop, bassBot, 1); cl =< rev; cl => rev; playSecondTheme2Notes(cl, accInstTop, accInstBot, bassTop, bassBot); accInstTop =< dac; accInstBot =< dac; HevyMetl hm => rev; playSecondTheme3(cl, hm, bassTop, bassBot); } fun void playSecondTheme1Notes(StkInstrument melodicInst, PercFlut accInstTop, PercFlut accInstBot, StkInstrument bassTop, StkInstrument bassBot, int transposition) { [7, 12, 11, 12, 14, 9, 9, 7] @=> int melodicInstPitches[]; spork ~ playNotes(melodicInst, changeOctave(melodicInstPitches, transposition), getUniformDurArr(8, quarterNote), getUniformIntArr(8, 1), 0.8, 0.99); spork ~ playPFNotes(accInstTop, [4, 5, 5, 4], getUniformDurArr(4, halfNote), getUniformIntArr(4, 1), 0.6, 0.99); spork ~ playPFNotes(accInstBot, [0, 2, 2, 0], getUniformDurArr(4, halfNote), getUniformIntArr(4, 1), 0.6, 0.99); 2 * halfNote => now; spork ~ playBassMotifWithRests([-17, -12], bassTop, bassBot); 2 * halfNote => now; } fun void playSecondTheme2Notes(StkInstrument melodicInst, PercFlut accInstTop, PercFlut accInstBot, StkInstrument bassTop, StkInstrument bassBot) { spork ~ playNotes(melodicInst, [7, 9, 10, 9, 7, 9, 7, 5, 10, 12, 14, 12, 10, 12, 10, 9], quarterNote, 0.8, 0.99); spork ~ playPFNotes(accInstTop, [4, 4, 4, 2, 5, 7, 7, 5], halfNote, 0.6, 0.99); spork ~ playPFNotes(accInstBot, [0, 1, 1, -3, 2, 4, 4, 0], halfNote, 0.6, 0.99); 2 * halfNote => now; spork ~ playBassMotifWithRests([-15, -10], bassTop, bassBot); 4 * halfNote => now; spork ~ playBassMotifWithRests([-12, -7], bassTop, bassBot); 2 * halfNote => now; } fun void playSecondTheme3(StkInstrument melodicInstTop, StkInstrument melodicInstBot, StkInstrument bassTop, StkInstrument bassBot) { spork ~ playNotes(melodicInstTop, changeOctave([0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 3, 6], 1), quarterNote, 0.6, 0.99); spork ~ playNotes(melodicInstBot, [0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 0, 2, 3, 2, 3, 0], quarterNote, 0.8, 0.99); [2 * halfNote, 2 * halfNote, 4 * halfNote + quarterNote, quarterNote, quarterNote, quarterNote] @=> dur woodwindDurs[]; halfNote => now; PercFlut pf => dac; 0.5 => pf.gain; spork ~ playPFNotes(pf, changeOctave([9, 7, 6, 6, 6, 6], 1), woodwindDurs, getUniformIntArr(6, 1), 0.6, 0.99); for (-6 => int i; i <= -3; i++) { playBassMotifWithRests([i, i], bassTop, bassBot); } eighthNote => now; HevyMetl bassTop => dac; HevyMetl bassBot => dac; playBassMotif([-3, -3], bassTop, bassBot); playBassNotes([-3, -3], [eighthNote, eighthNote]); } fun void playSecondTheme4() { 63 => key; PercFlut melodicInst => dac; Wurley melodicInst2 => dac; [19, 21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 18, 19, 18, 19, 18, 19, 18, 19, 21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 7, 19, 19] @=> int melodicInst1Pitches[]; [19, 21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 18, 19, 18, 19, 18, 19, 18, 19, 21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 7, 19, 19] @=> int melodicInst2Pitches[]; //changeOctave(melodicInst1Pitches, 0) @=> melodicInst2Pitches; dur melodicInstDurs[melodicInst1Pitches.cap()]; for (0 => int i; i < melodicInstDurs.cap(); i++) { if (i == 0) halfNote + eighthNote => melodicInstDurs[i]; else eighthNote => melodicInstDurs[i]; } spork ~ playPFNotes(melodicInst, melodicInst1Pitches, melodicInstDurs, getUniformIntArr(melodicInst1Pitches.cap(), 1), 0.95, 0.95); spork ~ playNotes(melodicInst2, melodicInst2Pitches, melodicInstDurs, getUniformIntArr(melodicInst1Pitches.cap(), 1), 0.95, 0.95); HevyMetl acc1 => dac; 0.6 => acc1.gain; [17] @=> int acc1Pitches[]; //changeOctave(acc1Pitches, -1) @=> acc1Pitches; dur acc1Durs[acc1Pitches.cap()]; for (0 => int i; i < acc1Durs.cap(); i++) { if (i == 0) halfNote + quarterNote => acc1Durs[i]; else quarterNote => acc1Durs[i]; } spork ~ playNotes(acc1, acc1Pitches, acc1Durs, getUniformIntArr(acc1Pitches.cap(), 1), 0.95, 0.95); HevyMetl acc2 => dac; 0.6 => acc2.gain; [14] @=> int acc2Pitches[]; //changeOctave(acc2Pitches, -1) @=> acc2Pitches; dur acc2Durs[acc2Pitches.cap()]; for (0 => int i; i < acc2Durs.cap(); i++) { if (i == 0) halfNote + quarterNote => acc2Durs[i]; else quarterNote => acc2Durs[i]; } spork ~ playNotes(acc2, acc2Pitches, acc2Durs, getUniformIntArr(acc2Pitches.cap(), 1), 0.95, 0.95); [-1, -13, -12, -100, -10, -100, -8, -100, -7, -100, -5, -100, -17, -100, -13, -10, -13, -10, -12, -8, -10, -7, -8, -5, -7, -3, -5, -17, -5, -17] @=> int bassPitches[]; dur bassDurs[bassPitches.cap()]; for (0 => int i; i < bassDurs.cap(); i++) { if (i == 0) halfNote + quarterNote => bassDurs[i]; else quarterNote => bassDurs[i]; } playBassNotes(bassPitches, bassDurs); //16 * halfNote => now; } fun void playSecondTheme5() { 63 => key; PercFlut melodicInst => dac; [12, 16, 12, 7, 4, 0, -5, 16, 12, 7, 4, 0, -5] @=> int melodicInstPitches[]; changeOctave(melodicInstPitches, 1) @=> melodicInstPitches; dur melodicInstDurs[melodicInstPitches.cap()]; for (0 => int i; i < melodicInstDurs.cap(); i++) { if (i == 6) halfNote + eighthNote => melodicInstDurs[i]; else eighthNote => melodicInstDurs[i]; } int melodicInstIters[melodicInstPitches.cap()]; for (0 => int i; i < melodicInstIters.cap(); i++) { if (i % 2 == 1) 3 => melodicInstIters[i]; else 1 => melodicInstIters[i]; } PercFlut accInst1 => dac; [12, 14, 14, 14, 16, 19, 19, 19, 19, -100, 19, 19, 19, 19, -100, 23, 23, 23, 24, -100] @=> int accInst1Pitches[]; Wurley accInst2 => dac; [0, -1, -1, -1, 0, 11, 11, 11, 12, -100, 11, 11, 11, 12, -100, 14, 14, 14, 16, -100] @=> int accInst2Pitches[]; HevyMetl accInst3; [-8, -5, -5, -5, -5, 2, 2, 2, 4, -100, 2, 2, 2, 4, -100, 7, 7, 7, 7, -100] @=> int accInst3Pitches[]; [3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, 3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote] @=> dur accInst1Durs[]; [-12, -17, -17, -17, -12, -17, -17, -17, -12, -100, -17, -17, -17, -12, -100, -17, -17, -17, -12, -100] @=> int bassPitches[]; spork ~ playPFNotes(melodicInst, melodicInstPitches, melodicInstDurs, melodicInstIters, 0.95, 0.95); spork ~ playPFNotes(accInst1, accInst1Pitches, accInst1Durs, getUniformIntArr(accInst1Pitches.cap(), 1), 0.95, 0.95); spork ~ playNotes(accInst2, accInst2Pitches, accInst1Durs, getUniformIntArr(accInst1Pitches.cap(), 1), 0.95, 0.95); spork ~ playNotes(accInst3, accInst3Pitches, accInst1Durs, getUniformIntArr(accInst1Pitches.cap(), 1), 0.95, 0.95); playBassNotes(bassPitches, accInst1Durs); 2 * halfNote => now; } fun void playDevelopmentHornCall() { eighthNote => now; 60 => key; HevyMetl inst => NRev r => dac; eighthNote => dur origEighthNote; setTempo(1.75 * origEighthNote); r.mix(0.02); spork ~ playNotes(inst, [10, 7, -105], [eighthNote, 5 * halfNote, 2 * halfNote], [3, 1, 1], 0.9, 0.9); halfNote => now; HevyMetl violin => r; HevyMetl violin2 => r; HevyMetl bassTop => r; [eighthNote, 4 * halfNote] @=> dur strDurs[]; [3, 1] @=> int strReps[]; spork ~ playNotes(violin, [1, 0], strDurs, strReps, 0.9, 0.9); spork ~ playNotes(violin2, [-11, -12], strDurs, strReps, 0.9, 0.9); playNotes(bassTop, [-23, -24], strDurs, strReps, 0.9, 0.9); 2 * halfNote => now; setTempo(origEighthNote); } fun void playDevelopmentTheme1() { 60 => key; BandedWG inst; 0.3 => inst.gain; spork ~ playFirstTheme1Melody(inst); halfNote => now; HevyMetl alto => dac; PercFlut bassTop => dac; spork ~ playNotes(alto, [0, 1, 0, 1, 0, 2, 3, 5, 6], [2 * halfNote + eighthNote, eighthNote, 3 * halfNote + eighthNote, eighthNote, 6 * halfNote, quarterNote, quarterNote, quarterNote, quarterNote], [1, 3, 1, 3, 1, 1, 1, 1, 1], 0.1, 0.98); spork ~ playPFNotes(bassTop, [5, 4, 5, 4, 5, 4, 5], [4 * halfNote, 4 * halfNote, halfNote, halfNote, halfNote, halfNote, quarterNote], getUniformIntArr(7, 1), 0.2, 0.99); 11 * halfNote => now; 8 => int nIntervals; for (0 => int i; i < nIntervals; i++) { 0.6 + i * 0.3 => inst.gain; 0.6 + i * 0.3 => alto.gain; quarterNote => now; } } fun void playFirstTheme1Melody(StkInstrument inst) { eighthNote => now; playFirstTheme1(inst, [12, 8, 13, 12, 20, 17]); playFirstTheme1(inst, [12, 7, 13, 12, 22, 19]); playNotes(inst, changeOctave([12, 10, 8, 7, 12, 10, 8, 7, 12, 10, 8, 7, 5, 3, 2, 0], 1), [eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote], [2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1], 0.5, 0.9); } fun void playDevelopmentTheme2() { BandedWG melodicInst => NRev r => dac; r.mix(0.2); 3.0 => melodicInst.gain; HevyMetl altoInst => dac; HevyMetl bass => dac; 0.5 => altoInst.gain; 1.5 => bass.gain; spork ~ playNotes(melodicInst, [11, -100, 15, 17, 19, 15, 17, 19, 21, 22, 24, 25], [quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, 2 * halfNote, quarterNote, quarterNote, quarterNote, quarterNote], [1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1], 0.6, 0.9); spork ~ playNotes(altoInst, [7, 5, 3, 2, 7, 5, 3, 2, 7, 5, 3, 2, 0, -2, -3, -5], [eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote], [3, 1, 1, 1, 2, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1], 0.5, 0.9); changeOctave([-101, -5, 0, -101, -5, -101, 0, -101, -5, -101, 0, -101, -101, -101, -3, -101], -2) @=> int bassPitches[]; getUniformDurArr(bassPitches.cap(), quarterNote) @=> dur bassDurs[]; getUniformIntArr(bassPitches.cap(), 1) @=> int bassReps[]; playNotes(bass, bassPitches, bassDurs, bassReps, 0.4, 0.7); } fun void playDevelopmentTheme3() { ModalBar melodicInst1 => NRev r => dac; BandedWG melodicInst2 => r => dac; PercFlut pf => r; r.mix(0.2); HevyMetl altoInst => dac; 2.0 => melodicInst2.gain; 0.8 => melodicInst1.gain; 0.5 => altoInst.gain; spork ~ playPFNotes(pf, [26], [5 * halfNote + eighthNote], [1], 0.4, 1.0); spork ~ playNotes(melodicInst1, [26, 26, 24, 22, 21, 26, 24, 22, 21], [eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, halfNote, halfNote], [1, 2, 1, 1, 1, 2, 1, 1, 1], 0.5, 0.9); spork ~ playNotes(melodicInst2, [26, 7, 9, 6, -100, 19, 21, 18, 14], [halfNote + eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote], [1, 2, 1, 1, 1, 2, 1, 1, 1], 0.5, 0.9); spork ~ playNotes(altoInst, [-6, -100, -2, 0, 2, -2, 0, 2, 0], [quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote], [1, 1, 2, 1, 1, 2, 1, 3, 1], 0.5, 0.9); 5 * halfNote => now; spork ~ playNotes(melodicInst2, [-100, 19, 21, 22, -100, 18, 21, 22, 24, -100, 18, 21, 22, 24, -100, 19, 22, 24, 26, -100, 22, 24, 26, 22, 24, 26], [eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote], [1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 0.5, 0.9); spork ~ playNotes(altoInst, [-2, -3, -5, -7, -9, -10, -12, 0, -2, -3, -5, -6, -9, -10, -12, -14, 2, 0, -2, -3, -5, -7, -9, -10], getUniformDurArr(24, eighthNote), [3, 1, 3, 1, 3, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1], 0.5, 0.9); 10 * halfNote => now; } fun void playDevelopmentTheme4() { HevyMetl trebleInsts[4]; NRev r => dac; r.mix(0.02); for (0 => int i; i < trebleInsts.cap(); i++) { trebleInsts[i] => r; 0.6 => trebleInsts[i].gain; } HevyMetl bassTop => dac; HevyMetl bassBot => dac; 0.6 => bassTop.gain; 0.6 => bassTop.gain; 0.94 => float playRatio; spork ~ playNotes(trebleInsts[0], [27, 27], [eighthNote, quarterNote], [8, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[1], [18, 18], [eighthNote, quarterNote], [8, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[2], [15, 15], [eighthNote, quarterNote], [8, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[3], [9, 9], [eighthNote, quarterNote], [8, 1], 0.7, playRatio); spork ~ playNotes(bassTop, [-12, -12], [eighthNote, quarterNote], [8, 1], 0.9, playRatio); spork ~ playNotes(bassBot, [-24, -24], [eighthNote, quarterNote], [8, 1], 0.9, playRatio); 3 * halfNote => now; eighthNote => now; spork ~ playNotes(trebleInsts[0], [28, 28], [eighthNote, quarterNote], [11, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[1], [19, 19], [eighthNote, quarterNote], [11, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[2], [16, 16], [eighthNote, quarterNote], [11, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[3], [10, 10], [eighthNote, quarterNote], [11, 1], 0.7, playRatio); spork ~ playNotes(bassTop, [-11, -11], [eighthNote, quarterNote], [11, 1], 0.9, playRatio); spork ~ playNotes(bassBot, [-23, -23], [eighthNote, quarterNote], [11, 1], 0.9, playRatio); 4 * halfNote => now; spork ~ playNotes(trebleInsts[0], [26, 26], [eighthNote, quarterNote], [3, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[1], [19, 19], [eighthNote, quarterNote], [3, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[2], [14, 14], [eighthNote, quarterNote], [3, 1], 0.7, playRatio); spork ~ playNotes(trebleInsts[3], [10, 10], [eighthNote, quarterNote], [3, 1], 0.7, playRatio); spork ~ playNotes(bassTop, [-10, -10], [eighthNote, quarterNote], [3, 1], 0.9, playRatio); spork ~ playNotes(bassBot, [-22, -22], [eighthNote, quarterNote], [3, 1], 0.9, playRatio); 2 * halfNote + eighthNote => now; spork ~ playNotes(trebleInsts[0], [25, 25, 26], [eighthNote, quarterNote, eighthNote], [2, 1, 6], 0.7, playRatio); spork ~ playNotes(trebleInsts[1], [19, 19, 26, 26, -100], [eighthNote, quarterNote, eighthNote, quarterNote, quarterNote], [2, 1, 2, 1, 1], 0.9, playRatio); spork ~ playNotes(trebleInsts[2], [13, 13, 14], [eighthNote, quarterNote, eighthNote], [2, 1, 6], 0.7, playRatio); spork ~ playNotes(trebleInsts[3], [10, 10, 9, 9, -100], [eighthNote, quarterNote, eighthNote, quarterNote, quarterNote], [2, 1, 2, 1, 1], 0.9, playRatio); spork ~ playNotes(bassTop, [-8, -8, -6, -6, -100], [eighthNote, quarterNote, eighthNote, quarterNote, quarterNote], [2, 1, 2, 1, 1], 0.9, playRatio); spork ~ playNotes(bassBot, [-20, -20, -18, -18, -100], [eighthNote, quarterNote, eighthNote, quarterNote, quarterNote], [2, 1, 2, 1, 1], 0.9, playRatio); quarterNote + 2 * halfNote => now; } fun void playDevelopmentTheme5() { 60 => key; HevyMetl trebleInstTop => NRev r => dac; HevyMetl trebleInstBot => r; r.mix(0.02); 0.3 => trebleInstTop.gain; 0.3 => trebleInstTop.gain; [7, 9, 2, 6, 9, 14] @=> int treblePitches[]; [halfNote, halfNote, 3 * halfNote + quarterNote, eighthNote, quarterNote, eighthNote] @=> dur trebleDurs[]; [1, 1, 1, 2, 1, 2] @=> int trebleIters[]; spork ~ playNotes(trebleInstTop, [19, 21, 14, 18, 21, 26], trebleDurs, trebleIters, 1.0, 0.95); spork ~ playNotes(trebleInstBot, [7, 9, 2, 6, 9, 14], trebleDurs, trebleIters, 1.0, 0.95); [0, -3, -6, -10, -12, -15, -18, -10] @=> int bassPitches[]; dur bassDurs[bassPitches.cap()]; for (0 => int i; i < bassDurs.cap(); i++) { if (i == 0) halfNote => bassDurs[i]; else quarterNote => bassDurs[i]; } getUniformIntArr(bassPitches.cap(), 1) @=> int bassIters[]; 2 * halfNote + quarterNote => now; HevyMetl bassTop => r; HevyMetl bassBot => r; 0.6 => bassTop.gain; 0.6 => bassTop.gain; spork ~ playNotes(bassTop, bassPitches, bassDurs, bassIters, 0.8, 0.95); spork ~ playNotes(bassBot, changeOctave(bassPitches, -1), bassDurs, bassIters, 0.8, 0.95); quarterNote + 4 * halfNote => now; spork ~ playNotes(trebleInstTop, changeOctave([11, 7], 1), [eighthNote, eighthNote], [1, 3], 1.0, 0.9); spork ~ playNotes(trebleInstBot, [11, 7], [eighthNote, eighthNote], [1, 3], 1.0, 0.9); spork ~ playNotes(bassTop, [-17, -100], [quarterNote, quarterNote], [1, 1], 0.8, 0.9); spork ~ playNotes(bassBot, changeOctave([-17, -100], -1), [quarterNote, quarterNote], [1, 1], 0.8, 0.9); halfNote => now; } fun void playDevelopmentTheme6() { 53 => key; HevyMetl trebleInstTop => dac; HevyMetl trebleInstBot => dac; 0.4 => trebleInstTop.gain; 0.4 => trebleInstTop.gain; [halfNote, halfNote, 3 * halfNote + quarterNote, eighthNote, quarterNote, eighthNote] @=> dur trebleDurs[]; [1, 1, 1, 2, 1, 2] @=> int trebleIters[]; spork ~ playNotes(trebleInstTop, [19, 21, 14, 18, 21, 26], trebleDurs, trebleIters, 1.0, 0.95); spork ~ playNotes(trebleInstBot, changeOctave([19, 21, 14, 18, 21, 26], -1), trebleDurs, trebleIters, 1.0, 0.95); changeOctave([0, -3, -6, -10, -12, -15, -18, -10], 1) @=> int bassPitches[]; dur bassDurs[bassPitches.cap()]; for (0 => int i; i < bassDurs.cap(); i++) { if (i == 0) halfNote => bassDurs[i]; else quarterNote => bassDurs[i]; } getUniformIntArr(bassPitches.cap(), 1) @=> int bassIters[]; 2 * halfNote + quarterNote => now; HevyMetl bassTop => dac; HevyMetl bassBot => dac; 0.6 => bassTop.gain; 0.6 => bassTop.gain; spork ~ playNotes(bassTop, bassPitches, bassDurs, bassIters, 0.8, 0.95); spork ~ playNotes(bassBot, changeOctave(bassPitches, -1), bassDurs, bassIters, 0.8, 0.95); quarterNote + 4 * halfNote => now; 60 => key; spork ~ playNotes(trebleInstTop, changeOctave([4, 12], 1), [eighthNote, eighthNote], [1, 3], 1.0, 0.95); spork ~ playNotes(trebleInstBot, [4, 12], [eighthNote, eighthNote], [1, 3], 1.0, 0.95); spork ~ playNotes(bassTop, [-12, -100], [quarterNote, quarterNote], [1, 1], 0.8, 0.95); spork ~ playNotes(bassBot, changeOctave([-12, -100], -1), [quarterNote, quarterNote], [1, 1], 0.8, 0.95); halfNote => now; } fun void playCallResponse() { 6 => int nStrInsts; 6 => int nWindInsts; StkInstrument strInsts[nStrInsts]; StkInstrument windInsts[nWindInsts]; NRev windsRev => dac; windsRev.mix(0.2); for (0 => int i; i < nWindInsts; i++) { ModalBar m @=> windInsts[i] => windsRev; 0.8 => m.gain; 0.5 => m.noteOff; } NRev strRev => dac; strRev.mix(0.05); for (0 => int i; i < nStrInsts; i++) { HevyMetl m @=> strInsts[i] => strRev; 0.8 => m.gain; 0.5 => m.noteOff; } playWWCallResponseHalfNote(windInsts, changeOctave([-4, 0, 5], 1), changeOctave([-2, 1, 7], 1)); playStringCallResponseHalfNote(strInsts, [-29, -17, -2, 0, 4], [-28, -16, 0, 0, 5], 0.8); playWWCallResponseHalfNote(windInsts, changeOctave([-4, 0, 5], 1), changeOctave([-2, 1, 7], 1)); playStringCallResponseHalfNote(strInsts, [-29, -17, -2, 0, 4], [-28, -16, 0, 0, 5], 0.8); playWWCallResponseHalfNote(windInsts, changeOctave([-4, 0, 5], 1), changeOctave([-2, 1, 6], 1)); playStringCallResponseHalfNote(strInsts, [-26, -14, -2, 1, 6], [-24, -12, -9, -3, 9], 0.7); playWWCallResponseHalfNote(windInsts, changeOctave([0, 3, 9], 1), changeOctave([1, 5, 10], 1)); playStringCallResponseHalfNote(strInsts, [-23, -11, -7, 5, 10], [-101], 0.65); playWWCallResponseHalfNote(windInsts, changeOctave([3, 6, 11], 1), [-101]); setInstGains(strInsts, 0.6); playStringCallResponseHalfNote(strInsts, [-21, -9, -6, -1, 11], [-101], 0.6); setInstGains(windInsts, 0.6); playWWCallResponseHalfNote(windInsts, [17, 20, 25], [-101]); setInstGains(strInsts, 0.4); playStringCallResponseHalfNote(strInsts, [-19, -7, -7, -4, 13], [-101], 0.5); setInstGains(windInsts, 0.3); setInstGains(strInsts, 0.3); for (0 => int i; i < 3; i++) { playWWCallResponseHalfNote(windInsts, [18, 21, 25], [-101]); playStringCallResponseHalfNote(strInsts, [-30, -18, -6, -3, 1], [-101], 0.4); } for (0 => int i; i < 3; i++) { playWWCallResponseHalfNote(windInsts, [18, 21, 26], [-101]); playStringCallResponseHalfNote(strInsts, [-30, -18, -6, -3, 2], [-101], 0.4); } playWWCallResponseHalfNote(windInsts, [18, 21, 26], [-101]); halfNote => now; BandedWG bwg => NRev r => dac; 1.0 => bwg.gain; r.mix(0.2); playNotes(bwg, [2, 14, 11, 12, 9], [2 * eighthNote, 2 * eighthNote, 2 * halfNote, 2 * halfNote, 4 * halfNote], [1, 3, 1, 1, 1], 2.0, 0.95); for (0 => int i; i < 3; i++) { playWWCallResponseHalfNote(windInsts, [11, 14, 20, 26], [-101]); playStringCallResponseHalfNote(strInsts, [-25, -13, -7, -4, 2], [-101], 0.4); } playWWCallResponseHalfNote(windInsts, [11, 14, 20, 26], [-101]); } fun void playStringCallResponseHalfNote(StkInstrument insts[], int pitches[], int pitches2[], float velocity) { 0.0 * eighthNote => dur waitTime; NRev rev => dac; rev.mix(0.05); for (0 => int i; i < pitches.cap(); i++) { spork ~ playNotes(insts[i], [pitches[i]], [halfNote], [1], velocity, 0.97); } halfNote - waitTime * pitches.cap() => now; if (pitches2[0] != -101) { for (0 => int i; i < pitches2.cap(); i++) { spork ~ playNotes(insts[i], [pitches2[i]], [halfNote], [1], velocity, 0.97); } halfNote - waitTime * pitches2.cap() => now; } } fun void playWWCallResponseHalfNote(StkInstrument insts[], int pitches[], int pitches2[]) { 0.1 * eighthNote => dur waitTime; for (0 => int i; i < pitches.cap(); i++) { spork ~ playNotes(insts[i], [pitches[i]], [halfNote], [1], 1.0, 0.95); waitTime => now; } halfNote - waitTime * pitches.cap() => now; if (pitches2[0] != -101) { for (0 => int i; i < pitches2.cap(); i++) { spork ~ playNotes(insts[i], [pitches2[i]], [halfNote], [1], 1.0, 0.95); waitTime => now; } halfNote - waitTime * pitches2.cap() => now; } } fun void playReturnToRecap() { NRev r => dac; r.mix(0.05); HevyMetl bassHigh => r; HevyMetl bassLow => r; BeeThree trebleLow => r; BeeThree trebleHigh => r; 0.9 => trebleLow.gain; 0.9 => trebleLow.gain; [-101, 8, 5, 8, 5, 8, 5, 8, 5, 8, 5, 7, 3, -101, 5, 2] @=> int trebleLowPitches[]; changeOctave([-201, 8, 5, 8, 5, 8, 5, 8, 5, 8, 5, 7, 3, -101, 5, 2], 1) @=> int trebleHighPitches[]; changeOctave([-13, -4, -7, -4, -7, -4, -7, -4, -7, -4, -7, -4, -7, -5, -9, -101, -7, -10], -1) @=> int bassHighPitches[]; changeOctave([-1, -4, -7, -4, -7, -4, -7, -4, -7, -4, -7, -4, -7, -5, -9, -101, -7, -10], -2) @=> int bassLowPitches[]; [eighthNote, eighthNote, halfNote + eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, 4 * halfNote, quarterNote, quarterNote, 8 * halfNote] @=> dur bassDurs[]; [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1] @=> int bassReps[]; [halfNote + eighthNote, eighthNote, halfNote + eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, 4 * halfNote, quarterNote, quarterNote, 8 * halfNote] @=> dur trebleDurs[]; [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 3, 1] @=> int trebleReps[]; spork ~ playNotes(trebleLow, trebleLowPitches, trebleDurs, trebleReps, 0.7, 0.95); spork ~ playNotes(trebleHigh, trebleHighPitches, trebleDurs, trebleReps, 0.7, 0.95); spork ~ playNotes(bassLow, bassLowPitches, bassDurs, bassReps, 0.9, 0.95); playNotes(bassHigh, bassHighPitches, bassDurs, bassReps, 0.9, 0.95); 2 * halfNote => now; } fun void playFirstThemeRecap() { [-100, 7, 3, 8, 7, 15, 12, -100, 7, 2, 8, 7, 17, 14, 19, 17, 15, 14, 19, 17, 15, 14, 19, 17, 15, -101, 12, -101] @=> int firstThemePitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote, quarterNote, quarterNote] @=> dur firstThemeDurs[]; [1, 3, 1, 3, 1, 3, 1, 1, 3, 1, 3, 1, 3, 1, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1] @=> int firstThemeReps[]; [-101, 0, 0, 3, 0, -1, -5, -1, -5, 0, -1, 0, -5, 0, -4] @=> int bassPitches[]; [halfNote, 2 * halfNote + quarterNote, quarterNote, quarterNote, quarterNote, 2 * halfNote + quarterNote, quarterNote, quarterNote, quarterNote, halfNote, halfNote, halfNote, halfNote, halfNote, halfNote] @=> dur bassDurs[]; BandedWG bwg => NRev r => dac; HevyMetl bass => NRev r2 => dac; 0.3 => bass.gain; r.mix(0.25); r2.mix(0.1); spork ~ playNotes(bass, bassPitches, bassDurs, getUniformIntArr(bassPitches.cap(), 1), 0.4, 0.99); playNotes(bwg, firstThemePitches, firstThemeDurs, firstThemeReps, 2.0, 0.95); ModalBar oboe => r; [-5, 2, 11, 19, 17, 15, 14, 15, 14, 12, 14, 17, 15, 14] @=> int oboePitches[]; setTempo(600::ms); eighthNote * 0.5 => dur sixteenthNote; [0.5 * sixteenthNote, 0.5 * sixteenthNote, 0.5 * sixteenthNote, 2 * halfNote, quarterNote, quarterNote, halfNote, sixteenthNote, sixteenthNote, sixteenthNote, sixteenthNote, quarterNote, quarterNote, halfNote] @=> dur oboeDurs[]; getUniformIntArr(oboePitches.cap(), 1) @=> int oboeReps[]; playNotes(oboe, oboePitches, oboeDurs, oboeReps, 1.0, 0.95); halfNote => now; setTempo(tempoOneEighthNote); } fun void playSecondTransition() { BandedWG violin1 => NRev r => dac; r.mix(0.2); HevyMetl violin2 => dac; HevyMetl bassTop => dac; HevyMetl bassBot => dac; 1.0 => bassTop.noteOff; 1.0 => bassBot.noteOff; 1.0 => violin2.noteOff; 0.8 => bassTop.gain; 0.8 => bassBot.gain; 0.8 => violin2.gain; [-101, 8, 5, 2, -1, -4, -5] @=> int pitches1[]; getUniformDurArr(pitches1.cap(), eighthNote) @=> dur durs1[]; [1, 3, 1, 3, 1, 3, 1] @=> int reps1[]; spork ~ playNotes(violin1, pitches1, durs1, reps1, 1.0, 0.95); 3 * halfNote => now; setTempo(0.9 * tempoOneEighthNote); eighthNote => now; [3, 8, 5, 2, -1, -4, -5, 11] @=> int violinPitches[]; [-17, -12, -4, -7, -10, -13, -16, -17, -5] @=> int bassTopPitches[]; changeOctave([-17, -12, -4, -7, -10, -13, -16, -17, -5], -1) @=> int bassBotPitches[]; getUniformDurArr(bassTopPitches.cap(), eighthNote) @=> dur bassDurs[]; [3, 1, 3, 1, 3, 1, 3, 1, 3] @=> int bassReps[]; spork ~ playNotes(bassTop, bassTopPitches, bassDurs, bassReps, 0.7, 0.9); spork ~ playNotes(bassBot, bassBotPitches, bassDurs, bassReps, 0.7, 0.9); 3 * eighthNote => now; playNotes(violin2, violinPitches, getUniformDurArr(violinPitches.cap(), eighthNote), [1, 3, 1, 3, 1, 3, 1, 3], 1.0, 0.95); spork ~ playAscent2(); [eighthNote, halfNote + eighthNote, eighthNote, halfNote + eighthNote, eighthNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote] @=> dur bassAscDurs[]; [4, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] @=> int bassAscReps[]; changeOctave([0, 0, 0, 0, 0, 0, -101, 0, -101, 0, -101, 0, -101, 0, -101, 0, -101], -1) @=> bassTopPitches; changeOctave([0, 0, 0, 0, 0, 0, -101, 0, -101, 0, -101, 0, -101, 0, -101, 0, -101], -2) @=> bassBotPitches; spork ~ playNotes(bassTop, bassTopPitches, bassAscDurs, bassAscReps, 0.7, 0.9); playNotes(bassBot, bassBotPitches, bassAscDurs, bassAscReps, 0.7, 0.9); playForte2(); } fun void playAscent2() { HevyMetl inst => NRev r => dac; r.mix(0.02); 0.8 => float startGain; startGain => inst.gain; [12, 7, 12, 12, 11, 14, 14, 12, 15, 14, 17, 16, 19, 17, 20, 19, 22, 20, 24, 23, 26] @=> int pitches[]; [eighthNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, halfNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote] @=> dur durations[]; [1, 1, 2, 1, 3, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1] @=> int iterations[]; spork ~ playNotes(inst, pitches, durations, iterations, 1.0, 0.8); (1.5 - startGain) / 11 => float delta; for (0 => int i; i < 11; i++) { startGain + delta * i => inst.gain; halfNote => now; } } fun void playForte2() { HevyMetl inst => dac; 1.5 => inst.gain; [24, 27, 24, 19, 15, 12, 7, 3, 0, -1, 29, 26, 23, 19, 17, 14, 11, 7, 5, 2, -1, 0, 0, 27, 24, 21, 18, 15, 12, 9, 6, -100, 7, -100] @=> int pitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + halfNote, quarterNote, quarterNote] @=> dur durations[]; [1, 3, 1, 3, 1, 1, 2, 1, 3, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1] @=> int iterations[]; spork ~ playForteBass2(); playNotes(inst, pitches, durations, iterations, 0.9, 0.9); } fun void playForteBass2() { 3 => int nInsts; HevyMetl insts[nInsts]; for (0 => int i; i < nInsts; i++) { 0.8 => insts[i].gain; insts[i] => dac; 1.0 => insts[i].noteOff; } int pitches[3][6]; [-24, -24, -29, -29, -24] @=> pitches[0]; [-12, -12, -17, -17, -12] @=> pitches[1]; [3 * halfNote + eighthNote, eighthNote, 3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, 3 * quarterNote, quarterNote, quarterNote] @=> dur durations[]; [1, 3, 1, 1, 2] @=> int iterations[]; spork ~ playNotes(insts[0], pitches[0], durations, iterations, 0.9, 0.9); playNotes(insts[1], pitches[1], durations, iterations, 0.9, 0.9); [-12, 3, 0, -3, -6, -9, -12, -15, -12, -101, -13] @=> int bassTopPitches[]; changeOctave([-12, 3, 0, -3, -6, -9, -12, -15, -12, -101, -13], -1) @=> int bassBotPitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + halfNote, quarterNote] @=> dur bassDurs[]; [1, 3, 1, 3, 1, 3, 1, 3, 1, 1, 1] @=> int bassReps[]; spork ~ playNotes(insts[0], bassTopPitches, bassDurs, bassReps, 0.9, 0.9); playNotes(insts[1], bassBotPitches, bassDurs, bassReps, 0.9, 0.9); } fun void playSecondThemeRecap() { playSecondThemeRecap1(); playSecondThemeRecap2(1); playSecondThemeRecap3(); playSecondThemeRecap4(); } fun void playSecondThemeRecap1() { eighthNote => now; [7, 0, 2, -5] @=> int pitches[]; ModalBar inst => NRev r => dac; r.mix(0.2); 0.8 => inst.gain; 1.0 => inst.noteOff; eighthNote => now; [eighthNote, halfNote, halfNote, 18 * halfNote] @=> dur durations[]; [3, 1, 1, 1] @=> int iterations[]; spork ~ playNotes(inst, pitches, durations, iterations, 0.8, 1.0); 3 * eighthNote + 4 * halfNote => now; BandedWG violin => NRev r2 => dac; r2.mix(0.2); BandedWG flute => r; HevyMetl bassTop => r; HevyMetl bassBot => r; 0.5 => bassTop.noteOff; 0.5 => bassBot.noteOff; 1.0 => flute.noteOff; 1.0 => violin.gain; for (0 => int i; i < 2; i++) { [7, 12, 11, 12, 14, 9, 9, 7] @=> int violinPitches1[]; changeOctave([7, 12, 11, 12, 14, 9, 9, 7], 1) @=> int flutePitches1[]; getUniformDurArr(violinPitches1.cap(), quarterNote) @=> dur durs1[]; getUniformIntArr(violinPitches1.cap(), 1) @=> int reps1[]; playNotes(violin, violinPitches1, durs1, reps1, 2.0, 1.0); playNotes(flute, flutePitches1, durs1, reps1, 2.0, 1.0); } getUniformDurArr(4, quarterNote) @=> dur durs2[]; getUniformIntArr(4, 1) @=> int reps2[]; playNotes(violin, [10, 12, 13, 12], durs2, reps2, 2.0, 1.0); playNotes(flute, [22, 24, 22, 21], durs2, reps2, 2.0, 1.0); playNotes(violin, [12, 14, 15, 14], durs2, reps2, 2.0, 1.0); playNotes(flute, [24, 26, 24, 23], durs2, reps2, 2.0, 1.0); } fun void playSecondThemeRecap2(int transposition) { BandedWG violin => NRev r => dac; r.mix(0.2); HevyMetl bassTop => r; HevyMetl bassBot => r; 1.0 => bassTop.noteOff; 1.0 => bassBot.noteOff; 0.5 => bassTop.noteOff; 0.5 => bassBot.noteOff; 1.0 => violin.gain; 30 => int nQuarterNotes; int violinPitches[nQuarterNotes]; 0 => int index; for (0 => int i; i < 4; i++) { 5 => violinPitches[index++]; 7 => violinPitches[index++]; 8 => violinPitches[index++]; 7 => violinPitches[index++]; } for (0 => int i; i < 2; i++) { 6 => violinPitches[index++]; 7 => violinPitches[index++]; 9 => violinPitches[index++]; 7 => violinPitches[index++]; } for (0 => int i; i < 3; i++) { 6 => violinPitches[index++]; 7 => violinPitches[index++]; } changeOctave(violinPitches, transposition); getUniformDurArr(violinPitches.cap(), quarterNote) @=> dur durs[]; spork ~ playNotes(violin, violinPitches, durs, getUniformIntArr(violinPitches.cap(), 1), 2.0, 1.0); (3.0 - 2.0) / violinPitches.cap() => float delta; for (0 => int i; i < violinPitches.cap(); i++) { durs[i] => now; 1.0 + i * delta => violin.gain; } } fun void playSecondThemeRecap3() { BandedWG violin => NRev r => dac; BandedWG violin2 => r; 3.0 => violin.gain; 3.0 => violin2.gain; r.mix(0.2); [21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 18, 19, 18, 19, 18, 19, 18, 19, 21, 19, 17, 17, 16, 14, 12, 12, 11, 9, 11, 14, 12, 7, 4, 11, 9, 5, 2, 9, 7, 4, 0, -5, 7, 19, 19] @=> int violinPitches[]; dur violinDurs[violinPitches.cap()]; for (0 => int i; i < violinDurs.cap(); i++) { //if (i == 0) halfNote + eighthNote => violinDurs[i]; eighthNote => violinDurs[i]; } spork ~ playNotes(violin, [19], [(halfNote + eighthNote) / 10], [10], 1.5, 1.0); (halfNote + eighthNote) / 20 => now; playNotes(violin2, [19], [(halfNote + eighthNote) / 10], [10], 1.5, 1.0); playNotes(violin, violinPitches, violinDurs, getUniformIntArr(violinPitches.cap(), 1), 1.5, 1.0); } fun void playSecondThemeRecap4() { BandedWG melodicInst => NRev r => dac; r.mix(0.2); [-101, 16, 12, 7, 4, 0, -5, 16, 12, 7, 4, 0, -5] @=> int melodicInstPitches[]; changeOctave(melodicInstPitches, 1) @=> melodicInstPitches; dur melodicInstDurs[melodicInstPitches.cap()]; for (0 => int i; i < melodicInstDurs.cap(); i++) { if (i == 6) halfNote + eighthNote => melodicInstDurs[i]; else eighthNote => melodicInstDurs[i]; } int melodicInstIters[melodicInstPitches.cap()]; for (0 => int i; i < melodicInstIters.cap(); i++) { if (i % 2 == 1) 3 => melodicInstIters[i]; else 1 => melodicInstIters[i]; } BandedWG accInst1 => r; 3.0 => accInst1.gain; 3.0 => melodicInst.gain; [12, 14, 14, 14, 16, 19, 19, 19, 19, -100, 19, 19, 19, 19, -100, 23, 23, 23] @=> int accInst1Pitches[]; [3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, 3 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, eighthNote, eighthNote, quarterNote, quarterNote + halfNote + eighthNote, 4 * eighthNote, 4 * eighthNote, 4 * eighthNote] @=> dur accInst1Durs[]; spork ~ playNotes(melodicInst, melodicInstPitches, melodicInstDurs, melodicInstIters, 1.5, 0.95); playNotes(accInst1, accInst1Pitches, accInst1Durs, getUniformIntArr(accInst1Pitches.cap(), 1), 1.5, 0.95); } fun void playTransitionToCoda() { setTempo(0.9 * tempoOneEighthNote); HevyMetl violin1 => NRev r => dac; r.mix(0.02); HevyMetl violin2 => r; HevyMetl viola => r; HevyMetl bassTop => r; HevyMetl bassBot => r; 0.85 => float gain; gain => violin1.gain; gain => violin2.gain; gain => viola.gain; gain => bassTop.gain; gain => bassBot.gain; getUniformIntArr(8, 24) @=> int violin1Pitches1[]; [16, 16, 17, 17, 19, 19, 20, 20] @=> int violin2Pitches1[]; [7, 7, 5, 5, 0, 0, -4, -4] @=> int violaPitches1[]; [-12, -12, -16, -16, -8, -8, -7, -7] @=> int bassTopPitches1[]; changeOctave([-12, -12, -16, -16, -8, -8, -7, -7], -1) @=> int bassBotPitches1[]; dur trebleDurs[violin1Pitches1.cap()]; dur bassDurs[bassTopPitches1.cap()]; [1, 3, 1, 3, 1, 3, 1, 3] @=> int trebleReps[]; [4, 1, 3, 1, 3, 1, 3, 1] @=> int bassReps[]; for (0 => int i; i < violin1Pitches1.cap(); i++) { if (i % 2 == 0) { halfNote + eighthNote => trebleDurs[i]; eighthNote => bassDurs[i]; } else { eighthNote => trebleDurs[i]; if (i == bassDurs.cap() - 1) { halfNote => bassDurs[i]; } else { halfNote + eighthNote => bassDurs[i]; } } } 0.9 => float playRatio; 0.8 => float velocity; spork ~ playNotes(violin1, violin1Pitches1, trebleDurs, trebleReps, velocity, playRatio); spork ~ playNotes(violin2, violin2Pitches1, trebleDurs, trebleReps, velocity, playRatio); spork ~ playNotes(viola, violaPitches1, trebleDurs, trebleReps, velocity, playRatio); spork ~ playNotes(bassTop, bassTopPitches1, bassDurs, bassReps, velocity, playRatio); playNotes(bassBot, bassBotPitches1, bassDurs, bassReps, velocity, playRatio); 0.75 => velocity; 0.93 => playRatio; [16] @=> int strReps2[]; spork ~ playNotes(violin1, [25], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(violin2, [13], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(viola, [8], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(bassTop, [-7], [eighthNote], strReps2, velocity, playRatio); playNotes(bassBot, [-19], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(violin1, [25], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(violin2, [13], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(viola, [8], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(bassTop, [-7], [quarterNote], [1], velocity, playRatio); playNotes(bassBot, [-19], [quarterNote], [1], velocity, playRatio); quarterNote + eighthNote => now; BandedWG melodicInst => NRev r2 => dac; 2.0 => melodicInst.gain; r2.mix(0.2); playNotes(melodicInst, [17, 20], [eighthNote, quarterNote], [3, 1], 2.0, 1.0); quarterNote + halfNote + eighthNote => now; [19] @=> strReps2; spork ~ playNotes(violin1, [27], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(violin2, [15], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(viola, [9], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(bassTop, [-6], [eighthNote], strReps2, velocity, playRatio); playNotes(bassBot, [-18], [eighthNote], strReps2, velocity, playRatio); spork ~ playNotes(violin1, [27], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(violin2, [15], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(viola, [9], [quarterNote], [1], velocity, playRatio); spork ~ playNotes(bassTop, [-6], [quarterNote], [1], velocity, playRatio); playNotes(bassBot, [-18], [quarterNote], [1], velocity, playRatio); quarterNote + eighthNote => now; ModalBar melodicInst2 => r2; 2.0 => melodicInst2.gain; playNotes(melodicInst2, [24, 27], [eighthNote, quarterNote], [3, 1], 1.0, 1.0); quarterNote => now; } fun void playBuildupToCodaTheme() { BeeThree trebleInst => NRev r => dac; r.mix(0.02); [-101, 11, 12, 14, 15, 17, 19, 20, 19, 20, 19, 20, 19, -101, 11, 12, 14, 15, 17, 19, 20, 19, 20, 19, 20, 19, 20, 19, 22, 20, 19, 17, 20, 19, 17, 15, 19, 17, 15, 14, 17, 15, 14, 12, 15, 14, 12, 10, 14, 12, 10, 8, 12, 10, 8, 7, 10, 8, 5, 7, 3, 7, 2, 7, 3, 7, 5, 7, 3, 7, 5, 7, 7, 12, 8, 12, 7, 12, 8, 12, 11, 17, 12, 17, 11, 17, 12, 17, 14, 19 ] @=> int treblePitches[]; dur trebleDurs[treblePitches.cap()]; for (0 => int i; i < trebleDurs.cap(); i++) { if (i == 0) { 2 * halfNote => trebleDurs[i]; } else if (i == 13) halfNote => trebleDurs[i]; else if (i == trebleDurs.cap() - 1) 2 * halfNote + eighthNote => trebleDurs[i]; else eighthNote => trebleDurs[i]; } HevyMetl cello => r; [-101, 7, 3, 5, 2, 7, 3, 5, 2, 7, 3, 5, 2, 3, 0, 2, -2, 0, -4, -2, -5, -4, -7, -5, -9, -7, -10, -12, -13, -12, -10, -12, -10, -8, -7, -8, -7, -5, -4, -5, -3, -1] @=> int celloPitches[]; dur celloDurs[celloPitches.cap()]; int celloReps[celloPitches.cap()]; for (0 => int i; i < celloDurs.cap(); i++) { if (i == 0) { eighthNote => celloDurs[i]; 1 => celloReps[i]; } else if (i == 1 || i == 5 || i == 9) { eighthNote => celloDurs[i]; 3 => celloReps[i]; } else if (i >= 10) { quarterNote => celloDurs[i]; 1 => celloReps[i]; } else if (i == 4 || i == 8) { halfNote + eighthNote => celloDurs[i]; 1 => celloReps[i]; } else { halfNote => celloDurs[i]; 1 => celloReps[i]; } } HevyMetl bass => r; changeOctave([-101, -17, -101, -17, -101, -4, -2, -5, -4, -7, -5, -9, -7, -10, -12, -13, -12, -10, -12, -10, -8, -7, -8, -7, -5, -4, -5, -3, -1], -1) @=> int bassPitches[]; dur bassDurs[bassPitches.cap()]; for (0 => int i; i < bassDurs.cap(); i++) { if (i == 0) halfNote => bassDurs[i]; else if (i == 2) quarterNote + 3 * halfNote => bassDurs[i]; else if (i == 4) quarterNote + 7 * halfNote => bassDurs[i]; else quarterNote => bassDurs[i]; } spork ~ playNotes(trebleInst, treblePitches, trebleDurs, getUniformIntArr(trebleDurs.cap(), 1), 1.0, 0.98); spork ~ playNotes(cello, celloPitches, celloDurs, celloReps, 0.85, 0.93); playNotes(bass, bassPitches, bassDurs, getUniformIntArr(bassDurs.cap(), 1), 0.85, 0.95); for (0 => int i; i < 8; i++) { 0.2 + 0.2 * i => trebleInst.gain; eighthNote => now; } halfNote => now; } fun void playCodaTheme() { 3 => int tempoFactor; setTempo(tempoFactor * getTempo()); 0.85 => float strGain; HevyMetl violin => dac; HevyMetl violin2 => dac; strGain => violin.gain; strGain => violin2.gain; 1.0 => violin2.noteOff; BeeThree viola => dac; HevyMetl viola2 => dac; strGain => viola.gain; strGain => viola2.gain; 1.0 => viola2.noteOff; HevyMetl bassTop => dac; HevyMetl bassBot => dac; strGain => bassTop.gain; strGain => bassBot.gain; changeOctave([3, 0, 2, 3, 5, 2, 3, 5, 7, 3, 5, 7, 8, 5, 7, 9, 11, 7, 9, 11, 12, 7], 1) @=> int violinPitches1[]; [3, 0, 2, 3, 5, 2, 3, 5, 7, 3, 5, 7, 8, 5, 7, 9, 11, 7, 9, 11, 12, 7] @=> int violaPitches1[]; getUniformDurArr(violinPitches1.cap(), quarterNote) @=> dur trebleDurs1[]; getUniformIntArr(violinPitches1.cap(), 1) @=> int trebleReps1[]; [2 * halfNote, 2 * halfNote, 2 * halfNote, halfNote, halfNote, halfNote, halfNote, halfNote] @=> dur bassDurs1[]; changeOctave([0, -4, -9, -7, -9, -10, -7, -9], -1) @=> int bassTopPitches1[]; changeOctave([0, -4, -9, -7, -9, -10, -7, -9], -2) @=> int bassBotPitches1[]; getUniformIntArr(bassTopPitches1.cap(), 1) @=> int bassReps1[]; spork ~ playNotes(viola, violaPitches1, trebleDurs1, trebleReps1, 0.9, 0.98); spork ~ playNotes(bassTop, bassTopPitches1, bassDurs1, bassReps1, 0.8, 0.99); spork ~ playNotes(bassBot, bassBotPitches1, bassDurs1, bassReps1, 0.8, 0.99); playNotes(violin, violinPitches1, trebleDurs1, trebleReps1, 0.9, 0.98); changeOctave([8, 3, 5, 2, 3, 5, 7, 6, 7, -5, 0], 1) @=> int violinPitches2[]; [8, 3, 5, 2, 3, 5, 7, 6, 7, -5, 0] @=> int violaPitches2[]; [-12, -101, -7, -101, -10, -101, -5, -101, -17, -101, -12] @=> int bassTopPitches2[]; changeOctave([-12, -101, -7, -101, -10, -101, -5, -101, -17, -101, -12], -1) @=> int bassBotPitches2[]; getChangingDurArr(violinPitches2.cap(), getTempo() * 2, fastEighthNote * 2) @=> dur stringDurs2[]; getUniformIntArr(violinPitches2.cap(), 1) @=> int stringReps2[]; spork ~ playNotes(violin, violinPitches2, stringDurs2, stringReps2, 0.9, 0.9); spork ~ playNotes(viola, violaPitches2, stringDurs2, stringReps2, 0.9, 0.9); spork ~ playNotes(bassTop, bassTopPitches2, stringDurs2, stringReps2, 0.85, 0.9); spork ~ playNotes(bassBot, bassBotPitches2, stringDurs2, stringReps2, 0.85, 0.9); for (0 => int i; i < stringDurs2.cap() - 1; i++) { stringDurs2[i] => now; } setTempo(fastEighthNote); PercFlut windInstTop => NRev r => dac; PercFlut windInstBot => r; PercFlut windInstMid => r; 1.0 => windInstMid.noteOff; r.mix(0.05); 0.7 => float strVel; 0.9 => float windVel; 0.7 => float staccato; 1.0 => float slur; [quarterNote, quarterNote] @=> dur twoQuarters[]; [1, 1] @=> int twoSingleReps[]; spork ~ playPFNotes(windInstTop, [24], [halfNote], [1], windVel, slur); playPFNotes(windInstBot, [24], [halfNote], [1], windVel, slur); spork ~ playPFNotes(windInstTop, [26, 27], twoQuarters, twoSingleReps, windVel, staccato); playPFNotes(windInstBot, [24, 24], twoQuarters, twoSingleReps, windVel, staccato); spork ~ playPFNotes(windInstTop, [29, 26], twoQuarters, twoSingleReps, windVel, slur); playPFNotes(windInstBot, [24], [halfNote], [1], windVel, slur); spork ~ playNotes(violin, [3, 5], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(violin2, [3, 5], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(bassTop, [-9, -7], twoQuarters, twoSingleReps, strVel, staccato); playNotes(bassBot, [-21, -19], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(violin, [7, 3], twoQuarters, twoSingleReps, strVel, slur); spork ~ playNotes(violin2, [7, 3], twoQuarters, twoSingleReps, strVel, slur); spork ~ playNotes(bassTop, [-5, -9], twoQuarters, twoSingleReps, strVel, slur); playNotes(bassBot, [-17, -21], twoQuarters, twoSingleReps, strVel, slur); spork ~ playPFNotes(windInstTop, [29, 31], twoQuarters, twoSingleReps, windVel, staccato); playPFNotes(windInstBot, [24, 24], twoQuarters, twoSingleReps, windVel, staccato); spork ~ playPFNotes(windInstTop, [32, 29], twoQuarters, twoSingleReps, windVel, slur); playPFNotes(windInstBot, [24], [halfNote], [1], windVel, slur); for (0 => int i; i < 2; i++) { spork ~ playNotes(violin, [11, 12], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(violin2, [-1, 0], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(viola2, [-5, -3], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(bassTop, [-17, -15], twoQuarters, twoSingleReps, strVel, staccato); playNotes(bassBot, [-29, -17], twoQuarters, twoSingleReps, strVel, staccato); spork ~ playNotes(violin, [14, 11], twoQuarters, twoSingleReps, strVel, slur); spork ~ playNotes(violin2, [2, -1], twoQuarters, twoSingleReps, strVel, slur); spork ~ playNotes(viola2, [-1, -5], twoQuarters, twoSingleReps, strVel, slur); spork ~ playNotes(bassTop, [-13, -17], twoQuarters, twoSingleReps, strVel, slur); playNotes(bassBot, [-25, -29], twoQuarters, twoSingleReps, strVel, slur); if (i == 0) { spork ~ playPFNotes(windInstTop, [24, 26], twoQuarters, twoSingleReps, windVel, staccato); spork ~ playPFNotes(windInstMid, [21, 23], twoQuarters, twoSingleReps, windVel, staccato); playPFNotes(windInstBot, [19, 19], twoQuarters, twoSingleReps, windVel, staccato); spork ~ playPFNotes(windInstTop, [27, 24], twoQuarters, twoSingleReps, windVel, slur); spork ~ playPFNotes(windInstMid, [24, 19], twoQuarters, twoSingleReps, windVel, slur); playPFNotes(windInstBot, [19], [halfNote], [1], windVel, slur); } } spork ~ playPFNotes(windInstTop, [24, 26], twoQuarters, twoSingleReps, windVel, staccato); spork ~ playPFNotes(windInstMid, [21, 23], twoQuarters, twoSingleReps, windVel, staccato); playPFNotes(windInstBot, [19, 19], twoQuarters, twoSingleReps, windVel, staccato); getUniformDurArr(6, quarterNote) @=> dur sixQuarters[]; spork ~ playPFNotes(windInstTop, [27, 26, 24, 22, 20, 19], sixQuarters, [1, 1, 1, 1, 1, 1], windVel, slur); spork ~ playPFNotes(windInstMid, [24, 22, 20, 19, 17, 15], sixQuarters, [1, 1, 1, 1, 1, 1], windVel, slur); playPFNotes(windInstBot, [19, 20, 15, 12, 12], [halfNote, quarterNote, quarterNote, quarterNote, quarterNote], [1, 1, 1, 1, 1], windVel, slur); playPlagalCadence(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playWPlagalCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 0); playWPlagalCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 1); play164(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playW164(windInstTop, windInstMid, windInstBot, windVel, slur, 1); playHalfCadence(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playWHalfCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 1); getUniformIntArr(6, 1) @=> int sixSingleReps[]; spork ~ playNotes(violin, [15, 14, 12, 10, 8, 7], sixQuarters, sixSingleReps, strVel, slur); spork ~ playNotes(violin2, [3, 10, 0, 7, -4, 3], sixQuarters, sixSingleReps, strVel, slur); spork ~ playNotes(viola, [0, -2, -4, -5, -7, -9], sixQuarters, sixSingleReps, strVel, slur); spork ~ playNotes(bassTop, [0, -5, -4, -9, -7, -12], sixQuarters, sixSingleReps, strVel, slur); playNotes(bassBot, changeOctave([0, -5, -4, -9, -7, -12], -1), sixQuarters, sixSingleReps, strVel, slur); playWPlagalCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 0); playPlagalCadence(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playWPlagalCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 1); play164(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playW164(windInstTop, windInstMid, windInstBot, windVel, slur, 1); playHalfCadence(violin, violin2, viola2, bassTop, bassBot, strVel, slur, 0); playWHalfCadence(windInstTop, windInstMid, windInstBot, windVel, slur, 1); } fun void playWPlagalCadence(StkInstrument windInstTop, StkInstrument windInstMid, StkInstrument windInstBot, float velocity, float playRatio, int high) { [quarterNote, quarterNote] @=> dur twoQuarters[]; [1, 1] @=> int twoSingleReps[]; spork ~ playPFNotes(windInstTop, changeOctave([20, 19], high), twoQuarters, twoSingleReps, velocity, playRatio); spork ~ playPFNotes(windInstMid, changeOctave([17, 15], high), twoQuarters, twoSingleReps, velocity, playRatio); playPFNotes(windInstBot, changeOctave([12, 12], high), twoQuarters, twoSingleReps, velocity, playRatio); } fun void playPlagalCadence(HevyMetl violin, HevyMetl violin2, HevyMetl viola, HevyMetl bassTop, HevyMetl bassBot, float velocity, float playRatio, int high) { [quarterNote, quarterNote] @=> dur twoQuarters[]; [1, 1] @=> int twoSingleReps[]; spork ~ playNotes(violin, changeOctave([8, 7], high), twoQuarters, twoSingleReps, velocity, playRatio); spork ~ playNotes(violin2, [5, 3], twoQuarters, twoSingleReps, velocity, playRatio); spork ~ playNotes(viola, [-7, 0], twoQuarters, twoSingleReps, velocity, playRatio); spork ~ playNotes(bassTop, [-7, -12], twoQuarters, twoSingleReps, velocity, playRatio); playNotes(bassBot, [-19, -24], twoQuarters, twoSingleReps, velocity, playRatio); } fun void playW164(StkInstrument windInstTop, StkInstrument windInstMid, StkInstrument windInstBot, float velocity, float playRatio, int high) { [quarterNote] @=> dur oneQuarter[]; [1] @=> int oneSingleRep[]; spork ~ playPFNotes(windInstTop, changeOctave([19], high), oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playPFNotes(windInstMid, changeOctave([15], high), oneQuarter, oneSingleRep, velocity, playRatio); playPFNotes(windInstBot, changeOctave([12], high), oneQuarter, oneSingleRep, velocity, playRatio); } fun void play164(HevyMetl violin, HevyMetl violin2, HevyMetl viola, HevyMetl bassTop, HevyMetl bassBot, float velocity, float playRatio, int high) { [quarterNote] @=> dur oneQuarter[]; [1] @=> int oneSingleRep[]; spork ~ playNotes(violin, [7], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(violin2, [3], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(viola, [0], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(bassTop, [-17], oneQuarter, oneSingleRep, velocity, playRatio); playNotes(bassBot, [-29], oneQuarter, oneSingleRep, velocity, playRatio); } fun void playHalfCadence(HevyMetl violin, HevyMetl violin2, HevyMetl viola, HevyMetl bassTop, HevyMetl bassBot, float velocity, float playRatio, int high) { [quarterNote] @=> dur oneQuarter[]; [1] @=> int oneSingleRep[]; spork ~ playNotes(violin, [7], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(violin2, [2], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(viola, [-1], oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playNotes(bassTop, [-17], oneQuarter, oneSingleRep, velocity, playRatio); playNotes(bassBot, [-29], oneQuarter, oneSingleRep, velocity, playRatio); } fun void playWHalfCadence(StkInstrument windInstTop, StkInstrument windInstMid, StkInstrument windInstBot, float velocity, float playRatio, int high) { [quarterNote] @=> dur oneQuarter[]; [1] @=> int oneSingleRep[]; spork ~ playPFNotes(windInstTop, changeOctave([19], high), oneQuarter, oneSingleRep, velocity, playRatio); spork ~ playPFNotes(windInstMid, changeOctave([14], high), oneQuarter, oneSingleRep, velocity, playRatio); playPFNotes(windInstBot, changeOctave([11], high), oneQuarter, oneSingleRep, velocity, playRatio); } fun void playBuildupToLastFermata() { setTempo(fastEighthNote); NRev r => dac; HevyMetl violin1 => r; HevyMetl violin2 => r; HevyMetl bassTop => r; HevyMetl bassBot => r; PercFlut flute1 => r; PercFlut flute2 => r; r.mix(0.05); changeOctave([0, 7, 7, 7, 0, 7], 1) @=> int violin1Pitches[]; [3, 7, 7, 7, 0, 7] @=> int violin2Pitches[]; [eighthNote, eighthNote, 4 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote] @=> dur violinDurs[]; [1, 3, 1, 3, 1, 12] @=> int violinReps[]; [-12, -101, -17, -12, -17] @=> int bassTopPitches[]; changeOctave([-12, -101, -17, -12, -17], -1) @=> int bassBotPitches[]; [quarterNote, quarterNote + 4 * halfNote + eighthNote, eighthNote, eighthNote, eighthNote] @=> dur bassDurs[]; [1, 1, 3, 1, 12] @=> int bassReps[]; changeOctave([0, -200, 7, 7, 3, 5, 2, 3, 5, 7, -200, 7], 2) @=> int flute1Pitches[]; changeOctave([-5, -200, 2, 2, 0, 2, -1, 0, 2, 3, -200, -5], 2) @=> int flute2Pitches[]; [quarterNote, quarterNote + eighthNote, eighthNote, halfNote + quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote + eighthNote, eighthNote] @=> dur fluteDurs[]; [1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 8] @=> int fluteReps[]; spork ~ playPFNotes(flute1, flute1Pitches, fluteDurs, fluteReps, 0.7, 0.95); spork ~ playPFNotes(flute2, flute2Pitches, fluteDurs, fluteReps, 0.7, 0.95); spork ~ playNotes(violin1, violin1Pitches, violinDurs, violinReps, 0.7, 0.9); spork ~ playNotes(violin2, violin2Pitches, violinDurs, violinReps, 0.7, 0.9); spork ~ playNotes(bassTop, bassTopPitches, bassDurs, bassReps, 0.7, 0.9); playNotes(bassBot, bassBotPitches, bassDurs, bassReps, 0.7, 0.9); [3 * eighthNote, 10 * halfNote] @=> dur firstFermataDurs[]; [3, 1] @=> int firstFermataReps[]; 0.8 => float firstFermataPlayRatio; spork ~ playPFNotes(flute1, [31, 31], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); spork ~ playPFNotes(flute2, [19, 19], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); spork ~ playNotes(violin1, [19, 15], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); spork ~ playNotes(violin2, [7, 3], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); spork ~ playNotes(bassTop, [-17, -21], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); playNotes(bassBot, [-29, -33], firstFermataDurs, firstFermataReps, 0.7, firstFermataPlayRatio); 6 * eighthNote => now; [6 * eighthNote, 15 * halfNote] @=> dur secondFermataDurs[]; [3, 1] @=> int secondFermataReps[]; 0.8 => float secondFermataPlayRatio; spork ~ playPFNotes(flute1, [31, 31], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); spork ~ playPFNotes(flute2, [19, 19], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); spork ~ playNotes(violin1, [17, 14], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); spork ~ playNotes(violin2, [5, 2], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); spork ~ playNotes(bassTop, [-19, -22], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); playNotes(bassBot, [-31, -34], secondFermataDurs, secondFermataReps, 0.7, secondFermataPlayRatio); } fun void playEnding() { setTempo(tempoOneEighthNote); BandedWG trebleInst => NRev r => dac; ModalBar oboe => r; HevyMetl celloLow => NRev celloRev => dac; HevyMetl celloHigh => celloRev; r.mix(0.2); celloRev.mix(0.05); [-100, 7, 3, 8, 7, 15, 12, 7, 3, 8, 7, 15, 12] @=> int firstThemePitches[]; [eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, halfNote + eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, eighthNote, halfNote + eighthNote] @=> dur firstThemeDurs[]; [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1] @=> int firstThemeReps[]; [-101, 20, 19, -101, 20, 19] @=> int oboePitches[]; [3 * halfNote + quarterNote, quarterNote, halfNote, 2 * halfNote + quarterNote, quarterNote, eighthNote] @=> dur oboeDurs[]; getUniformIntArr(oboePitches.cap(), 1) @=> int oboeReps[]; spork ~ playNotes(oboe, oboePitches, oboeDurs, oboeReps, 0.4, 0.95); [halfNote, 7 * halfNote + eighthNote] @=> dur celloDurs[]; spork ~ playNotes(celloLow, [-101, -24], celloDurs, [1, 1], 0.15, 0.99); spork ~ playNotes(celloHigh, [-101, -17], celloDurs, [1, 1], 0.15, 0.99); playNotes(trebleInst, firstThemePitches, firstThemeDurs, firstThemeReps, 1.5, 0.95); 3 * halfNote => now; [-101, 11, 12, -101, 11, 12, -101, 11, 12, 11, 12, 11, 12, 23, 24, 23, 24, -101, 11, -101, 12] @=> int finalPitches[]; [eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, quarterNote, quarterNote + eighthNote, eighthNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote, quarterNote] @=> dur finalDurs[]; [1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] @=> int finalReps[]; spork ~ playNotes(oboe, finalPitches, finalDurs, finalReps, 0.8, 0.95); 5 * halfNote => now; for (0 => int i; i < 10; i++) { 0.5 + 0.4 * i => oboe.gain; quarterNote => now; } 2.0 => oboe.gain; 6 * halfNote => now; } fun void setInstGains(StkInstrument insts[], float gain) { for (0 => int i; i < insts.cap(); i++) { gain => insts[i].gain; } } fun int[] getUniformIntArr(int numElems, int elemValue) { int arr[numElems]; for (0 => int i; i < numElems; i++) { elemValue => arr[i]; } return arr; } fun dur[] getUniformDurArr(int numElems, dur elemValue) { dur arr[numElems]; for (0 => int i; i < numElems; i++) { elemValue => arr[i]; } return arr; } fun int[] changeOctave(int pitches[], int transposition) { for (0 => int i; i < pitches.cap(); i++) { pitches[i] + 12 * transposition => pitches[i]; } return pitches; } fun void setTempo(dur newEighthNote) { newEighthNote => eighthNote; 2 * eighthNote => quarterNote; 2 * quarterNote => halfNote; } fun dur getTempo() { return eighthNote; } fun dur[] getChangingDurArr(int nDurs, dur startDur, dur endDur) { dur durs[nDurs]; (endDur - startDur) / nDurs => dur delta; for (0 => int i; i < nDurs; i++) { startDur + i * delta => durs[i]; } endDur => durs[nDurs - 1]; return durs; }