here is an explanation, I hope it helps (sorry for the lack of documentation).
IIRC, we chose 0.4
because that was the value from classic dirt.
But it is also reasonable, avoiding distortion, but not too quiet.
// amplitude is controlled by the gate synth:
sendGateSynth {
server.sendMsg(\s_new,
"dirt_gate" ++ ~numChannels,
-1, // no id
1, // add action: addToTail
~synthGroup, // send to group
*[
in: orbit.synthBus.index, // read from synth bus, which is reused
out: orbit.dryBus.index, // write to orbital dry bus
amp: ~amp,
gain: ~gain,
overgain: ~overgain,
sample: ~hash, // required for the cutgroup mechanism
cut: ~cut.abs,
sustain: ~sustain, // after sustain, free all synths and group
fadeInTime: ~fadeInTime, // fade in
fadeTime: ~fadeTime // fade out
]
)
}
// the default parameters for amp and gain you can find in the orbit:
~dirt = SuperDirt(2, s);
~dirt.start;
~dirt.orbits.first.get(\amp) // 0.4
~dirt.orbits.first.get(\gain) // 1.0
~dirt.orbits.first.get(\overgain) // 0.0
// these two parameters are passed to a synth called "dirt_gate"
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, \ir, \ir]).add; // amp can be modulated, gain and overgain can't
// => the formula is this:
amp * pow(gain.min(2) + overgain, 4);
// so for the defaults, you get
0.4 * pow(1 + 0, 4) // => 0.4