play({
OverlapTexture.ar({
var freq, seq, excitation, resonator;
freq = 40 + 300.0.rand; // random base frequency
seq = ImpulseSequencer.ar( // outputs a sequence of single sample triggers
pat.asStream, // create a stream to iterate over pattern
Impulse.ar(10)); // a clock for the sequencer at 10 beats per second
excitation = Decay.ar( // a decaying envelope for the noise
seq, // impulse sequence triggers decay envelopes
0.1, // 60 dB decay time
PinkNoise.ar(0.01)); // noise is the exciter
resonator = Klank.ar( // use Klank as a percussion resonator
`[ // filter bank specification array:
Array.fill(n, { freq + (4.0*freq).linrand }), // resonant frequencies
nil, // amplitudes default to 1.0
Array.fill(n, { 0.2 + 3.0.linrand }) // ring times
], excitation);
Pan2.ar(resonator, 1.0.rand2) // random pan position
// return the Pan2
}, 8, 4, 4, 2); // sustainTime, fadeTime, overlapDensity, number of channels
});
|