bjorklund

clean-up #1:
two supercollider classes i wrote long ago (nov 2008) after a technique described by Godfried Toussaint in his paper 'The Euclidean Algorithm Generates Traditional Musical Rhythms' http://www-cgrl.cs.mcgill.ca/~godfried/publications/banff.pdf
also see http://ruinwesen.com/blog?id=216 for another implementation with some great demos. and Bjorn Westergard has a sc demo here.

lots of typical patterns in say techno music can be described like this using only two numbers (relation).

Bjorklund is now available as a supercollider quark. install it via the following commands...

Quarks.install("Bjorklund");
//and recompile

below is some example supercollider code with resulting output as mp3. the hihat plays a 9/16 rhythm throughout and the snare plays 3 different ones... 5/8, 15/16 and 3/8.

s.boot
a= Buffer.read(s, "sounds/Free_CR68/CR68_BD_B_03.wav")
b= Buffer.read(s, "sounds/Free_CR68/CR68_SD_B1.wav")
c= Buffer.read(s, "sounds/Free_CR68/CR68_hh_02.wav")

(
SynthDef(\oneshotMono, {|out= 0, amp= 0.1, pan= 0, rate= 1, buffer|
        var src= PlayBuf.ar(1, buffer, rate*BufRateScale.ir(buffer), doneAction:2);
        Out.ar(out, Pan2.ar(src, pan, amp));
}).add;
)

d= TempoClock(120/60)
Pdef(\bd).play(d, quant:4)
Pdef(\hh).play(d, quant:4)
Pdef(\sd).play(d, quant:4)
Pdef(\bd, Pbind(\instrument, \oneshotMono, \buffer, a, \dur, 1.00, \amp, 0.7))
Pdef(\hh, Pbind(\instrument, \oneshotMono, \buffer, c, \dur, 0.25, \amp, Pbjorklund(9, 16, inf)*0.7, \pan, Pbrown(-1, 1, 0.2, inf)))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(5, 8, inf)*0.3))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(15, 16, inf)*0.3))
Pdef(\sd, Pbind(\instrument, \oneshotMono, \buffer, b, \dur, 0.25, \amp, Pbjorklund(3, 8, inf)*0.3))
Pdef(\bd).stop
Pdef(\sd).stop
Pdef(\hh).stop


update 110316: adapted Pbjorklund to also take patterns as arguments.
update 110320: made a quark out of it