Sound File Amplitude Modulation
A Supercollider script I wrote to allow amplitude modulation of sound files, with the modulation depth being variable over time. Idea being, of course, to ‘morph’ the sound over time. Not the prettiest code, but effective (suggestions welcome, of course).
(
b = Buffer.read(s,"sounds/a11wlk01.wav");
SynthDef
(
"playbuf",
{ arg out=0, bufnum=0, modfreq=1000, startdepth=0.0, middepth=0.25, enddepth=0.0, attack=5.0, decay=5.0, rate=1, trigger=1, startPos=0, loop=1, multiplier=0.5;
var modulator;
modulator= SinOsc.ar
(
modfreq,
0,
EnvGen.kr
(
Env.new
(
[startdepth,middepth,enddepth],
[attack, decay],
'linear'
)
),
multiplier
);
Out.ar
(
out,
PlayBuf.ar
(
1,
bufnum,
BufRateScale.kr(bufnum)*rate,
trigger,
BufFrames.ir(bufnum)*startPos,
loop
)*modulator//...and amplitude modulate it
)
}
).send(s);
)
Synth(playbuf, [out, 0, bufnum, b.bufnum, modfreq, 1568, attack, 2.0, decay, 2.0, startdepth, 0.0, middepth, 0.5, enddepth, 0.0, loop, 0]);
