// Washing Machine // copyright 2009 Les Hall // This software is protected by the GNU General Public License // parameters 30 => int n; 500::ms => dur t; // patch // // delay lines DelayA dly[n]; for (1=>int i; i dly[i]; } Gain hub; 4.0 / n => hub.gain; for (int i; i hub; } 2 * t => dly[i].max; t => dly[i].delay; 0.995 => dly[i].gain; } // // automatic gain control //dly[n-1] => Gain agc_divide; //dly[n-1] => FullRect agc_fwr => LPF agc_lpf => Gain agc_add => agc_divide; //Step agc_step => agc_add; //1 => agc_divide.op; //3.0 => agc_lpf.freq; //1.0 => agc_step.next; // // sigmoid distortion and limiting //agc_divide => Gain divide; //agc_divide => FullRect fwr => Gain add => divide; dly[n-1] => Gain divide; dly[n-1] => FullRect fwr => Gain add => divide; Step step => add; 4 => divide.op; 0.5 => step.next; // // close feedback loop divide => dly[0]; // // input tap adc => dly[0]; // // output tap // with ring modulator hub => Gain ring_mod => dac; SinOsc modulate => Gain rm_add => ring_mod; Step rm_step => rm_add; 3 => ring_mod.op; 60 => modulate.freq; 0.5 => modulate.gain; 0.5 => rm_step.next; // // controller controller uhid; // time loop while (true) { t => now; } class controller { // parameters 0 => int joystick_device; // initialize HID Hid hid; HidMsg hidmsg; if (!hid.openJoystick (joystick_device) ) { <<<"Controller not found at device", joystick_device>>>; } else { <<<"Controller '" + hid.name() + "' ready.", "">>>; } // launch time loop spork ~ time_loop(); // time loop fun void time_loop() { while (true) { hid => now; while (hid.recv (hidmsg) ) { if (hidmsg.isAxisMotion() ) { //<<>>; if (hidmsg.which == 0) { for (int i; i dly[i].delay; } } if (hidmsg.which == 1) { 100.0 * hidmsg.axisPosition => modulate.freq; } if (hidmsg.which == 2) { 4 * hidmsg.axisPosition => adc.gain; } if (hidmsg.which == 3) { 4 * hidmsg.axisPosition => dac.gain; } if (hidmsg.which == 4) { for (int i; i dly[i].gain; } } } if (hidmsg.isButtonUp() ) { if (hidmsg.which == 0) { for (int i; i dac; } } if (hidmsg.which == 1) { for (int i; i dly[0]; } } } if (hidmsg.isButtonDown() ) { if (hidmsg.which == 0) { for (int i; i