|
|
@@ -11,35 +11,36 @@ s.waitForBoot { |
|
|
|
|
|
|
|
// Create the synth definition and load it |
|
|
|
module = SynthDef.new(\module, { |
|
|
|
arg hue, saturation, value, pan, gain, octave; |
|
|
|
arg hue, saturation, value, pan, gain, octave, notefreq; |
|
|
|
var oscillator, noise, filter, panner, mixer, frequency, qfactor, lagtime, output, amplitude; |
|
|
|
|
|
|
|
// Dynamic time of the module |
|
|
|
lagtime = 100 / (2**octave); |
|
|
|
|
|
|
|
// Oscillator/filter frequency |
|
|
|
frequency = (130 + (hue * 130)) * (2 ** octave); |
|
|
|
frequency = notefreq * (1 + (hue*0.01)); |
|
|
|
//frequency = (130 + (hue * 130)) * (2 ** octave); |
|
|
|
//frequency = 130 * Scale.major.ratios[(hue * 12).asInteger]; |
|
|
|
//frequency = (130 * frequency) * (2**octave); |
|
|
|
frequency = Lag.kr(frequency, lagtime/10); |
|
|
|
frequency = Lag.kr(frequency, lagtime/100); |
|
|
|
|
|
|
|
// Filtered saw oscillator |
|
|
|
oscillator = SawDPW.ar(frequency); |
|
|
|
filter = DFM1.ar(oscillator, frequency, 0.8, 1.0, 0.0, 0.0006); |
|
|
|
oscillator = Mix.ar([SawDPW.ar(frequency), SawDPW.ar(frequency/2+0.5)]); |
|
|
|
filter = DFM1.ar(oscillator, frequency, saturation/2, 1.0, 0.0, 0.0006); |
|
|
|
|
|
|
|
// Noise |
|
|
|
qfactor = Lag.kr((1 - saturation)**4, lagtime)/10; |
|
|
|
qfactor = Lag.kr((1 - saturation)**4, lagtime); |
|
|
|
noise = Crackle.ar(1.99, 1.0); |
|
|
|
noise = BPF.ar(noise, frequency, qfactor); |
|
|
|
|
|
|
|
// Mix noise and saw |
|
|
|
mixer = Mix.ar([filter * saturation, noise*(1-saturation)]); |
|
|
|
mixer = Mix.ar([filter * saturation.sqrt(), 0.5 * noise*(1-saturation)]); |
|
|
|
|
|
|
|
// Apply pan |
|
|
|
panner = LinPan2.ar(mixer, pan); |
|
|
|
|
|
|
|
// Apply dynamics |
|
|
|
amplitude = Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime/10); |
|
|
|
amplitude = Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime); |
|
|
|
output = panner * amplitude; |
|
|
|
|
|
|
|
// Compress |
|
|
@@ -62,7 +63,7 @@ s.waitForBoot { |
|
|
|
octave = (2 - (index / 4).floor); |
|
|
|
"Module %: Pan %, octave %\n".postf(index, pan.round(1e-1), octave.round(1e-1)); |
|
|
|
Synth.new(\module, |
|
|
|
[\hue, 0.5, \saturation, 0.1, \value, 0.5, \pan, pan, \gain, 0.9, \octave, octave] |
|
|
|
[\hue, 0.5, \saturation, 0.1, \value, 0.5, \pan, pan, \gain, 0.9, \octave, octave, \notefreq, Scale.major.degreeToFreq(index, 48.midicps, octave)] |
|
|
|
) |
|
|
|
} |
|
|
|
); |
|
|
|