|
@@ -12,21 +12,23 @@ s.waitForBoot { |
|
|
// Create the synth definition and load it |
|
|
// Create the synth definition and load it |
|
|
module = SynthDef.new(\module, { |
|
|
module = SynthDef.new(\module, { |
|
|
arg hue, saturation, value, pan, gain, octave; |
|
|
arg hue, saturation, value, pan, gain, octave; |
|
|
var oscillator, noise, filter, panner, mixer, frequency, qfactor, noise_level, osc_level, lagtime, output, dust; |
|
|
|
|
|
|
|
|
var oscillator, noise, filter, panner, mixer, frequency, qfactor, lagtime, output, amplitude; |
|
|
|
|
|
|
|
|
// Dynamic time of the module |
|
|
// Dynamic time of the module |
|
|
lagtime = 100 / (2**octave); |
|
|
lagtime = 100 / (2**octave); |
|
|
|
|
|
|
|
|
// Oscillator/filter frequency |
|
|
// Oscillator/filter frequency |
|
|
frequency = 130 + (hue * 130) * (2 ** octave); |
|
|
|
|
|
frequency = Lag.kr(frequency, lagtime); |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
// Filtered saw oscillator |
|
|
// Filtered saw oscillator |
|
|
oscillator = SawDPW.ar(frequency); |
|
|
oscillator = SawDPW.ar(frequency); |
|
|
filter = DFM1.ar(oscillator, frequency*0.5, 0.8, 1.0, 0.0, 0.0006); |
|
|
|
|
|
|
|
|
filter = DFM1.ar(oscillator, frequency, 0.8, 1.0, 0.0, 0.0006); |
|
|
|
|
|
|
|
|
// Noise |
|
|
// Noise |
|
|
qfactor = Lag.kr((1 - saturation)**4, lagtime); |
|
|
|
|
|
|
|
|
qfactor = Lag.kr((1 - saturation)**4, lagtime)/10; |
|
|
noise = Crackle.ar(1.99, 1.0); |
|
|
noise = Crackle.ar(1.99, 1.0); |
|
|
noise = BPF.ar(noise, frequency, qfactor); |
|
|
noise = BPF.ar(noise, frequency, qfactor); |
|
|
|
|
|
|
|
@@ -37,7 +39,8 @@ s.waitForBoot { |
|
|
panner = LinPan2.ar(mixer, pan); |
|
|
panner = LinPan2.ar(mixer, pan); |
|
|
|
|
|
|
|
|
// Apply dynamics |
|
|
// Apply dynamics |
|
|
output = panner * Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime); |
|
|
|
|
|
|
|
|
amplitude = Lag.kr(HPF.kr(value, 4 * hue / (lagtime)), lagtime/10); |
|
|
|
|
|
output = panner * amplitude; |
|
|
|
|
|
|
|
|
// Compress |
|
|
// Compress |
|
|
output = Compander.ar(output, output, 0.5, 0.3, 0.3, 0.1, lagtime); |
|
|
output = Compander.ar(output, output, 0.5, 0.3, 0.3, 0.1, lagtime); |
|
@@ -56,7 +59,7 @@ s.waitForBoot { |
|
|
arg index; |
|
|
arg index; |
|
|
var pan, octave; |
|
|
var pan, octave; |
|
|
pan = 0 - ((index % 4) - 1.5)/1.5; |
|
|
pan = 0 - ((index % 4) - 1.5)/1.5; |
|
|
octave = (2 - (index / 4).floor) * 2; |
|
|
|
|
|
|
|
|
octave = (2 - (index / 4).floor); |
|
|
"Module %: Pan %, octave %\n".postf(index, pan.round(1e-1), octave.round(1e-1)); |
|
|
"Module %: Pan %, octave %\n".postf(index, pan.round(1e-1), octave.round(1e-1)); |
|
|
Synth.new(\module, |
|
|
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] |
|
@@ -64,7 +67,6 @@ s.waitForBoot { |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Hook up OSC |
|
|
// Hook up OSC |
|
|
f = { |msg, time, addr| |
|
|
f = { |msg, time, addr| |
|
|
if(msg[0] == '/radio') { |
|
|
if(msg[0] == '/radio') { |
|
|