Adding dynamics to the sound using parallel modulation of the synth’s main amplitude envelope.
The curve of modulation aligns naturally with the curve of the sound’s amplitude.
SynthDef(\x,
{
|rate 864 bus 0|
// initially define main envelope
var env =
(
Env xyc: // [ time, level, curve ]
[
[ 0, 0, 'sin' ],
[ 0.515625, 1, 'sin' ],
[ 1.03125, 0, 'sin' ]
]
)
;
Out.ar
(
bus,
Pan2.ar
(
level:
(
AmpComp.kr
(
freq: rate,
root: 27,
exp: 0.25
)
*
env.ar
(
doneAction:
(
Done.freeSelf
)
)
),
pos:
(
0 // -1..1
),
in:
(
Resonz.ar
(
in:
(
Saw ar: rate
),
freq:
(
rate / 2
),
bwr: // bandwidth ratio
(
// compare the envelope against purely static values
env.ar
(
levelBias: 0.1 // docs warn about values close to zero
)
// 0.5
// 1.0
)
)
)
)
)
}
)
.play
Forcibly working around values close to zero for the bandwidth ratio at the end of the SynthDef, a separate EnvGen
is used with slightly offset level values.
The envelope of the sound’s amplitude is often the most sensible choice for dynamic modulation, while maintaining a sense of cohesion.