// eChucK Wind Instrument Model // Copyright 2010 Les Hall // The Patch // // air source with noise Noise n => Gain add; 0.03 => n.gain; // // Jet Driver Dyno limiter => Gain x1 => Gain x2 => Gain x3; x1 => Gain pow; x2 => pow; x3 => pow; Gain diff => blackhole; pow => diff; x1 => diff; limiter.limit(); 3 => pow.op; 2 => diff.op; 1 => limiter.op; // // Delay Line DelayA delay => LPF lpf => blackhole; 100::ms => delay.max; 0.975 => delay.gain; 7900 => lpf.freq; // // closed loop add => limiter; diff => delay; lpf => limiter; lpf => dac; // Boolean Sequencer Class class BooleanSequencer { // variables int switches[]; // the switch settings int b; // the binary counter int sum; // sum of switches that match int bitMask; // rollover bit mask // set switches fun void set(int array[]) { array @=> switches; } fun void setBits(int n) { (Math.pow(2, n) - 1) $ int => bitMask; } // reset counter fun void reset() { 0 => b; } // perform one iteration of the sequencer fun void iterate() { 0 => sum; for (int i; i sum; } 1 +=> b; // increment b bitMask & b => b; // make b an 8 bit counter } // get the sum fun int getSum() { return sum; } // get the gate fun int getGate() { if (sum > 0) { return true; } else { return false; } } } BooleanSequencer BS; // set up and perform the song BS.set([1, 2, 5, 6, 10, 24, 27, 42, 52, 108]); BS.setBits(8); while(true) { BS.iterate(); BS.getSum()::ms + 5::ms => delay.delay; BS.getGate() => add.gain; 500::ms => now; }