|
- s = Server.local;
- s.waitForBoot {
- var synth, module;
-
- // Create the synth definition and load it
- module = SynthDef.new("module", {
- var x;
- var frequency, qfactor, fm_amount, detune, distortion, oscillator_level, subosc_level, noise_level, noise_tone;
- var detune_max = 3;
- var noise, crackle, mnoise, fnoise, rootosc, fmosc, subosc, msin, dsin, mixer, panner;
-
- // Setup some parameters
- x = MouseY.kr(0, 1);
- frequency = 1000;
- qfactor = ((0 -x) * 10).exp;
- detune = (1 - x) * detune_max;
- fm_amount = 1 - x;
- distortion = (1 - x)**2;
- subosc_level = 1 - (x-0.5)**2;
- oscillator_level = x**4;
- noise_level = 0.1 * (1 - (x - 0.5)**2);
- noise_tone = 1 - x;
-
- // Build and connect noise modules
- noise = WhiteNoise.ar(noise_level);
- crackle = Crackle.ar(noise_tone + 1, 0.5);
- mnoise = Mix.ar([crackle]) * (1-x);
- fnoise = BPF.ar(mnoise, frequency, qfactor);
-
- // Build and connect sinusoid modules
- fmosc = SinOsc.ar(frequency * 0.3);
- rootosc = SinOsc.ar(frequency + fmosc) * oscillator_level;
- subosc = SinOsc.ar(frequency/16).cubed * subosc_level;
-
- // Mix the sines together
- msin = Mix.ar([subosc]);
-
- // Distort the sines
- dsin = msin;
-
- mixer = Mix.ar([dsin, fnoise]);
- panner = LinPan2.ar(mixer, MouseX.kr(-1, 1), 1);
- Out.ar(0, panner);
- });
-
- module.load(s);
- s.sync;
-
- synth = Synth.new("module");
- };
|