|
|
@@ -4,20 +4,43 @@ s.waitForBoot { |
|
|
|
|
|
|
|
// 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); |
|
|
|
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); |
|
|
|