// Michael J. Wilson // Music 220a Fall 2010 // Final Project // Conductor program cues all the other files, sends their outputs to // different dac channels, and adjusts the gains. // Make sure to shred necessary files before calling this. //////////////////////////////////////////////////////////////////////////////// // Setup //////////////////////////////////////////////////////////////////////////////// // Option switches true => int quad_speaker; true => int write_wave; // For rehearsal true => int section_one; true => int section_two; true => int section_three; true => int section_four; // Instruments Bell my_bell; MainLead my_main_lead; MainBackup my_backup; WarmthRumble my_rumble; WarmthChords my_chords; PowerUp my_powerup; MainDrums my_drums; MainBass my_bass; // Virtual speakers Gain LF; Gain RF; Gain LR; Gain RR; // Wave output "lf.wav" => string lf_filename; "rf.wav" => string rf_filename; "lr.wav" => string lr_filename; "rr.wav" => string rr_filename; WvOut lf_wave; WvOut rf_wave; WvOut lr_wave; WvOut rr_wave; // Connect virtual speakers to DAC: if (write_wave) { lf_filename => lf_wave.wavFilename; rf_filename => rf_wave.wavFilename; LF => lf_wave => blackhole; RF => rf_wave => blackhole; if (quad_speaker) { lr_filename => lr_wave.wavFilename; rr_filename => rr_wave.wavFilename; LR => lr_wave => blackhole; RR => rr_wave => blackhole; } else { LR => lf_wave => blackhole; RR => rf_wave => blackhole; 0.55 => LF.gain; 0.55 => RF.gain; 0.45 => LR.gain; 0.45 => RR.gain; } } else { if (quad_speaker) { // 4-speaker configuration // 0 is Left Front // 1 is Right Front // 2 is Left Rear // 3 is Right Rear LF => dac.chan(0); RF => dac.chan(1); LR => dac.chan(2); RR => dac.chan(3); 1.0 => LF.gain; 1.0 => RF.gain; 1.0 => LR.gain; 1.0 => RR.gain; } else { // 2-speaker configuration // Merge the rear channels with some attenuation LF => dac.chan(0); RF => dac.chan(1); LR => dac.chan(0); RR => dac.chan(1); 0.55 => LF.gain; 0.55 => RF.gain; 0.45 => LR.gain; 0.45 => RR.gain; } } // Individual instruments follow: // Warmth three notes 0.04 => Control.chan[0].gain; Control.chan[0] => Envelope ThreeNotesEnv; ThreeNotesEnv => LF; ThreeNotesEnv => RF; ThreeNotesEnv => LR; ThreeNotesEnv => RR; // Warmth Morse code 0.06 => Control.chan[1].gain; Control.chan[1] => Envelope MorseCodeEnv; MorseCodeEnv => LF; MorseCodeEnv => RF; // Warmth chords 0.10 => Control.chan[2].gain; 0.10 => Control.chan[3].gain; 0.10 => Control.chan[4].gain; 0.10 => Control.chan[5].gain; Control.chan[2] => LF; Control.chan[3] => RF; Control.chan[4] => LR; Control.chan[5] => RR; // Warmth low rumble 0.45 => Control.chan[6].gain; Control.chan[6] => LF; Control.chan[6] => RF; Control.chan[6] => LR; Control.chan[6] => RR; // Bell 2.0 => Control.chan[7].gain; Control.chan[7] => LF; Control.chan[7] => RF; Control.chan[7] => LR; Control.chan[7] => RR; // Powerup 0.04 => Control.chan[8].gain; Control.chan[8] => LF; Control.chan[8] => RF; Control.chan[8] => LR; Control.chan[8] => RR; // Main Lead 0.15 => Control.chan[9].gain; Control.chan[9] => LF; Control.chan[9] => RF; // Bass 0.035 => Control.chan[10].gain; Control.chan[10] => LF; Control.chan[10] => RF; Control.chan[10] => LR; Control.chan[10] => RR; // Backups 0.14 => Control.chan[11].gain; Control.chan[11] => LR; Control.chan[11] => RR; // Drums 0.026 => Control.chan[12].gain; Control.chan[12] => LF; Control.chan[12] => RF; Control.chan[12] => LR; Control.chan[12] => RR; // Mute continuous sequences to start 0 => ThreeNotesEnv.value; 0 => ThreeNotesEnv.target; 0 => MorseCodeEnv.value; 0 => MorseCodeEnv.target; // Pass a little time so that everything gets flushed out 500::ms => now; //////////////////////////////////////////////////////////////////////////////// // Section 1 - "Warmth" //////////////////////////////////////////////////////////////////////////////// if (section_one) { // Low rumble spork ~ my_rumble.play(30::second); // Chords circling around spork ~ my_chords.play(30::second); // Section timing 7::second => now; // Fade in 3 note up pattern 23::second => ThreeNotesEnv.duration; 0 => ThreeNotesEnv.value; 1.0 => ThreeNotesEnv.target; // Section timing 8::second => now; // Fade in Morse Code section 10::second => MorseCodeEnv.duration; 0 => MorseCodeEnv.value; 1.0 => MorseCodeEnv.target; // Section timing 15::second => now; // Powerup section (3 beats total, 1 before end, 2 after): spork ~ my_powerup.powerup(2 * Control.beat); 2 * Control.beat => now; // Stop morse code and three note sequences 0 => ThreeNotesEnv.value; 0 => ThreeNotesEnv.target; 0 => MorseCodeEnv.value; 0 => MorseCodeEnv.target; } //////////////////////////////////////////////////////////////////////////////// // Section 2 - "Main Effect" //////////////////////////////////////////////////////////////////////////////// if (section_two) { // Start with the bell spork ~ my_bell.play(); // Instruments for the "main theme" section don't need to be // removed, but they need to be individually cued. spork ~ my_main_lead.play(); spork ~ my_backup.play(); spork ~ my_drums.play(); spork ~ my_bass.play(); // Section A Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; // Section B spork ~ my_bell.play(); Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; // Section C spork ~ my_bell.play(); Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; // Section D Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; Control.beat * 4 => now; } //////////////////////////////////////////////////////////////////////////////// // Section 3 - "Awakening" //////////////////////////////////////////////////////////////////////////////// if (section_three) { // Bell at end spork ~ my_bell.play(); // Another chord section similar to warmth: spork ~ my_rumble.play(Control.beat * 4); spork ~ my_chords.play(Control.beat * 4); Control.beat * 4 => now; } //////////////////////////////////////////////////////////////////////////////// // Section 4 - "End" //////////////////////////////////////////////////////////////////////////////// if (section_four) { // A "blip out" part where everything goes out and just reverb is // left spork ~ my_powerup.powerdown(0.125 * Control.beat); } // Add a little time at the end 500::ms => now; //////////////////////////////////////////////////////////////////////////////// // Cleanup //////////////////////////////////////////////////////////////////////////////// if (write_wave) { lf_wave.closeFile(); rf_wave.closeFile(); if (quad_speaker) { lr_wave.closeFile(); rr_wave.closeFile(); } <<< "Done writing wavefiles" >>>; }