s = Server.local; s.waitForBoot { var synth, module; // Create the synth definition and load it module = SynthDef.new("module", { var noise, crackle, mixer, oscillator, filtered_noise, tone, frequency, noise_level, qfactor, osc_level; tone = MouseX.kr(1, 0); frequency = MouseY.kr(200, 2000); qfactor = (tone)**4; osc_level = 1 - tone; noise_level = 1 - tone; oscillator = SinOsc.ar(frequency) * osc_level; crackle = Crackle.ar(tone + 1, 0.5); noise = WhiteNoise.ar(1); filtered_noise = BPF.ar(noise, frequency, qfactor) * noise_level; mixer = Mix.ar([crackle, filtered_noise]); Out.ar(0, mixer); }); module.load(s); s.sync; synth = Synth.new("module"); };