// Boolean Sequenced Guitar with Random Logic Generation // Copyright 2008 Les Hall // This software is protected by the GNU General Public License 8 => int n; // number of bits and number of logic terms Math.pow (2, n) $ int => int m; // 2 ^ n 0 => int b; // the binary counter int l[n]; // the logic expressions int f; // the frequency index guitar strat; strat.output => dac; 0.5 => dac.gain; while (true) { // generate logic expressions if (b == 0) { for (int i; i < n; i++) { 0 => l[i]; while (l[i] == 0) { (Math.abs (Math.rand ()) + 1) & (m-1) => l[i]; } } } // increment binary counter (b+1)%m => b; // calculate frequency 0 => f; for (int i; i < n; i++) { if ((l[i]&b) == l[i]) { 1 +=> f; } } // strum guitar if (f > 0) { strat.strum ((440.0*f)/n); } // time delay 0.25::second => now; } // guitar based on kijjaz's model class guitar { 6 => int num_strings; Mandolin mandy[num_strings]; SinOsc overdrive => Gain output; for (int i; i < num_strings; i++) { mandy[i] => overdrive; 0.9 => mandy[i].stringDamping; 0.3 => mandy[i].bodySize; 0.1 => mandy[i].stringDetune; } 1 => overdrive.sync; fun void strum (float freq) { for (int i; i < num_strings; i++) { freq * (i+1) => mandy[i].freq; (num_strings - i) $ float / num_strings => mandy[i].pluck; } } }