They Attack







(
{
Klank.ar(
`[[100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], //freq array
[0.05, 0.2, 0.04, 0.06, 0.11, 0.01, 0.15, 0.03, 0.15, 0.2]],
PinkNoise.ar(LFTri.kr(0.07, 0.07, 0.07))).dup
}.play
)

Klank.ar(specificationsArrayRef, input, freqscale, freqoffset, decayscale)
Klank is a bank of fixed frequency resonators which can be used to simulate the resonant modes of an object. Each mode is given a ring time, which is the time for the mode to decay by 60 dB.



{ Klank.ar(`[[800, 1071, 1353, 1723], nil, [1, 1, 1, 1]], PinkNoise.ar(0.007)).dup }.play;

(
play({
        Klank.ar(`[
                Array.rand(12, 800.0, 4000.0), // frequencies
                nil,  // amplitudes (default to 1.0)
                Array.rand(12, 0.1, 2)  // ring times
                ], Decay.ar(Impulse.ar(4), 0.03, 0.01)).dup
})
)



(
{
var harmonics = 16;
Mix.fill(harmonics,
{ arg count;
Pan2.ar(
FSinOsc.ar(
exprand(100, 2000),
mul: max(0, FSinOsc.kr(rrand(1/3, 1/6))*rrand(0.1, 0.9))),
1.0.rand2)
}
) / (2*harmonics)
}.play;
)

(
{
var dur = 6, base, aenv, fenv, out, trig;
base = Rand(40, 100);
trig = SinOsc.ar(1/10);
out = Mix.fill(15,{
var thisDur;
thisDur = dur * rrand(0.5, 1.0);
aenv = EnvGen.kr(Env.perc(0, thisDur), trig);
fenv = EnvGen.kr(Env.new([0, 0, 1, 0], [0.25*thisDur, 0.75*thisDur, 0]), trig);
Pan2.ar(SinOsc.ar( Rand(base, base * 12) * LFNoise1.kr(10, mul: 0.02 * fenv, add: 1), // freq 
mul: aenv // amp
), ([1, -1].choose) * fenv)
}) * 0.05;
}.play(s);
{
var dur = 6, base, aenv, fenv, out, trig, detune;
base = Rand(40, 60);
detune = 0.1; // increase this number to detune the second bell
trig = SinOsc.ar(1/10, pi);
out = Mix.fill(15,
{ arg count;
var thisDur;
thisDur = dur * rrand(0.5, 1.0);
aenv = EnvGen.kr(Env.perc(0, thisDur), trig);
fenv = EnvGen.kr(Env.new([1, 1, 0, 1], [0.05*thisDur, 0.95*thisDur, 0]), trig);
Pan2.ar(SinOsc.ar( base*(count+1+ detune.rand) *
LFNoise1.kr(10, mul: 0.02 * fenv, add: 1), // freq
mul: aenv // amp
), ([1, -1].choose) * fenv)
}) * 0.05;
}.play(s);
)







Leave a Reply