// Michael J. Wilson // Music 220a Fall 2010 // Final Project // Power up section! public class PowerUp { // Instrument BlitSquare instrument; 10 => instrument.harmonics; 1.0 => instrument.gain; // Give this channel 8 instrument => Envelope amp => Control.chan[8]; // Mute to start 0.0 => amp.value; 0.0 => amp.target; 10::ms => amp.duration; Envelope freq; Step s => freq => blackhole; // Smoothly update amplitdude and frequency fun void run() { while (true) { freq.last() => instrument.freq; 1::samp => now; } } fun void powerup(dur time_length) { spork ~ run(); time_length/2 => freq.duration; 1.0 => amp.value; 1.0 => amp.target; Std.mtof(30) => instrument.freq; Std.mtof(30) => freq.value; Std.mtof(42) => freq.target; time_length/2 => now; Std.mtof(78) => freq.target; time_length/2 => now; 0.0 => amp.target; 1::second => now; } fun void powerdown(dur time_length) { // This is good for the button at the end time_length => freq.duration; 1.0 => amp.value; 1.0 => amp.target; Std.mtof(78) => instrument.freq; Std.mtof(78) => freq.value; Std.mtof(18) => freq.target; spork ~ run(); time_length => now; 0.0 => amp.target; 1::second => now; } }