From 150d0b5d1578773eb36f958f4b6cf1dc5c14a607 Mon Sep 17 00:00:00 2001 From: Pete Shadbolt Date: Mon, 31 May 2021 16:03:08 -0700 Subject: [PATCH] Slower lag, scale, small delta --- audio.scd | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/audio.scd b/audio.scd index 24047df..76fc2b4 100644 --- a/audio.scd +++ b/audio.scd @@ -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)] ) } );