1 => dac.gain; // loading soundfiles SndBuf pat; me.dir()+"soundfiles/pats.wav" => pat.read; SndBuf ding => Pan2 dingpan => dac; me.dir()+"soundfiles/alarm clock ring.wav" => ding.read; SndBuf pencil => Pan2 pencilpan => dac; me.dir()+"soundfiles/pencil click.wav" => pencil.read; 0 => pencilpan.gain; 1 => pencilpan.pan; // i'm right handed, after all SndBuf pat1 => Pan2 pat1pan => dac; me.dir()+"soundfiles/pats.wav" => pat1.read; 0 => pat1.gain; -0.4 => pat1pan.pan; SndBuf pat2 => Pan2 pat2pan => dac; me.dir()+"soundfiles/pats.wav" => pat2.read; 0 => pat2.gain; 0.4 => pat2pan.pan; SndBuf bottle => Pan2 bottlepan => dac; me.dir()+"soundfiles/water bottle slower wave.wav" => bottle.read; SndBuf thock => Pan2 thockpan => dac; me.dir()+"soundfiles/[!].wav" => thock.read; 0.8 => thockpan.gain; SndBuf upperGong => Pan2 upperGongpan => dac; me.dir()+"soundfiles/salad bowl - high spray.wav" => upperGong.read; 0 => upperGong.gain; -0.6 => upperGongpan.pan; SndBuf lowerGong => Pan2 lowerGongpan => dac; me.dir()+"soundfiles/salad bowl - jong gibi.wav" => lowerGong.read; 0 => lowerGong.gain; 0.6 => lowerGongpan.pan; SndBuf window => dac; me.dir()+"soundfiles/opening window.wav" => window.read; 0 => window.gain; SndBuf mat => dac; me.dir()+"soundfiles/foot on yoga mat.wav" => mat.read; 0 => mat.gain; SndBuf fridge => dac; me.dir()+"soundfiles/fridge.wav" => fridge.read; 0 => fridge.gain; 1 => fridge.loop; // loop file 27000::samp => dur T; // ~ 80 bpm 0 => int counter; while (counter < 51) { // if the number of cycles is done, if (counter >= 50) { for (0 => int i; i < 5; i++) { 0 => thock.pos; 1::T => now; } spork ~ endingChime(); break; } // introducing the functions if (counter == 1) { spork ~ matSlides(); } if (counter == 2) { spork ~ pencilClicks(); } if (counter == 3) { spork ~ gongHemiola(); } if (counter == 4) { spork ~ matSlides(); } // random selection if (counter >= 5) { Math.random2(0,2) => int r; if (r == 1) { spork ~ gongHemiola(); } else if (r == 2) { spork ~ pencilClicks(); } else if (r == 0) { spork ~ matSlides(); } } if (counter >= 7 && counter < 10) { for (0 => int i; i < 3; i++) { 0 => thock.pos; 1::T => now; } } else if (counter >= 10) { for (0 => int i; i < 1; i++) { 0 => thock.pos; 27000 - (counter - 10) * 200 => int newSamps; newSamps::samp => T; 1::T => now; } } else { for (0 => int i; i < 6; i++) { 0 => thock.pos; 1::T => now; } } counter++; } 2::second => now; spork ~ fridgeHum(); 6::second => now; // start of gregorian fridge portion 16 => int NUM_FRIDGES; 0.75::second => T; 50 => float qval; // chant pitches [0, 7, 7, 7, 9, 7, 5, 5, 5, 7, 5, 9, 7, 7, 0, 7, 7, 9, 7, 5, 4, 2, 5, 5, 7, 5, 5, 5, 7, 5, 5, 0, 2, 0] @=> int pitches[]; // chant rhythm [1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3] @=> int durations[]; // initialize arrays SndBuf fridges[NUM_FRIDGES]; LPF lpfs[NUM_FRIDGES]; Pan2 pans[NUM_FRIDGES]; // wire all the objects for(0 => int i; i < NUM_FRIDGES; i++) { fridges[i] => lpfs[i] => pans[i] => dac; me.dir()+"soundfiles/fridge.wav" => fridges[i].read; 1 => fridges[i].loop; // loop file 0.5 => lpfs[i].gain; qval => lpfs[i].Q; 30000 => fridges[i].pos; // pan to 2 choirs if (i < NUM_FRIDGES / 2) { -0.8 => pans[i].pan; } else { 0.8 => pans[i].pan; } } // avoid clipping at the beginning 1::T => now; // play the gregorian chant fun void playChant(LPF lpf, float delay) { 0 => int counter; delay::second => now; // getting the "choir"-effect while(counter < pitches.cap()) { Std.mtof(52 + pitches[counter]) => lpf.freq; durations[counter] => float duration; //durations[counter] + Math.random2f(-0.05,0.05)=> float duration; // causes the two fridges to get out of sync.. // how to remedy? (besides storing the offset in a variable and subtracting from the next duration to compensate) duration::T => now; qval => lpf.Q; counter++; } } for (0 => int i; i < NUM_FRIDGES; i++) { spork ~ playChant(lpfs[i], Math.random2f(0,0.2)); } 0 => int seconds; while (seconds < 11) { 1::second => now; for (0 => int i; i < NUM_FRIDGES; i++) { 10 +=> qval; qval => lpfs[i].Q; } seconds++; } while (seconds >= 11) { .15::second => now; for (0 => int i; i < NUM_FRIDGES; i++) { 0.5 -=> qval; qval => lpfs[i].Q; } 1 - ((seconds - 11) * 0.01) => float newVol; <<< newVol >>>; if (newVol > 0) { newVol => dac.gain; } else { 0 => dac.gain; } seconds++; } // loop helper functions fun void matSlides() { 2 => mat.rate; 2 => mat.gain; 0 => mat.pos; 1::T => now; 0 => mat.pos; 0.5::T => now; 0 => mat.pos; 0.5::T => now; 0 => mat.pos; 1::T => now; } fun void pencilClicks() { 1.25 => pencil.rate; 4 => pencilpan.gain; 0 => pencil.pos; 0.5::T => now; 2 => pencilpan.gain; 0 => pencil.pos; 0.5::T => now; 0 => pencil.pos; 0.5::T => now; 5 => pencilpan.gain; 0 => pencil.pos; 0.5::T => now; 2 => pencilpan.gain; 0 => pencil.pos; 0.5::T => now; 0 => pencil.pos; 0.5::T => now; 1 => pat1.gain; 1 => pat2.gain; 0 => pat1.pos; 0.25::T => now; 0 => pat2.pos; 0.25::T => now; 0 => pat1.pos; 0.25::T => now; 0 => pat2.pos; 0.25::T => now; 0 => pat1.pos; 0.5::T => now; 0 => pat1.pos; 0.25::T => now; 0 => pat2.pos; 0.25::T => now; 0 => pat1.pos; 0.25::T => now; 0 => pat2.pos; 0.25::T => now; 0 => pat1.pos; 0.5::T => now; } fun void endingChime() { -0.5 => bottlepan.pan; 0 => bottle.pos; 0.5 => dingpan.pan; 0 => ding.pos; 2::second => now; 0.9 => window.gain; 0 => window.pos; 2::second => now; } fun void fridgeHum() { 4 => fridge.gain; 0 => fridge.pos; } fun void gongHemiola() { 0.01::second => now; 0.3 => upperGong.gain; 0.3 => lowerGong.gain; 0 => upperGong.pos; 0 => lowerGong.pos; 1::T => now; 0 => lowerGong.pos; 0.5::T => now; 0 => upperGong.pos; 0.5::T => now; 0 => lowerGong.pos; 1::T => now; 0 => upperGong.pos; 0 => lowerGong.pos; 1::T => now; 0 => lowerGong.pos; 0.5::T => now; 0 => upperGong.pos; 0.5::T => now; 0 => lowerGong.pos; 1::T => now; } while (true) 1::day => now;