redUniverse: l-system and turtle

now added RedLSystem and RedLTurtle to my redUniverse quark. RedLSystem is a fairly standard string rewrite class. one special feature is that it saves the structure/tree/recursion depth of the rewrite process. RedLTurtle either plot l-systems or standard strings. it comes with a set of default drawing functions, but you can easily add your own commands.

l= RedLSystem("F", ($F: "F[+F--F]+F"));{};
RedLTurtle(l, 40, 10, 0.9, 0.1).makeWindow;

l= RedLSystem("F", ($F: "|[-FFF--F]+F"));{};
RedLTurtle(l, 20, 20, 0.95, 0.2).makeWindow;

l= RedLSystem("F", ($F: "|[--F][+F]-F"));{};
RedLTurtle(l, 400, 20, 0.65, 0.1).makeWindow(initTranslate: Point(0.5, 0));

l= RedLSystem("F-F-F-F", ($F: "F[F]-F+F[--F]+F-F"));{};
RedLTurtle(l, 6, 90, 0.9).makeWindow(initTranslate: Point(1, 0));


custom wireless system built for craftwife. the leds are to be sewn into real ties. there are 6 red leds per slave and each led can be dynamically controlled (pwm 0-255). all slaves run on battery (AA 3.6v lithium) and keep in contact with the master using 2.4ghz wireless transceivers (nordic nRF24L01+). the maximum working distance is about ~80m (line of sight).
the master talks to supercollider via the RedTieMaster and RedTieSlave classes (usb-serial 115200 baud).

schematics, firmware, partlist and sc classes attached below (gnu gpl v2)



master and slaves...

leds on ribbon cable...

total cable length: 135cm
distance between leds: 4cm

redTie-hardwareWireless from redFrik on Vimeo.

Package icon redTie.zip76.62 KB

pact - april

april 2009, 30 days, 1hour/day. do something and show the result to your contracting party. similar to our previous live-coding practising sessions (aug2006 and jun2007). this time i battle marcus fjellström. follow his daily work here.

my rules are: on the last day of march, code a single synthdef in supercollider that i'll force myself to make music with all throughout the month. i'm not allowed to use any other synthdefs! if i need to change the synth definition during the 30 days, all the music written up to that point will be affected. these constraints are both quite strict and quite silly i know, but i imagine it'll help me focus my 1hour work on controlling the synth instead of rewriting the synthesis part all the time (bad habit). of course it is not the optimal way to make music in sc. normally one would opt for smaller synthdefs that do less and are interconnect via busses. see that as a warning and don't copy my synthdef below. it's a big ugly beast.

so here's first the synthdef. coded on march 31st...

//this is the synthdef that i must use for all 30 days
SynthDef(\redMond, {
        arg     out= 0, pan= 0, det= 0,
        atk= 0.01, rel= 0.1, cur= -4, gate= 1,
        amp= 1, freq= 440, sel= 0, selFreq= 40,
        amp2= 0, freq2= 40, sel2= 0, selFreq2= 40,
        amp3= 0, freq3= 40, sel3= 0, selFreq3= 40,
        ringMix= -1, ringFreq= 440, ringGain= 0, ringRate= 1,
        distMix= -1, distFreq= 0.4, distDeep= 1,
        combMix= -1, combFreq= 40, combDecy= 1,
        moogMix= -1, moogFreq= 440, moogGain= 1,
        verbMix= -1, verbRoom= 0.4, verbDamp= 0.4;
        var     iii, aaa, bbb, ccc, zzz,
        ii, aa, bb, cc, zz,
        i, a, b, c, z,
        det= det+1;                                                     //detune.  1= no detune
        iii=, [
      , 0, 1.5, 1.5),
      , 0, 1.5, 1.5),
      , 0, 0.3, 1.5, 1.5)
        aaa=, 0, amp3);
        bbb=*det, 0, amp3);
        ccc=*det*det, 0, 0.3, amp3);
        zzz=, [aaa, bbb, ccc]);
        ii=, [
      , 0, 1.5, 1.5),
      , 0, 1.5, 1.5),
      , 0, 0.4, 1.5, 1.5)
        aa=, 0, amp2);
        bb=*det, 0, amp2);
        cc=*det*det, 0, 0.4, amp2);
        zz=, [aa, bb, cc]);
        i=, [
      , 0, 1.5, 1.5),
      , 0, 1.5, 1.5),
      , 0, 0.5, 1.5, 1.5)
        z=, [a, b, c]);
        z=,, 0, ringGain), 0, z), ringMix);
        z=,, z*(1+(distDeep*(8pi-1))))*0.5, distMix);
        z=,, 1, combFreq.reciprocal, combDecy), combMix);
        z=,, moogFreq, moogGain), moogMix);
        z=, verbMix*0.5+0.5, verbRoom, verbDamp);
        e=, 1, rel, cur), gate, doneAction:2);,, pan, e*amp));

and here follows short mp3 excerpts. note: all the 30 files + synthdef can also be found the '' attached below.

update 171231: converted all files from .rtf to .scd and attached as a .zip

Package icon pact-apr09_scd.zip38.09 KB


