From ad53027ef969009433725ca9fc8ce8bfc20554e7 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Sat, 12 Oct 2024 23:42:39 -0400 Subject: [PATCH] feat: limiter gain, wet gain, dry gain --- classes/DirtOrbit.sc | 6 ++++-- classes/SuperDirt.sc | 2 +- hacks/adding-a-compressor.scd | 2 +- library/strudel-synths.scd | 6 ++---- synths/core-synths-global.scd | 9 ++++----- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/classes/DirtOrbit.sc b/classes/DirtOrbit.sc index 0ff59f59..93a6cc3d 100644 --- a/classes/DirtOrbit.sc +++ b/classes/DirtOrbit.sc @@ -63,7 +63,7 @@ DirtOrbit { GlobalDirtEffect(\dirt_reverb, [\size, \room, \dry]), GlobalDirtEffect(\dirt_leslie, [\leslie, \lrate, \lsize]), GlobalDirtEffect(\dirt_rms, [\rmsReplyRate, \rmsPeakLag]).alwaysRun_(true), - GlobalDirtEffect(\dirt_monitor, [\limitertype]).alwaysRun_(true), + GlobalDirtEffect(\dirt_monitor, [\limitertype, \outgain, \dry, \wet]).alwaysRun_(true), ] } @@ -185,7 +185,8 @@ DirtOrbit { ~lag = 0.0; ~length = 1.0; ~loop = 1.0; - ~dry = 0.0; + ~dry = 1.0; + ~wet = 1.0; ~lock = 0; // if set to 1, syncs delay times with cps ~amp = 1; @@ -193,6 +194,7 @@ DirtOrbit { ~delaytime = 0.1875; ~delayfeedback = 0.15; ~lock = 1; + ~outgain = 1; // output gain that drives the final limiter // values from the dirt bus diff --git a/classes/SuperDirt.sc b/classes/SuperDirt.sc index 15bf6592..eb5d3ceb 100644 --- a/classes/SuperDirt.sc +++ b/classes/SuperDirt.sc @@ -55,7 +55,7 @@ SuperDirt { init { soundLibrary = DirtSoundLibrary(server, numChannels); outputvolume = server.volume; - outputvolume.setVolumeRange(-90, 0); + outputvolume.setVolumeRange(-90, 6); modules = []; this.loadSynthDefs; this.initVowels(\counterTenor); diff --git a/hacks/adding-a-compressor.scd b/hacks/adding-a-compressor.scd index 963ed9c3..b40f699d 100644 --- a/hacks/adding-a-compressor.scd +++ b/hacks/adding-a-compressor.scd @@ -7,7 +7,7 @@ GlobalDirtEffect(\dirt_reverb, [\size, \room, \dry]), GlobalDirtEffect(\dirt_leslie, [\leslie, \lrate, \lsize]), GlobalDirtEffect(\dirt_rms, [\rmsReplyRate, \rmsPeakLag]).alwaysRun_(true), - GlobalDirtEffect(\dirt_monitor, [\limitertype]).alwaysRun_(true), + GlobalDirtEffect(\dirt_monitor, [\limitertype, \outgain]).alwaysRun_(true), ] }; ) diff --git a/library/strudel-synths.scd b/library/strudel-synths.scd index 29f774d3..1ec6e496 100644 --- a/library/strudel-synths.scd +++ b/library/strudel-synths.scd @@ -185,8 +185,6 @@ sound = sound * volenv * 0.3; Out.ar(out, DirtPan.ar(sound, ~dirt.numChannels, pan)); - - // Out.ar(\out.kr(0), sound * \amp.kr(0.1)); }).add; @@ -259,8 +257,8 @@ SynthDef("strudel_bpf" ++ numChannels, { |out, cutoff=440, resonance=0, attack, hold, decay, envamt=0, anchor=0, release, holdtime| var signal = In.ar(out, numChannels); - cutoff = StrudelUtils.calculateCutoff(cutoff,anchor, envamt, hold, holdtime, attack, decay, release, cutmax: SampleRate.ir / 2); - signal = BPF.ar(signal, cutoff, 1/resonance) * max(resonance, 1.0); + cutoff = StrudelUtils.calculateCutoff(cutoff,anchor, envamt, hold, holdtime, attack, decay, release, cutmax: SampleRate.ir / 2); + signal = BPF.ar(signal, cutoff.abs.clip(20, SampleRate.ir / 2), resonance.abs.clip(0.05, 1)); ReplaceOut.ar(out, signal) }, [\ir, \kr, \kr]).add; diff --git a/synths/core-synths-global.scd b/synths/core-synths-global.scd index a70af163..762ffe97 100644 --- a/synths/core-synths-global.scd +++ b/synths/core-synths-global.scd @@ -23,16 +23,15 @@ CORE SYNTHDEFS FOR DIRT */ - SynthDef("dirt_monitor" ++ numChannels, { |dryBus, effectBus, outBus, gate = 1, limitertype = 1| - var drySignal = In.ar(dryBus, numChannels); - var wetSignal = In.ar(effectBus, numChannels); + SynthDef("dirt_monitor" ++ numChannels, { |dryBus, effectBus, outBus, gate = 1, limitertype = 1, outgain = 1, dry = 1, wet = 1| + var drySignal = In.ar(dryBus, numChannels) * StrudelUtils.gainCurve(dry); + var wetSignal = In.ar(effectBus, numChannels) * StrudelUtils.gainCurve(wet); //var signal = XFade2.ar(wetSignal, drySignal, dry * 2 - 1); var signal = wetSignal + drySignal; var post = if(SuperDirt.postBadValues) { 2 } { 0 }; - signal = Select.ar(CheckBadValues.ar(signal, post: post) > 0, [signal, DC.ar(0)]); //remove any low frequency artifacts that can slam the limiter - signal = HPF.ar(signal, 16); + signal = HPF.ar(signal, 16) * StrudelUtils.gainCurve(outgain); signal = Select.ar(limitertype, [