//hw1.ck //"bike is short for bicycle" //by Michael Svolos dac => WvOut2 w => blackhole; w.fileGain(0.25); w.wavFilename(me.dir() + "hw1.wav"); 540::ms => dur BEAT; //540 second / samp => float SRATE; me.sourceDir() + "audio/" => string filePath; Bell bb; SndBuf unlock => dac; unlock.read(filePath + "unlocking.wav"); unlock.pos(0); unlock.length() + 60::ms => now; SndBuf startup => dac; startup.read(filePath + "startup.wav"); startup.pos(0); startup.length() + 20::ms => now; SndBuf pedal_long => dac; pedal_long.read(filePath + "pedaling_extended.wav"); pedal_long.pos(0); pedal_long.length() - BEAT*2 => now; //----------------------------------- spork ~bb.play(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~bass_break_1(); BEAT * 4 => now; spork ~guitar_1_4_measure(); spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~bass_break_2(); spork ~guitar_for_bass_break_2(); BEAT * 4 => now; BEAT * 4 => now; spork ~bass_4_measures_funkier(); spork ~guitar_1_4_measure(); spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(0); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; // BRIDGE spork ~bridge_melody(); spork ~bass_bridge_2_measure(); spork ~drums_bridge_2_measure(); spork ~sweep_bridge(3); BEAT * 4 => now; BEAT * 4 => now; spork ~bass_bridge_2_measure(); spork ~drums_bridge_2_measure(); BEAT * 4 => now; BEAT * 4 => now; spork ~bass_bridge_2_measure(); spork ~drums_bridge_2_measure(); BEAT * 4 => now; BEAT * 4 => now; spork ~measure_bass_tonic(); spork ~bb.play(); BEAT * 4 => now; spork ~measure_bass_tonic(); BEAT * 4 => now; spork ~drum_buildup_2_measure(); spork ~bass_for_drum_buildup(); BEAT * 4 => now; BEAT * 4 => now; // chorus spork ~chorus_melody(); spork ~bass_last_chorus(3); spork ~guitar_last_chorus(3); spork ~sweep_chorus(3); spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); spork ~measure_16ths(); BEAT * 4 => now; spork ~drum_guitar_mimic(); spork ~measure_kick(1); spork ~measure_snare(); BEAT * 4 => now; spork ~measure_kick(1); spork ~measure_snare(); BEAT * 4 => now; spork ~bass_break_1(); BEAT * 3 => now; BEAT * 2.5 / 4 => now; SndBuf b => dac; b.read (filePath + "slowdown.wav"); b.pos(0); b.gain(0.8); b.length() - 140::ms => now; spork ~bb.play(); 2::second => now; fun void chorus_melody() { Bass b, c, d, e; b.setGain(2.8); c.setGain(2.8); d.setGain(2.8); e.setGain(2.8); BEAT => now; spork ~b.play(66, BEAT - 15::ms); BEAT => now; spork ~c.play(69, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(71, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(69, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(71, BEAT / 8); BEAT / 8 => now; spork ~c.play(72, BEAT * 5 / 8); BEAT * 3 / 8 => now; BEAT / 2 => now; spork ~b.play(71, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 2 => now; spork ~b.play(69, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 4 => now; BEAT / 8 => now; spork ~c.play(69, BEAT/8); BEAT / 8 => now; spork ~b.play(71, BEAT * 3 / 4 - 10::ms); BEAT / 2 => now; BEAT / 4 => now; spork ~c.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(66, BEAT * 3 / 4); BEAT / 2 => now; // ~~~~~~~~~~~~~~ 2 measures in now ~~~~ BEAT / 2 => now; spork ~c.play(66, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(64, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(66, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(66, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(71, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(71, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(73, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(71, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(73, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(80, BEAT - 10::ms); BEAT / 4 => now; BEAT / 4 => now; BEAT / 2 => now; spork ~c.play(72, BEAT / 2 - 10::ms); BEAT / 2 => now; BEAT / 4 => now; spork ~b.play(72, BEAT * 3 / 8 - 22::ms); BEAT * 3 / 8 => now; spork ~c.play(72, BEAT * 3 / 8 - 22::ms); BEAT * 3 / 8 => now; spork ~b.play(72, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(71, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(66, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(71, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(69, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(66, BEAT / 2 - 10::ms); BEAT / 2 => now; //////// 4 measures ???????? BEAT => now; spork ~c.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 8); BEAT / 8 => now; spork ~c.play(65, BEAT * 5 / 8); BEAT * 3 / 8 => now; BEAT / 2 => now; spork ~b.play(64, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 2 => now; spork ~b.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(65, BEAT / 8); BEAT / 8 => now; spork ~c.play(66, BEAT * 3 / 8 - 10::ms); BEAT * 3 / 8 => now; spork ~b.play(65, BEAT / 8); BEAT / 8 => now; spork ~c.play(66, BEAT * 2 + BEAT * 7 / 8 - 10::ms); BEAT * 7 / 8 => now; BEAT * 4 => now; } fun void drum_guitar_mimic() { Click q; Strum s; s.tune(54, 61, 64, 69); s.setAtten(0.5); s.setHPF(3000); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; } fun void guitar_last_chorus(int numRepeats) { Strum s, q; s.tune(54, 61, 64, 69); q.tune(54, 61, 64, 69); s.setAtten(0.95); s.setHPF(20); q.setAtten(0.5); q.setHPF(3000); for (0 => int i; i < numRepeats; i + 1 => i) { spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~q.play(); BEAT / 4 => now; } } fun void bass_last_chorus(int numRepeats) { Bass b, c; for (0 => int i; i < numRepeats; i + 1 => i) { spork ~b.play(42, BEAT / 2); BEAT / 2 => now; BEAT / 4 => now; spork ~b.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(37, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(40, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(42, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~c.play(42, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~b.play(40, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~c.play(38, BEAT - 15::ms); BEAT / 2 => now; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ BEAT / 2 => now; spork ~b.play(38, BEAT/2 - 5::ms); BEAT / 2 => now; spork ~c.play(42, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(45, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(48, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(50, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(48, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(38, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(40, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(41, BEAT / 4 - 10::ms); BEAT / 4 => now; } } fun void bass_for_drum_buildup() { Bass b1; Bass b2; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; spork ~b1.play(42, BEAT / 4); BEAT/4 => now; spork ~b2.play(42, BEAT / 4); BEAT/4 => now; } fun void drum_buildup_2_measure() { Click c; Lock l; Schink s; c.setGain(1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 1 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 2 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 3 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 4 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 5 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 6 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 7 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 8 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 9 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 10 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 11 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 12 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 13 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 14 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 15 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 16 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 17 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 18 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 19 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 20 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 21 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 22 * 0.1); spork ~c.play(); BEAT / 4 => now; c.setGain(1 + 23 * 0.1); spork ~c.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~l.play(); BEAT * 3 / 4 => now; } fun void bridge_melody() { Bass b, c, d, e; b.setGain(1.8); c.setGain(1.8); d.setGain(1.8); e.setGain(1.8); BEAT => now; spork ~b.play(59, BEAT - 15::ms); BEAT => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 8); BEAT / 8 => now; spork ~c.play(65, BEAT * 5 / 8); BEAT * 3 / 8 => now; BEAT / 2 => now; spork ~b.play(64, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 2 => now; spork ~b.play(62, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 4 => now; BEAT / 8 => now; spork ~c.play(62, BEAT/8); BEAT / 8 => now; spork ~b.play(64, BEAT * 3 / 4 - 10::ms); BEAT / 2 => now; BEAT / 4 => now; spork ~c.play(62, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(59, BEAT * 3 / 4); BEAT / 2 => now; // ~~~~~~~~~~~~~~ 2 measures in now ~~~~ BEAT => now; spork ~c.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(65, BEAT / 2 - 10::ms); BEAT / 2 => now; BEAT / 2 => now; spork ~c.play(65, BEAT / 2 - 10::ms); BEAT / 2 => now; BEAT / 4 => now; spork ~b.play(65, BEAT * 3 / 8 - 22::ms); BEAT * 3 / 8 => now; spork ~c.play(65, BEAT * 3 / 8 - 22::ms); BEAT * 3 / 8 => now; spork ~b.play(65, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(64, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(62, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(59, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(64, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(62, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; //////// 4 measures ???????? BEAT => now; spork ~c.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 8); BEAT / 8 => now; spork ~c.play(65, BEAT * 5 / 8); BEAT * 3 / 8 => now; BEAT / 2 => now; spork ~b.play(64, BEAT * 3 / 4); BEAT / 2 => now; BEAT / 2 => now; spork ~b.play(59, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(64, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~c.play(62, BEAT / 2 - 10::ms); BEAT / 2 => now; spork ~b.play(65, BEAT / 8); BEAT / 8 => now; spork ~c.play(66, BEAT * 3 / 8 - 10::ms); BEAT * 3 / 8 => now; spork ~b.play(65, BEAT / 8); BEAT / 8 => now; spork ~c.play(66, BEAT * 13 + BEAT * 7 / 8 - 10::ms); BEAT * 7 / 8 => now; BEAT * 3 => now; spork ~b.play(70, BEAT / 8); BEAT / 8 => now; spork ~d.play(71, BEAT / 8); BEAT / 8 => now; spork ~b.play(70, BEAT / 8); BEAT / 8 => now; spork ~d.play(68, BEAT / 8); BEAT / 8 => now; spork ~b.play(70, BEAT * 9 + BEAT / 2 - 10::ms); BEAT / 2 => now; BEAT * 3 => now; spork ~d.play(73, BEAT / 8); BEAT / 8 => now; spork ~e.play(75, BEAT / 8); BEAT / 8 => now; spork ~d.play(73, BEAT / 8); BEAT / 8 => now; spork ~e.play(71, BEAT / 8); BEAT / 8 => now; spork ~d.play(73, BEAT * 5 + BEAT / 2 - 10::ms); BEAT / 2 => now; BEAT * 3 => now; BEAT * 2 => now; BEAT => now; } fun void sweep_bridge(int numRepeats) { Sweep s; for (0 => int i; i < numRepeats; i + 1 => i) { s.tune(71, 74, 78, 83); s.setPan(-0.3); spork ~s.play(); BEAT * 4 => now; s.setPan(0.3); s.tune(67, 83, 74, 77); spork ~s.play(); BEAT * 4 => now; } } fun void sweep_chorus(int numRepeats) { Sweep s; for (0 => int i; i < numRepeats; i + 1 => i) { s.tune(66, 69, 73, 78); s.setPan(-0.3); spork ~s.play(); BEAT * 4 => now; s.setPan(0.3); s.tune(63, 78, 69, 72); spork ~s.play(); BEAT * 4 => now; } } fun void bass_bridge_2_measure() { Bass b, c; spork ~b.play(35, BEAT / 2); BEAT / 2 => now; BEAT / 4 => now; spork ~b.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(35, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~c.play(35, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~b.play(33, BEAT / 2 - 5::ms); BEAT / 2 => now; spork ~c.play(31, BEAT - 15::ms); BEAT / 2 => now; //~~~~~~~~~~~~~~~~~~~~~~~~~~~ BEAT / 2 => now; spork ~b.play(31, BEAT/2 - 5::ms); BEAT / 2 => now; spork ~c.play(35, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(38, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(41, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(43, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~c.play(41, BEAT / 4 - 10::ms); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(31, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 10::ms); BEAT / 4 => now; spork ~b.play(34, BEAT / 4 - 10::ms); BEAT * 4 => now; } fun void drums_bridge_2_measure() { Lock l; Schink s; Ride r; spork ~l.play(); BEAT / 2 => now; spork ~r.play(); BEAT / 2 => now; spork ~s.play(); BEAT / 2 => now; spork ~r.play(); BEAT / 2 => now; spork ~l.play(); BEAT / 2 => now; spork ~l.play(); spork ~r.play(); BEAT / 2 => now; spork ~l.play(); spork ~s.play(); BEAT / 2 => now; spork ~l.play(); spork ~r.play(); BEAT / 2 => now; BEAT / 2 => now; spork ~l.play(); spork ~r.play(); BEAT / 2 => now; spork ~s.play(); BEAT / 2 => now; spork ~r.play(); BEAT / 2 => now; spork ~l.play(); BEAT / 2 => now; spork ~r.play(); BEAT / 2 => now; spork ~s.play(); BEAT / 2 => now; spork ~r.play(); BEAT * 4 => now; } fun void bass_4_measures_funkier() { Bass b, c; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(36, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(27, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(27, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(27, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(32, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(32, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(35, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(32, BEAT / 4 - 5::ms); BEAT / 4 => now; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(34, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(37, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(44, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(30, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(34, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(37, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(39, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ spork ~b.play(44, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(44, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(45, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(46, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(49, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(51, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(49, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(46, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(39, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(40, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(41, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(32, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(33, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~c.play(34, BEAT / 4 - 5::ms); BEAT / 4 => now; BEAT / 4 => now; } fun void guitar_1_4_measure() { Strum s; s.tune(54, 61, 64, 69); BEAT / 2 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 2 => now; spork ~s.play(); BEAT / 2 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(53, 60, 63, 68); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.tune(54, 61, 64, 69); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; BEAT / 2 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(57, 62, 65, 72); spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(55, 62, 65, 70); spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(54, 61, 64, 69); spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(53, 60, 63, 68); spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; s.tune(54, 61, 64, 69); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; BEAT / 4 => now; BEAT / 4 => now; } fun void guitar_for_bass_break_2() { Strum s; s.setAtten(0.5); s.setHPF(3000); s.tune(52, 59, 64, 71); s.setPan(0.3); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.setHPF(1000); s.setAtten(0.7); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.setAtten(0.5); s.setHPF(3000); s.setPan(0.3); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.setHPF(1000); s.setAtten(0.7); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.setAtten(0.5); s.setHPF(3000); s.setPan(0.3); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; s.setAtten(0.54); s.setHPF(2800); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.58); s.setHPF(2500); s.setPan(0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.62); s.setHPF(2200); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.69); s.setHPF(1500); s.setPan(0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.75); s.setHPF(1000); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.83); s.setHPF(500); s.setPan(0.3); spork ~s.play(); BEAT / 4 => now; s.setAtten(0.89); s.setHPF(250); s.setPan(-0.3); spork ~s.play(); BEAT / 4 => now; s.setPan(0); s.setAtten(0.95); s.setHPF(20); spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; spork ~s.play(); BEAT / 4 => now; Strum s2; s2.tune(52, 57, 60, 68); spork ~s2.play(); BEAT / 4 => now; spork ~s2.play(); BEAT / 4 => now; spork ~s2.play(); BEAT / 4 => now; spork ~s2.play(); BEAT / 4 => now; } fun void measure_kick(int lastTwo) { Lock l; spork ~l.play(); BEAT / 2 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; BEAT / 2 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT / 4 => now; BEAT / 4 => now; if (lastTwo == 1) { BEAT / 2 => now; spork ~l.play(); BEAT / 4 => now; spork ~l.play(); BEAT => now; } else BEAT => now; } fun void measure_snare() { Schink s; BEAT => now; spork ~s.play(); BEAT * 2 => now; spork ~s.play(); BEAT => now; } fun void measure_bass_tonic() { Bass b1; Bass b2; spork ~b1.play(30, BEAT*2/4); BEAT/4 => now; spork ~b2.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b1.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b2.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b1.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b2.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b1.play(30, BEAT*3/4); BEAT/4 => now; BEAT/4 => now; spork ~b2.play(30, BEAT*3/4 - 20::ms); BEAT/4 => now; BEAT/4 => now; spork ~b1.play(30, BEAT*1/4 - 18::ms); BEAT/4 => now; } fun void bass_break_1() { Bass b; //spork ~b.play(30, BEAT/4 - 20::ms); //cut out beat 1 BEAT/4 => now; spork ~b.play(35, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(40, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(33, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(38, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(43, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(42, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(47, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(52, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(49, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(45, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(46, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(44, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(40, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(37, BEAT/4 - 20::ms); BEAT/4 => now; spork ~b.play(35, BEAT/4 - 20::ms); BEAT/4 => now; } fun void bass_break_2() { Bass b; Bass b2; BEAT / 4 => now; spork ~b.play(33, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(36, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(37, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(42, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(40, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(43, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(44, BEAT / 5); BEAT / 4 => now; BEAT / 4 => now; spork ~b.play(47, BEAT / 4); BEAT / 4 => now; BEAT / 4 => now; spork ~b2.play(45, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(44, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(47, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(45, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(40, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(37, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(42, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(40, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; spork ~b2.play(28, BEAT / 4 - 5::ms); BEAT / 4 => now; } fun void measure_16ths() { spork ~click16ths(); BEAT => now; spork ~click16ths(); BEAT => now; spork ~click16ths(); BEAT => now; spork ~click16ths(); BEAT => now; } fun void click16ths() { Click c; spork ~c.play(); BEAT/4 => now; spork ~c.play(); BEAT/4 => now; spork ~c.play(); BEAT/4 => now; spork ~c.play(); BEAT/4 => now; } fun void two_measure () { Bass b; spork ~b.play(42, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(30, BEAT*3/4 - 16::ms); BEAT*3/4 => now; spork ~b.play(40, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(39, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(40, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(41, BEAT/4 - 16::ms); BEAT/4 => now; } fun void pickup() { Bass b; spork ~b.play(40, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(39, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(40, BEAT/4 - 16::ms); BEAT/4 => now; spork ~b.play(41, BEAT/4 - 16::ms); BEAT/4 => now; } class Schink { //snare SndBuf s; s.read(filePath + "schink.wav"); s => dac; 2.5 => float gain; s.rate(1); s.gain(0); fun void setGain(float g) { g => gain; } fun void play() { s.gain(gain); s.pos(0); s.length() => now; } } class Lock { //bass drum SndBuf lock; lock.read(filePath + "lock.wav"); lock => PitShift p => LPF l => NRev n => dac; l.freq(1200); n.mix(0.01); p.shift(0.3); p.mix(1); lock.rate(0.7); lock.gain(0); fun void play ( ) { lock.gain(2.9); //1.5 lock.pos(0); lock.length()/lock.rate() => now; } } class Bell { //bell SndBuf bell => PitShift q => dac; q.mix(1); q.shift(1); bell.read(filePath + "bell.wav"); bell.rate(1); bell.gain(0); fun void play( ) { bell.gain(0.1); bell.pos(0); bell.length() => now; } } class Ride { //ride cymbal SndBuf bell => PitShift q => HPF h => dac; h.freq(3000); q.mix(1); q.shift(1.2); bell.read(filePath + "bell.wav"); bell.rate(1.2); bell.gain(0); fun void play( ) { bell.gain(0.06); bell.pos(0); bell.length() => now; } } class Click { //hi-hat SndBuf click => NRev n => Pan2 pan => dac; 2 => float gain; pan.pan(-0.1); n.mix(0.015); click.read(filePath + "one_click.wav"); click.rate(1); //0.8 click.gain(0); fun void setGain(float g) { g => gain; } fun void play() { click.gain(gain); click.pos(0); click.length() => now; } } class Bass { SndBuf click => LPF l => NRev n => ADSR adsr => Gain g => dac; 0.9 => float gain; l.freq(1000); n.mix(0.04); click.gain(14); click.read(filePath + "one_click.wav"); adsr.set(10::ms, 10::ms, 0.8, 4::ms); fun void setGain(float ga) { g.gain(ga); ga => gain; } fun void play(int pitch, dur duration) { Std.mtof(pitch) => float freq; adsr.keyOn(1); now + duration => time stop; while(now < stop) { 0 => click.pos; (SRATE / freq)::samp => now; } adsr.keyOff(1); } } //the following functions are from starter code by Madeline Huberth //and Ge Wang class KS extends Chubgraph { // sample rate second / samp => float SRATE; // ugens! DelayA delay; OneZero lowpass; // noise, only for internal use Noise n => delay; // silence so it doesn't play 0 => n.gain; // the feedback inlet => delay => lowpass => delay => outlet; // max delay 1::second => delay.max; // set lowpass -1 => lowpass.zero; // set feedback attenuation .9 => lowpass.gain; // mostly for testing fun void play( float pitch, dur T ) { tune( pitch ) => float length; // turn on noise 1 => n.gain; // fill delay with length samples length::samp => now; // silence 0 => n.gain; // let it play T-length::samp => now; } // tune the fundamental resonance fun float tune( float pitch ) { // computes further pitch tuning for higher pitches pitch - 43 => float diff; 0 => float adjust; if( diff > 0 ) diff * .0125 => adjust; // compute length computeDelay( Std.mtof(pitch+adjust) ) => float length; // set the delay length::samp => delay.delay; //return return length; } // set feedback attenuation fun float feedback( float att ) { // sanity check if( att >= 1 || att < 0 ) { <<< "set feedback value between 0 and 1 (non-inclusive)" >>>; return lowpass.gain(); } // set it att => lowpass.gain; // return return att; } // compute delay from frequency fun float computeDelay( float freq ) { // compute delay length from srate and desired freq return SRATE / freq; } } class KSChord extends Chubgraph { // array of KS objects KS chordArray[4]; // connect to inlet and outlet of chubgraph for( int i; i < chordArray.size(); i++ ) { inlet => chordArray[i] => outlet; } // set feedback fun float feedback( float att ) { // sanith check if( att >= 1 || att < 0 ) { <<< "set feedback value between 0 and 1 (non-inclusive)" >>>; return att; } // set feedback on each element for( int i; i < chordArray.size(); i++ ) { att => chordArray[i].feedback; } return att; } // tune 4 objects fun float tune(float pitch1, float pitch2, float pitch3, float pitch4) { pitch1 => chordArray[0].tune; pitch2 => chordArray[1].tune; pitch3 => chordArray[2].tune; pitch4 => chordArray[3].tune; } } //the rest were made by me though :-) class Strum { SndBuf strum => PitShift p => KSChord object => HPF h => Pan2 pan => dac; h.freq(20); pan.pan(0.1); p.shift(0.5); p.mix(1.0); strum.read(filePath + "schink.wav"); strum.gain(0); strum.rate(4); object.feedback(.95); fun void setHPF(float freq) { h.freq(freq); } fun void setAtten(float att) { object.feedback(att); } fun void setPan(float p) { pan.pan(p); } fun void tune(float pitch1, float pitch2, float pitch3, float pitch4) { object.tune(pitch1, pitch2, pitch3, pitch4); } fun void play() { strum.gain(0.8); strum.pos(0); strum.length() / strum.rate() => now; } } class Sweep { SndBuf sweep => KSChord ks => LPF l => HPF h => Pan2 pan => dac; pan.pan(0); h.freq(280); l.freq(8000); sweep.read(filePath + "clicking.wav"); ks.feedback(.95); ks.tune(69, 72, 76, 81); sweep.gain(0); fun void tune(float p1, float p2, float p3, float p4) { ks.tune(p1, p2, p3, p4); } fun void setPan(float p) { pan.pan(p); } fun void play() { now => time start; sweep.gain(1.4); sweep.pos(0); while (now < start + sweep.length()) { l.freq(Math.sin((now - start)/sweep.length()*Math.PI) * 6000 + 200); 10::ms => now; } } } w.closeFile();