// Michael J. Wilson // Music 220a Fall 2010 // Homework 3 // This piece is entitled "Stop following me!" // One instrument per channel 4 => int nInsts; ModalBar inst[nInsts]; //ModalBar w @=> inst[0] => dac.chan(0); //ModalBar x @=> inst[1] => dac.chan(1); //ModalBar y @=> inst[2] => dac.chan(2); //ModalBar z @=> inst[3] => dac.chan(3); ModalBar w @=> inst[0] => Binaural.pssp[0]; ModalBar x @=> inst[1] => Binaural.pssp[1]; ModalBar y @=> inst[2] => Binaural.pssp[2]; ModalBar z @=> inst[3] => Binaural.pssp[3]; // Set up the dac 10.0 => dac.gain; // Note duration 100::ms => dur duration; // Minimum time between notes 10::ms => dur minIoi; // Maximum time between notes 1000::ms => dur maxIoi; // Time between notes 1000::ms => dur ioi; // Loop counter int i; // For section transitions time sectionLength; //////////////////////////////////////////////////////////////// // Section 1 // The basic idea of this section is that there is a descending // scale and an ascending scale, of different lengths. They // propagate alternately around the ring of speakers in // opposite directions. The delay between notes gradually // decreases. //////////////////////////////////////////////////////////////// now => sectionLength; 20::second + now => sectionLength; 5 => int upScaleLength; 3 => int downScaleLength; [ 60, 62, 64, 66, 68 ] @=> int upScalePitches[]; [ 63, 61, 59 ] @=> int downScalePitches[]; // The channels in circular order [ 0, 1, 3, 2 ] @=> int channels[]; 0 => int upScaleIndex; 0 => int downScaleIndex; 0 => int upScaleSpeaker; 2 => int downScaleSpeaker; 0 => int currentPitch; 0 => int currentSpeaker; // Set to marimba for (0 => i; i < nInsts; i++) { 0 => inst[i].preset; } while( now < sectionLength ) { // Handle ascending scale upScalePitches[upScaleIndex] => currentPitch; channels[upScaleSpeaker] => currentSpeaker; Std.mtof( currentPitch ) => inst[currentSpeaker].freq; 0.2 => inst[currentSpeaker].noteOn; duration => now; 0.1 => inst[currentSpeaker].noteOff; // Advance pointers upScaleIndex++; (upScaleIndex % upScaleLength) => upScaleIndex; upScaleSpeaker++; upScaleSpeaker % nInsts => upScaleSpeaker; ioi => now; // Handle descending scale downScalePitches[downScaleIndex] => currentPitch; channels[downScaleSpeaker] => currentSpeaker; Std.mtof( currentPitch ) => inst[currentSpeaker].freq; 0.1 => inst[currentSpeaker].noteOn; duration => now; 0.1 => inst[currentSpeaker].noteOff; // Advance pointers, remember this propegates in the opposite direction downScaleIndex++; (downScaleIndex % downScaleLength) => downScaleIndex; downScaleSpeaker--; if(downScaleSpeaker < 0) { (nInsts-1) => downScaleSpeaker; } downScaleSpeaker % nInsts => downScaleSpeaker; // Advance time and speed up ioi => now; ioi * 0.8 => ioi; if (ioi < minIoi) { minIoi => ioi; } } //////////////////////////////////////////////////////////////// // Section 2 // This section uses sustained notes and octave jumps //////////////////////////////////////////////////////////////// //now => sectionLength; 10::second + now => sectionLength; 0 => int jumpSpeaker; // Set to vibraphone for (0 => i; i < nInsts; i++) { 1 => inst[i].preset; } while( now < sectionLength ) { for (0 => i; i < nInsts; i++) { 0.1 => inst[i].noteOff; if ( i == jumpSpeaker) { Std.mtof(upScalePitches[i]) * 2 => inst[i].freq; } else { Std.mtof(upScalePitches[i]) => inst[i].freq; } 0.1 => inst[i].noteOn; } jumpSpeaker++; jumpSpeaker % nInsts => jumpSpeaker; 3::second => now; } for (0 => i; i < nInsts; i++) { 0.1 => inst[i].noteOff; } //////////////////////////////////////////////////////////////// // Section 3 // This like section 1 but the intervals get longer instead of // shorter. Also, the accents are on the descending scale this // time. //////////////////////////////////////////////////////////////// now => sectionLength; 20::second + now => sectionLength; // Set to marimba for (0 => i; i < nInsts; i++) { 0 => inst[i].preset; } while( now < sectionLength ) { // Handle ascending scale upScalePitches[upScaleIndex] => currentPitch; channels[upScaleSpeaker] => currentSpeaker; Std.mtof( currentPitch ) => inst[currentSpeaker].freq; 0.1 => inst[currentSpeaker].noteOn; duration => now; 0.1 => inst[currentSpeaker].noteOff; // Advance pointers upScaleIndex++; (upScaleIndex % upScaleLength) => upScaleIndex; upScaleSpeaker++; upScaleSpeaker % nInsts => upScaleSpeaker; ioi => now; // Handle descending scale downScalePitches[downScaleIndex] => currentPitch; channels[downScaleSpeaker] => currentSpeaker; Std.mtof( currentPitch ) => inst[currentSpeaker].freq; 0.2 => inst[currentSpeaker].noteOn; duration => now; 0.1 => inst[currentSpeaker].noteOff; // Advance pointers, remember this propegates in the opposite direction downScaleIndex++; (downScaleIndex % downScaleLength) => downScaleIndex; downScaleSpeaker--; if(downScaleSpeaker < 0) { (nInsts-1) => downScaleSpeaker; } downScaleSpeaker % nInsts => downScaleSpeaker; // Advance time and slow down ioi => now; ioi / 0.8 => ioi; if (ioi > maxIoi) { maxIoi => ioi; } }