## Bjorklund

2010-11-16 02:05

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' www-cgrl.cs.mcgill.ca/~godfried/publications/banff.pdf

Also, see ruinwesen.com/blog?id=216 for another implementation with some great demos. And Bjorn Westergard has a SuperCollider demo (archive.org).

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

(
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));
)

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
``````