// base_n1.ck // copyright 2007 Les Hall // This software released under the GNU General Protective License // experiments with creating music from base n sequences // control variables 2 => int n; // numeric base of the sequence // 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 < n; j1++) { j1 / 1.0 / (n-1) => s1.gain; for (0 => int j2; j2 < n; j2++) { j2 / 2.0 / (n-1) => s2.gain; for (0 => int j3; j3 < n; j3++) { j3 / 4.0 / (n-1) => s3.gain; for (0 => int j4; j4 < n; j4++) { j4 / 8.0 / (n-1) => s4.gain; for (0 => int j5; j5 < n; j5++) { j5 / 16.0 / (n-1) => s5.gain; 200::ms => now; // advance time } } } } } // shut off the oscillators 0 => s1.gain; 0 => s2.gain; 0 => s3.gain; 0 => s4.gain; 0 => s5.gain; // increment the base number n++; // advance time between binary counts 3::second => now; }