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'
also see 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...

//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.

a=, "sounds/Free_CR68/CR68_BD_B_03.wav")
b=, "sounds/Free_CR68/CR68_SD_B1.wav")
c=, "sounds/Free_CR68/CR68_hh_02.wav")

SynthDef(\oneshotMono, {|out= 0, amp= 0.1, pan= 0, rate= 1, buffer|
        var src=, buffer, rate*, doneAction:2);,, 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))

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

OpenObject tutorials

7 short screencasts with code examples showing how to connect supercollider with max/pd/processing (etc) using the openobject quark.
download the example code here...

to run all the examples you will need supercollider, processing (with the oscP5 library), maxmsp and puredata.

install OpenObject from within supercollider with Quarks.install("OpenObject");

these screencasts were made at the 10days of SuperCollider network music workshop at subnet, salzburg, october 2009.

openobject quark by julian rohrhuber, tutorials by fredrik olofsson, voiceover and support by max kickinger.

thanks to

OpenObject overview from redFrik on Vimeo.

OpenObject 00 maxmsp from redFrik on Vimeo.

OpenObject 01 maxmsp from redFrik on Vimeo.

OpenObject 02 maxmsp from redFrik on Vimeo.

OpenObject 03 puredata from redFrik on Vimeo.

OpenObject 04 puredata from redFrik on Vimeo.

OpenObject 05 processing from redFrik on Vimeo.

update 150316: uploaded the code here below and made it compatible with sc3.6. thanks to edN for noticing.
update 180101: updated the pd examples to use pd vanilla instead of pd extended

Package icon openobject_demos.zip36.77 KB


just a listing of some of the supercollider code i've published on the swiki. much is old but still fully functional and hopefully useful. - 3d extensions for the Pen class. vector and matrix multiplication. - 1d cellular automata pattern. - livecoding practice sessions. - more livecoding practice sessions. - tempo clock synchronisation and beat matching. - some drawings. - examples ported from nodebox. - examples ported from processing. - quicklauncher folder gui. - hacked server windows. - a silly drummachine. - port of particle chamber by derek holzer. - examples ported from form+code.

klipp av logo

some supercollider code to generate old school klipp av logos.

