// Reads in a mono .wav file and pans it from left to right // across the duration of the file. Outputs left and right // channels into separate .wav files string directoryPath; "/Users/ddolben/Documents/Stanford/Classes 12-13/music220a/hw2/" => directoryPath; SndBuf w0 => DelayL left => WvOut wo0 => blackhole; w0 => DelayL right => WvOut wo1 => blackhole; string filename0; "truck1" => filename0; (directoryPath + filename0 + "pan1.wav") => wo0.wavFilename; (directoryPath + filename0 + "pan2.wav") => wo1.wavFilename; (directoryPath + filename0 + ".wav") => w0.read; w0.length() => dur l; now + l => time then; 0::ms => left.delay; 0::ms => right.delay; while(now < then) { (pi/2.0) * (1.0-((then-now)/l)) => float pan; Math.cos( pan ) => left.gain; Math.sin( pan ) => right.gain; 1::samp => now; } wo0.closeFile(); wo1.closeFile();