//triads //text4 //C minor, 4/4 //instantiates arrays for C major and minor triads //(MIDI, octave 3) [39, 43, 46] @=> int majortriad[]; [39, 42, 46] @=> int minortriad[]; //sets default key (c = 0) 0 => int triadkey; //sets default time signature 4 => int timesig; 4 * timesig => int phraselength; //newtriadkey is a value that, when //added to each element of preceding arrays, //will change key of the array. 7AM = G major 0 => int newtriadkey; //Transposes key: adds "newkey" to the MIDI //values of major() to create major scale of // key "0 + newkey" fun void majortriadscaler(int newtriadkey) { for (0 => int i; i < majortriad.cap(); i++) { majortriad[i] + newtriadkey => majortriad[i]; } } fun void minortriadscaler(int newtriadkey) { for (0 => int i; i < minortriad.cap(); i++) { minortriad[i] + newtriadkey => minortriad[i]; } } //patches BlowBotl bottle => NRev n => dac; 0.6 => n.mix; 0.25 => bottle.gain; Mandolin mand => JCRev r => dac; // set the gain .24 => r.gain; // set the reverb mix .05 => r.mix; //functions to make each patch play major and minor chords fun void BotlMajor() { for (0 => int i; i < phraselength; i++ ) { Math.random2f( 0, 12 ) => bottle.vibratoFreq; Math.random2f( 0, 1 ) => bottle.vibratoGain; Math.random2f( 0, 1 ) => bottle.volume; majortriad[Math.random2(0,majortriad.cap()-1)] => int winner; 57 + Math.random2(0,2)*12 + winner => Std.mtof => bottle.freq; // go .5 => bottle.noteOn; // advance time 500::ms => now; } } fun void BotlMinor() { for (0 => int i; i < phraselength; i++ ) { Math.random2f( 0, 12 ) => bottle.vibratoFreq; Math.random2f( 0, 1 ) => bottle.vibratoGain; Math.random2f( 0, 1 ) => bottle.volume; minortriad[Math.random2(0,minortriad.cap()-1)] => int winner; 57 + Math.random2(0,2)*12 + winner => Std.mtof => bottle.freq; // go .5 => bottle.noteOn; // advance time 500::ms => now; } } fun void MandMajor() { for (0 => int i; i < phraselength; i++ ) { // position Math.random2f( 0.2, 0.8 ) => mand.pluckPos; // frequency... majortriad[Math.random2(0,majortriad.cap()-1)] => int freq; 45 + Math.random2(0,3)*12 + freq => Std.mtof => mand.freq; // pluck it! Math.random2f( 0.2, 0.9 ) => mand.pluck; // let time pass for final pluck 500::ms => now; } } fun void MandMinor() { for (0 => int i; i < phraselength; i++ ) { // position Math.random2f( 0.2, 0.8 ) => mand.pluckPos; // frequency... minortriad[Math.random2(0,minortriad.cap()-1)] => int freq; 45 + Math.random2(0,3)*12 + freq => Std.mtof => mand.freq; // pluck it! Math.random2f( 0.2, 0.9 ) => mand.pluck; // let time pass for final pluck 500::ms => now; } } //tells ChucK how many times to repeat the chord progression 6 => int howmanytimes; //plays minor chord progression fun void MinorProg(int howmanytimes) { for (0 => int i; i < howmanytimes; i++ ) { -24 => newtriadkey; minortriadscaler(newtriadkey); BotlMinor(); MandMinor(); //change key -20 => newtriadkey; minortriadscaler(newtriadkey); <<< "change" >>>; BotlMinor(); MandMinor(); //change key -25 => newtriadkey; majortriadscaler(newtriadkey); <<< "change" >>>; BotlMajor(); MandMajor(); //change key -28 => newtriadkey; majortriadscaler(newtriadkey); <<< "change" >>>; BotlMajor(); MandMajor(); } } 6 => howmanytimes; MinorProg(howmanytimes);