click the window in the sc code to generate new pictures.

        var width= 800, height= 600;
        var win, usr, p0, p1, l= 50, w= 10, h= 15, c= 0.9, o= 0.1;
        win= Window("nystan", Rect(128, 64, width, height), false);
        usr= UserView(win, Rect(0, 0, width, height));
        usr.mouseDownAction= {usr.refresh};
        usr.background= Color.new255(51, 47, 57);
        usr.drawFunc= {
                Pen.translate(width*0.5, height*0.5);
                        var p, pp1, len;
                        p0= Point(0, 0);
                        p1= Point(0, h.rand*10.linrand);
                        pp1= p1;
                                len= l+l.rand2;
                                Pen.color= Color(c, c, c.rrand(1.0), (1-c).rrand(1.0));
                                if(o.coin, {
                                        p= 200.rand;
                                        p0= p0+p;
                                        p1= p1+p;
                                }, {
                                        p0= p0+Point(len+w.rand2, h.rand);
                                        p1= p1+Point(len+w.rand2, h.rand);
                        Pen.lineTo(Point(0, 0));
        CmdPeriod.doOnce({if(win.isClosed.not, {win.close})});

sunday drawings

2006 i fiddled with some simple drawing routines in sc. ( now i've added matching (?) sound synthesis and some slight modifications to the drawing code. there are 7 parameters that are used to both generate the picture and the sound. normally the parameters are randomised but it is possible to copy&paste a good sounding/looking set of parameters into the code to get the same drawing back.

below is the new code + embedded vimeos.

s.latency= 0.05;
        var width= 640, height= 480, w, u, drawFunc, clearFunc;
        var fadeAtk= 1400, fadeSus= 700, fadeRel= 350;
        var a, b, c, d, e, f, g, i= 0, theta= 0;
        var syn= SynthDef(\sunday, {|amp= 0, a= 1, b= 1, c= 1, d= 1, e= 1, f= 1, g= 1|
                var z0= Mix([a, b]), a+b, e, amp));
                var z1=,, c.abs, f, 2pi), amp);
                var z2=,, d.abs, g, 2pi), amp);
      ,, 0, 0.3), -0.3, 0.3), 0.3, 0.3));
        w= Window("sunday drawings2", Rect(128, 64, width, height), false);
        drawFunc= {
                var x, y;
                if(i==0, {
                                \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g
                        ].pairsDo{|m, n| (""++m++"="+n++";").postln};
                if(i<fadeAtk, {
                        theta= theta+(d*e*f);
                        x= sin(theta*a%a/b*c*2pi);
                        y= sin(theta*b%b/a*d*2pi);
                        Pen.strokeColor= Color.grey(1, 0.5);
                        Pen.translate(width*0.5, height*0.5);
                        Pen.scale(f, g);
                                0, {Pen.strokeOval(Rect.aboutPoint(Point(x*100, y*100), a, b))},
                                1, {Pen.strokeRect(Rect.aboutPoint(Point(x*100, y*100), a, b))},
                                2, {Pen.line(Point(x*100, y*100), Point(a*c*100, b*d*100)); Pen.stroke}
                        syn.set(\amp, i/fadeAtk, \a, a, \b, b, \c, c, \d, d, \e, e, \f, f, \g, g);
                if(i>(fadeAtk+fadeSus), {
                        theta= 0;
                        Pen.fillColor= Color.grey(0, 5/fadeRel);
                        Pen.fillRect(Rect(0, 0, width, height));
                        syn.set(\amp, i.linexp(fadeAtk+fadeSus, fadeAtk+fadeSus+fadeRel, 1, 0.0001));
                if(i==(fadeAtk+fadeSus+fadeRel), {
                        i= 0;
                }, {
                        i= i+1;
        clearFunc= {
                //--replace with preset from here
                a= 200.rand+1;
                b= 200.rand+1;
                c= 3.0.rand2;
                d= 3.0.rand2;
                e= 3.0.rand;
                f= 0.1.rrand(1.5)*#[1, -1].choose;
                g= 0.1.rrand(1.5)*#[1, -1].choose;
                //--to here
        u= UserView(w, Rect(0, 0, width, height))
        u.animate= true;
        CmdPeriod.doOnce({if(w.isClosed.not, {w.close})});
        w.onClose= {};

sc140 - the sctweets album

i'm proud to have contributed with one short track on the just released CC BY-NC-SA 3 licensed album sc140. download/listen here. it is compiled by dan stowell and consists of 22 tracks with corresponding supercollider source code. the thing with this project is that all the tracks are written to fit within the twitter limitation of 140 characters. read the source code here

reference: 140 character examples

intel vs ppc

something i knew all along but tried to ignore: many of my noisier synths sounds like crap on modern (intel) macintoshes and some even goes all silent. the code below deliberately blows up a resonant hipass filter and is typical for how different the same code can sound on my intel vs my ppc mac. listen to the attached mp3 files. in a few years all the ppc computers will be gone and we can't recreate the sounds.

//punk (loud!)

update 090811: thanks to batuhan bozkurt for putting me straight. it's not an intel vs ppc issue but rather apple changed something in their internal soundcards. using a newer (intel) machine and an external soundcard (fireface 400), the punk code sounds the same as the ppc version below (ie good/better in my ears - no autocompression).
so the internal soundcard in my old powerbook (1ghz, ppc) is robust, filters hardly ever blows up and it doesn't have that automatic compressor/limiter as my newer macbook pro (2.16ghz duo, intel) internal soundcard.

update 180101: with GlitchRHPF from sc3-plugins and some clipping one can get the original sound back...

Audio icon punk_intel.mp3759.55 KB
Audio icon punk_ppc.mp31.48 MB


livecoding via sms anyone? an expensive and annoyingly hard hobby for sure.
but the RedPDU supercollider class makes this possible in any case. it can decode mobile phone text messages in the pdu format. and with a serial connection to your phone (bluetooth or cable), it is easy to directly download incoming sms from your phone into supercollider and interpret them. no additional hardware required.
the class is available here. (there is also a mxj java version for max/msp called f0.pdu here)

and here's a short demo video where i send a short message to myself...

RedPDU from redFrik on Vimeo.

the code i texted in this video was...

Pbind('degree', Pn(Pseries(0, 2, 5), 4), 'dur', 0.1, 'amp', 0.5).play

and the sc receiver function is in the helpfile. but note: on many phones it is impossible to type characters like {} [] \ | etc. you might want to add some find&replace functionality and use <> meaning curly brackets etc.

update: i believe sms pdu isn't in use much any more so this will only work with old (mid-2000) phones.


Subscribe to RSS - supercollider