// binary2.ck // copyright 2007 Les Hall // This software released under the GNU General Protective License // experiments with creating music from binary sequences // the patch(es) SinOsc s1 => dac; SinOsc s2 => dac; SinOsc s3 => dac; SinOsc s4 => dac; SinOsc s5 => dac; // set the oscillator frequencies 200 => float frequency; 1 * frequency => s1.freq; 2 * frequency => s2.freq; 3 * frequency => s3.freq; 4 * frequency => s4.freq; 5 * frequency => s5.freq; // time loop while (true) { // loop in a 5-bit binary sequence and pluck the strings for (0 => int j1; j1 < 2; j1++) { j1 / 1.0 => s1.gain; for (0 => int j2; j2 < 2; j2++) { j2 / 2.0 => s2.gain; for (0 => int j3; j3 < 2; j3++) { j3 / 4.0 => s3.gain; for (0 => int j4; j4 < 2; j4++) { j4 / 8.0 => s4.gain; for (0 => int j5; j5 < 2; j5++) { j5 / 16.0 => s5.gain; 300::ms => now; // advance time } } } } } // shut off the oscillators 0 => s1.gain; 0 => s2.gain; 0 => s3.gain; 0 => s4.gain; 0 => s5.gain; // advance time between binary counts 3::second => now; }