Skip to content

Commit

Permalink
dirt-synth: move gain and overgain to synth (#220)
Browse files Browse the repository at this point in the history
This will allow a continuous modulation of `amp` with bus mappings.
  • Loading branch information
telephon authored Jan 24, 2021
1 parent 2eaf017 commit 4f4adc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion classes/DirtEvent.sc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ DirtEvent {
}

finaliseParameters {
~amp = pow(~gain.value.min(2) + ~overgain.value, 4) * ~amp.value;
~channel !? { ~pan = ~pan.value + (~channel.value / ~numChannels) };
~pan = ~pan * 2 - 1; // convert unipolar (0..1) range into bipolar one (-1...1)
~delayAmp = ~delay ? 0.0; // for clarity
Expand Down
5 changes: 3 additions & 2 deletions synths/core-synths.scd
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,17 @@ live coding them requires that you have your SuperDirt instance in an environmen
// the monitor does the mixing and zeroing of the busses for each sample grain
// so that they can all play in one bus

SynthDef("dirt_gate" ++ numChannels, { |out, in, sustain = 1, fadeInTime = 0.001, fadeTime = 0.001, amp = 1|
SynthDef("dirt_gate" ++ numChannels, { |out, in, sustain = 1, fadeInTime = 0.001, fadeTime = 0.001, amp = 1, gain = 1, overgain = 0|
var signal = In.ar(in, numChannels);
// doneAction: 14: free surrounding group and all nodes
var env = EnvGen.ar(Env([0, 1, 1, 0], [fadeInTime, sustain, fadeTime], \sin), doneAction: 14);
amp = amp * pow(gain.min(2) + overgain, 4);
signal = signal * env * amp * DirtGateCutGroup.ar(fadeTime, doneAction: 14);
// this takes the signal and offsets it so it matches precisely onto the sample
// as scheduled within one block (a synth is always started on the block bondary)
OffsetOut.ar(out, signal);
ReplaceOut.ar(in, Silent.ar(numChannels)) // clears bus signal for subsequent synths
}, [\ir, \ir, \ir, \ir, \ir, \kr]).add; // amp can be modulated
}, [\ir, \ir, \ir, \ir, \ir, \kr, \ir, \ir]).add; // amp can be modulated, gain and overgain can't


/*
Expand Down

0 comments on commit 4f4adc9

Please sign in to comment.