Skip to content

Commit

Permalink
feat: limiter gain, wet gain, dry gain
Browse files Browse the repository at this point in the history
  • Loading branch information
daslyfe committed Oct 13, 2024
1 parent 019c1ba commit ad53027
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
6 changes: 4 additions & 2 deletions classes/DirtOrbit.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
}

Expand Down Expand Up @@ -185,14 +185,16 @@ 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;
~fadeTime = 0.001;
~delaytime = 0.1875;
~delayfeedback = 0.15;
~lock = 1;
~outgain = 1; // output gain that drives the final limiter


// values from the dirt bus
Expand Down
2 changes: 1 addition & 1 deletion classes/SuperDirt.sc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion hacks/adding-a-compressor.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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),
]
};
)
Expand Down
6 changes: 2 additions & 4 deletions library/strudel-synths.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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;


Expand Down Expand Up @@ -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;

Expand Down
9 changes: 4 additions & 5 deletions synths/core-synths-global.scd
Original file line number Diff line number Diff line change
Expand Up @@ -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,
[
Expand Down

0 comments on commit ad53027

Please sign in to comment.