|
|
@@ -10,18 +10,26 @@ s.waitForBoot { |
|
|
|
|
|
|
|
// Create the synth definition and load it |
|
|
|
module = SynthDef.new("module", { |
|
|
|
arg hue, saturation, value; |
|
|
|
var oscillator, noise, filter, panner, mixer; |
|
|
|
arg hue, saturation, value, pan; |
|
|
|
var oscillator, noise, filter, panner, mixer, frequency, qfactor, noise_level, osc_level; |
|
|
|
|
|
|
|
// Calculate some parameters |
|
|
|
frequency = 200 + 800*hue; |
|
|
|
qfactor = (1 - saturation)**4; |
|
|
|
osc_level = saturation; |
|
|
|
noise_level = 1 - osc_level; |
|
|
|
|
|
|
|
// Generate some sounds |
|
|
|
noise = WhiteNoise.ar(1); |
|
|
|
filter = BPF.ar(noise, MouseX.kr(220, 1000), MouseY.kr(0, 1)**4, MouseY.kr(2, 0.1)); |
|
|
|
oscillator = SinOsc.ar(MouseX.kr(220, 1000)) * MouseY.kr(0.5, 0); |
|
|
|
filter = BPF.ar(noise, frequency, qfactor) * noise_level; |
|
|
|
oscillator = SinOsc.ar(frequency) * osc_level; |
|
|
|
mixer = Mix.ar([filter, oscillator]); |
|
|
|
panner = LinPan2.ar(mixer, 0.0); |
|
|
|
Out.ar(0, mixer); |
|
|
|
panner = LinPan2.ar(mixer, 2*pan - 1, value); |
|
|
|
Out.ar(0, panner); |
|
|
|
}); |
|
|
|
module.load(s); |
|
|
|
s.sync; |
|
|
|
|
|
|
|
// Make a sound |
|
|
|
sound = Synth.new("module", [\hue, 440, \saturation, 100, \value, 500]); |
|
|
|
sound = Synth.new("module", [\hue, 0.5, \saturation, 0.1, \value, 0.5, \pan, 0.5]); |
|
|
|
}; |