Designing Sound in SuperCollider/Rolling can
Fig 31.3: simple approximation to a drink can
editThe four clear resonances are identified using a spectrogram of a can.
(
x = { |t_trig=0|
// This line just creates a sharp little spike whenever we want:
var strike = EnvGen.ar(Env.perc(0.0001, 0.001, 0.1), t_trig);
// here's the resonances:
var son = Ringz.ar(strike, [359, 426, 1748, 3150], 0.2).sum;
// some distortion livens up the spectrum a little:
son = HPF.ar(son.clip2(0.6), 300);
son * 0.2
}.play;
)
x.set(\t_trig, 1); // Run this line to hit the can!
Fig 31.6: a repeating roll pattern
editThis simulates the regular turning of the drinks can. Since it's a control signal we'll plot it rather than play, for now.
(
~regularroll = { |rate = 1|
// In the original code, Andy uses a master phase control,
// wrapping and re-scaling it before differentiating, to produce
// a repeating but disorderly set of impulses.
// Here we do it differently - we use Impulse.kr to generate the
// impulses directly.
// We evaluate this function multiple times using .dup so that
// we get a whole set of impulses with random phase positions.
{
Impulse.kr(rate, 1.0.rand, 1.0.bilinrand)
}.dup(10).sum
};
~regularroll.plot(2);
)
Fig 31.7: ground bumping
edit(
// This signal contribution to rolling signature based on Mathias Rath's idea - see 'The Sounding Object'
// (ajf2009)
//
~irregularground = { |rate=10|
var trigs = Dust.kr(rate);
EnvGen.ar(
Env([0,0,-1,1.5,-1,1,0], [0.1, 0.1, 0.001, 0.001, 0.1, 0.1], 'sine'),
trigs
) * 0.1
};
~irregularground.plot(4)
)
Fig 31.8: putting it all together
edit(You must have run figs 31.6 and 31.7 to get their functions defined.)
The sound of a can rolling a little and coming to a stop.
(
x = {
var rate, strike, son;
// rate of motion starts fast and tails off
rate = XLine.kr(4, 0.001, 8, doneAction: 2);
// This rate affects both the regular rolling, and the irregular ground contacts.
strike =
~irregularground.(rate*2) * 0.04
+
K2A.ar(~regularroll.(rate) * 0.1)
;
// Force the strikes to die off in intensity:
strike = strike * XLine.ar(1, 0.0001, 8);
// And here are the tin-can resonances as in fig 31.3:
son = Ringz.ar(strike, [359, 426, 1748, 3150], 0.2).sum;
son = HPF.ar(son.clip2(0.6), 300);
son * 0.2
}.play;
)