After an algorithm by E. Bjorklund. See paper by Godfried Toussaint.
| k |
The number of 'hits'. |
| n |
The total sum of all the durations in the array. |
| length |
Number of repeats. |
| offset |
Skip at start. |
a= Pbjorklund2(3, 8, 1).asStream;
4.do{a.next.postln};
(
s.waitForBoot{
SynthDef(\hh, {|amp= 1, rel= 0.05|
var e= EnvGen.ar(Env.perc(0, rel, amp, -10), doneAction:2);
var z= WhiteNoise.ar(e);
z= BPF.ar(z, 5000, 0.4);
Out.ar(0, Pan2.ar(z, 0, 1.5));
}).add;
SynthDef(\bz, {|amp= 1, rel= 0.25, freq= 400|
var e= EnvGen.ar(Env.perc(0.01, rel, amp), doneAction:2);
var z= BPF.ar(Blip.ar(e+1*(freq*0.1), 3), freq*2, 0.1, amp*10*e);
Out.ar(0, Pan2.ar(z, 0));
}).add;
SynthDef(\bd, {|amp= 1, rel= 0.1|
var e= EnvGen.ar(Env.perc(0, rel, amp, -10), doneAction:2);
var z= Mix(SinOsc.ar(#[150, 160, 170], 0, e*0.4));
Out.ar(0, Pan2.ar(z, 0));
}).add;
};
)
c= TempoClock(114/60);
Pdef(\bd).play(c, quant:4)
Pdef(\bz).play(c, quant:4)
Pdef(\hh).play(c, quant:4)
Pdef(\bd, Pbind(\instrument, \bd, \amp, 1))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(3, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(4, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(5, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(6, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(7, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(8, 8, inf)/2, \degree, Pseq(#[0, 4], inf)))
Pdef(\hh, Pbind(\instrument, \hh, \amp, 0.5, \dur, Pbjorklund2(3, 8, inf)/4))
Pdef(\hh, Pbind(\instrument, \hh, \amp, 0.5, \dur, Pbjorklund2(5, 8, inf)/4))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(3, 8, inf)/4, \degree, Pseq(#[0, 4, 1], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(5, 16, inf)/4, \degree, Pseq(#[0, 4, 1], inf)))
Pdef(\hh, Pbind(\instrument, \hh, \amp, 0.5, \dur, Pbjorklund2(9, 16, inf)/4))
Pdef(\hh, Pbind(\instrument, \hh, \amp, 0.5, \dur, Pbjorklund2(17, 32, inf)/4))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(11, 32, inf)/4, \degree, Pseq(#[0, 4, 1], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(5, 32, inf)/4, \degree, Pseq(#[0, 1, 2, 3, 4, 5, 6, 7], inf)))
Pdef(\hh, Pbind(\instrument, \hh, \amp, 0.5, \dur, Pbjorklund2(8, 32, inf)/4))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(15, 32, inf)/4, \degree, Pseq(#[0, 1, 2, 3, 4, 5, 6, 7], inf)))
Pdef(\bz, Pbind(\instrument, \bz, \amp, 1, \dur, Pbjorklund2(Pseq([8, 6, 8, 5, 8, 3, 8, 1], inf), 32, inf)/8, \degree, Pseq(#[0, 1, 2, 3, 4, 5, 6, 7], inf)))
Pdef(\bd).stop
Pdef(\hh).stop
Pdef(\bz).stop