// @title spatialization.ck for Music220a-homework5 // @author Reza Payami (rpayami@ccrma) // @version chuck-1.3.1.3 / ma-0.2.2c // @revision 1 //Please change this to point to a proper path me.sourceDir() => string path; SndBuf sampleFree; SndBuf fmFree; SndBuf fmRythm; SndBuf noiseRythm; SndBuf sampleScore; SndBuf noiseScore; sampleFree => DBAP4e sampleFreeDBAP4; fmFree => DBAP4e fmFreeDBAP4; fmRythm => DBAP4e fmRythmDBAP4; noiseRythm => DBAP4e noiseRythmDBAP4; sampleScore => DBAP4e sampleScoreDBAP4; noiseScore => DBAP4e noiseScoreDBAP4; fmRythmDBAP4.setPosition(0, 0); path + "FM_Rythm.wav" => fmRythm.read; moveDBAPs(0.15, 0.15, 0, 0, 13::second + 500::ms); fmFreeDBAP4.setPosition(0.5, -0.5); path + "FM_Free.wav" => fmFree.read; moveDBAPs(0.15, 0.15, -0.15, 0.15, 6::second + 500::ms); sampleFreeDBAP4.setPosition(1, 1); path + "Sample_Free.wav" => sampleFree.read; moveDBAPs(0.3, 0.3, -0.3, 0.3, 35::second); noiseScoreDBAP4.setPosition(-0.5, -0.5); path + "Noise_Score.wav" => noiseScore.read; moveDBAPs(0, 0.2, 0, -0.2, 4::second + 500::ms); sampleScoreDBAP4.setPosition(-1, 1); path + "Sample_Score.wav" => sampleScore.read; moveDBAPs(0.15, 0.15, -0.15, 0.15, 10::second + 500::ms); noiseRythmDBAP4.setPosition(1, -1); path + "Noise_Rythm.wav" => noiseRythm.read; 40::second +=> now; ///////////////////////////////// fun void moveDBAPs(float fxSamp, float fySamp, float fxPhys, float fyPhys, dur duration) { 0.0 => float t; now => time t1; while(now - t1 < duration) { 0.15 +=> t; fmRythmDBAP4.setPosition(Math.cos(2 * Math.PI * fxSamp * t), Math.sin(2 * Math.PI * fySamp * t)); fmFreeDBAP4.setPosition(Math.cos(2 * Math.PI * fxPhys * t), Math.sin(2 * Math.PI * fyPhys * t)); 100::ms => now; } }