this is my all-round master for wireless controllers like redUniform and redThermoKontroll. it's a rebuild of my previous redUniform-master. i generalised it, added some buttons, switches and leds and put it into a proper box. i also removed the on-chip ceramic antenna on the mirf transceiver and replaced it with a socket + a 4inch duck antenna. now the range of the system is much greater.
the buttons i will use either as additional controllers or as backup controllers if the slave fails during performance. the 4 leds are independently controlled and i imagine using them for visual feedback. usually i perform with the laptop hidden in the back and the laptop screen turned off. the leds will help to discretely show the status of the piece (form, section, sensor activity etc).

version3 firmware and schematics attached.

update100721: rewrote the firmware and changed a few things. also renamed the project. it was previously called redUniform2-master
update100724: added supercollider classes to the zip archive


i've finished another controller using the great v-usb from obdev. this version has 16 pushbuttons, 1 switch, 1 light sensor, 4 pots and 1 slider. just like the previous redKontroll it shows up like a standard HID devices and i have coded some simple max patches and supercollider classes to parse the data.

of the 16 buttons, 12 are arranged as a full octave on a piano (black&grey instead of white&black), divided into 2 groups (cde/fgab). the remaining 4 as additional buttons on top of each group to form small pyramids. all this to later make it easier to remember what functions i assigned to which button.

schematics, firmware, partslist and helper classes are available here.

the total cost is about €45 and the major part of that is the buttons and the pots (see partslist).

redinfo ugens

last night i wrote three simple ugens for supercollider. they read the sudden motion sensor, ambient light sensors and the battery capacity on portable mac laptops. download from this page. (mac os 10.5 and later).

RedInfoSms from redFrik on Vimeo.

RedInfoBat - read the battery's current capacity (perhaps use it as master tuning instead of 440? laptops are also instruments :-)
RedInfoLmu - read data from the left or right side ambient light sensors (low-pass filter master effect to match venue's mood-light :-)
RedInfoSms - read data from the apple sudden motion sensor (very sensitive 3d accelerometer. tap-tempo analysis while typing on the keyboard :-)

below is the code for the example in the video. it is basically a remake of cyrille henry's classic bouncing balls ( using my redUniverse quark.

note: new apple laptops with ssd do not use sudden motion sensor (the harddrive no longer have any moving parts). so this example will only work with older laptops from ~2010. (battery and light sensor ugens still work though)

//redFrik 090306, minor update 110804
        var width= 1000, height= 600, w, world, n= 30;
        var back="", Window.screenBounds, false, false);
        back.view.background=, 1);
        SynthDef(\suddenmotionsynth, {|out= 0, freq= 400, maxDur= 0.3, amp= 1, pan= 0|
                var e, z, freqs, amps, rings;
                freqs= Array.geom(4, freq, Rand(1.5, 2.5));
                amps= Array.geom(4, 0.5, Rand(0, 1));
                rings= Array.geom(4, maxDur, Rand(0, 1))*maxDur;
                e=, maxDur), 1, amp, doneAction:2);
                z=`[freqs, amps, rings],;
      ,*e, pan));
        SynthDef(\suddenmotionsensor, {|rate= 50|
                var trig=;
      , 'xyz',;
        w= RedWindow("RedInfo", Rect.aboutPoint(, width/2, height/2)).front;
        world= RedWorld3(RedVector2D[width, height], RedVector2D[0, 0.98], 25, 0.25);
                var loc= RedVector2D[width, height].rand;
                var mass= 0.5.rrand(2);
                RedObject(world, loc, 0, 0, mass, mass*10); //world,loc,vel,acc,mass,size
        OSCresponder(s.addr, 'xyz', {|t, r, m|
                //world.gravity= RedVector2D[m[3].neg*3, m[5]*5-4]; //some older macbooks have x inverted
                world.gravity= RedVector2D[m[3]*3, m[5]*5-4];
                Pen.fillColor=, 0.6);
                        var osize, freq, amp, pan;
                        if(world.contains(o).not, {
                                osize= o.mass.linexp(0.5, 2, 0.15, 1);
                                freq= osize.linexp(0.1, 1, 600, 400);
                                amp= o.vel.mag.linexp(0, 25, 0.01, osize);
                                pan= o.loc[0]/width*2-1;
                                if(amp>0.02, {
                                        Synth(\suddenmotionsynth, [\freq, freq, \maxDur, osize, \amp, amp, \pan, pan]);
                if(w.isClosed.not, {w.close});
                if(back.isClosed.not, {back.close})

no, i'm not responsible if you accidently drop your computer while using these.


soldering is such a nice relief from coding. for years i've had an old pc-joystick laying around (thank you abe). i knew i wanted to build something from it - something that would produce lovely noise - and yesterday i finally got around to hack it. the joystick now contains a slightly modified micro_noise synth circuit (based on a design by SGMK it also holds a 9v battery and the pc-connection cable now serves as sound output cable with standard 1/4 jack.

micro_noise_joy from redFrik on Vimeo.

i used the switches and potentiometers that the joystick had and it was very quick to build and cost me virtually nothing. i just cut some cables and soldered them onto a tiny circuit board together with a few components. see the schematics below. the only visible change is the jack output and a the led i mounted in the case.


this is a tiny project from about 1 year ago. i wanted to add extra ir-light for my dvcamera's nightshot mode. very useful when playing in dark and smoky clubs.
i bought 10 osram high power ir leds (SFH4550) and found 5 small resistors (47ohm). i run it off two 1,5v batteries
below a picture and the schematics.


Subscribe to f0blog RSS