Browse Source

Nice, nice

tags/kitchen
Pete Shadbolt 3 years ago
parent
commit
629e41bc94
1 changed files with 15 additions and 7 deletions
  1. +15
    -7
      audio.scd

+ 15
- 7
audio.scd View File

@@ -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]);
};

Loading…
Cancel
Save