clean-up #23:

the screenshot below is of a simple little mac application i made in max/msp/jitter. it takes realtime input from a web or dv-camera, chops it into six regions and tracks activity in each of those regions separately. the result is sent over to supercollider via osc.

the analysis/tracking is just a simple average luminescence per frame. i.e. it takes the mean of all the red, green and blue values in one frame and then calculate the luma with (0.299*red)+(0.587*green)+(0.114*blue). the luma will be close to 0 for dark frames and close to 1 for very bright video frames.

to tune this system to produce maximal output, one should first make sure the camera sits still and has sufficient and stable light. then in the software there are colour, brightness and contrast controls to help get even better readings. (completely inverting all the colours might help in really dark places.)
the luma values (float 0.0-1.0) can be rounded off to nearest number and also smoothed out. this is often necessary to avoid flutter and noise. and most important - there is manual calibration of the luma values - either per region or globally.
to calibrate one should first empty the camera's view of any objects and then press the 'calibrate min' button in the lower left corner. then move some objects around to see what is the maximum reading. last put that number into the 'set max' numberbox. one can also calibrate each region separately with the min and max buttons next to the preview windows.

download the mac osx standalone from here.

and here is supercollider code to read the data and make some simple sounds out of it.

//to start: select all + enter
//to stop: cmd + .
n= 6;
s.latency= 0.05;
        var osc, dlast= 0.dup(n);
        d= {Bus.control(s, 1)}.dup(n);
        e= {Bus.control(s, 1)}.dup(n);
        osc= OSCresponder(nil, \anneVideoTracking, {|t, r, m|
                var index= m[1], val= m[2], diff= (val-dlast[index]).abs;
                dlast.put(index, val);
        SynthDef(\annetest, {
                var src= Mix({|i|*100+400, 0,[i].index), 0.01, 0.1))}.dup(n));


clean-up #22:

here are my best-of twitter tweets so far. see for the rest. with the hard limitation of 140 characters, it is really challenging to write a piece of supercollider code that fits and sounds good _and is interesting to listen to for more than a few seconds.




99 sine oscillators played one after the other with a two seconds interval. each oscillator lasts for 27 seconds. so the total duration is 99*2+27= 225 seconds. the oscillators are phase modulated with other sine oscillators with frequencies repeating in the number series: 500, 501, 502, 603, 604, 605, 706, 707, 708. the base frequencies of the 99 carrier oscillators slowly raise by one hertz from 1 to 99. the only random thing is the stereo panning position for each oscillator.




a clip noise generator runs through a moog filter and then a reverb. every third second there is a new noise added and each noise lasts for 22 seconds. each moog filter has two unique parabolic lfos that runs at a random rate between 0 and 0.3 hertz - each in one channel. at the most there are 8 number of overlapping noises playing at the same time. as there are so many reverbs playing here at once one needs to allocate more memory to sc server. something like this... Server.local.options.memSize= 32768; and then reboot the localhost server.




this one is completely deterministic although it is hard to believe when hearing it. a lot of nested feedbacking sine oscillators. nine parallel oscillators are mixed down to 1 and duplicated in left and right channels. each of the nine oscillators is frequency and feedback modulated but have a static amplitude of 1/9. the frequency modulator consist of yet more modulated feedbacking sine oscillators, while the feedback of the outer is only modulated with a single feedbacking sine oscillator running at 0.1 hertz. all in all there are 109 unit generators in total running in this tweet and it peaks at about 9.3% of my computer's cpu.


//--tweet0016 - tweet0019
these four all work the same way. they only differ in buffer size and what kind of oscillator is used for reading back samples from the buffer. there is not much progress over longer time but they do have characted and subtle though deterministic variation in the details.












this tweet is also totally deterministic and without any randomness. here a lot of nested square wave oscillators creates the complexity. basically there are 4 channels/voices mixed down to one and then duplicated in left and right channel. there are three levels deep nesting of frequency modulation with another set of square waves mixed and added.




binary numbers from 0 to 255 form the rhythmic patterns in this tweet. each number first repeats 8 times - each time all the bits are shifted one position to the left. that creates an array of 64 ones and zeros. this array is then repeated four times. this is what makes it sound like a 4 x 4/4 bar theme (i.e. 4 bars per number). the total 64*4*256 binary digits are played in sequence and each digit lasts for 1/50th of a second. the total duration becomes 64*4*256/50= 1310.72 seconds. the sound is generated by the ones and the zeros directly. there is an exponential decay for these flipflop pulses that slowly increases throughout the 256 numbers. it starts with a decay time of 0.008 seconds and ends with 2.04 seconds. in the mp3 below only the numbers 0-31 are played.




another tweet without any randomness. there are five paralles routines and all do something 500 times. what they do is to define or redefine a node proxy. there are 25 proxies in total and each one contains a sine shaped oscillator panned to one out of four positions in the stereo field. the frequencies are climbing upwards in a slightly jaggered curve. the exact length is a bit complicated to calculate but it is around 575 seconds. in the end the proxies do not stop to play but just keeps the last assigned frequency and the whole soundscape becomes static.


clean-up #21:

attached is a klee step-sequencer as a supercollider list-pattern class. the included helpfile should explain how it works.

there are a couple of ways to make a klee sequencer on the server side as well. in the below examples i used argument lists, but one can also do it using buffers together with the index ugen.

SynthDef(\klee8, {|freq= 400, rate= 0.5,
                list= #[0, 0, 0, 0, 0, 0, 0, 0],
                mul= #[0, 0, 0, 0, 0, 0, 0, 0]|
        var i=, 1, 0.5, 0.5)*list.size;
        var sum= (mul*, list)).sum;
        var src=, 0,*rate), 0.01, 0.1, 0.5));,;
a= Synth(\klee8)
a.set(\list, #[4, 0, 0, 2, 0, 0, 0, 0]*100)     //set the values
a.set(\mul, #[1, 0, 0, 0, 0, 0, 0, 0])          //activate 1 read head
a.set(\mul, #[1, 1, 0, 0, 0, 0, 0, 0])          //activate 2 read heads
a.set(\mul, #[1, 1, 1, 0, 0, 0, 0, 0])
a.set(\mul, #[1, 1, 1, 1, 0, 0, 0, 0])

a.set(\mul, #[1, 0.5, 0.25, 0, 0, 0, 0, 0])
a.set(\list, #[4, 0, -4, 2, 0, 0, 0, 0]*100)
a.set(\freq, 500)
a.set(\rate, 1.5)

and similar but with 16 steps. it is only to change the number of zeros in list and mul arguments.

SynthDef(\klee16, {|freq= 400, rate= 0.5,
                list= #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                mul= #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]|
        var i=, 1, 0.5, 0.5)*list.size;
        var sum= (mul*, list)).sum;
        var src=, 0,*rate), 0.01, 0.1, 0.5));,;
a= Synth(\klee16)
a.set(\list, #[4, 0, 0, 2, 0, 0, 0, 0, 3, 0, 0, 2, 0, 0, 0, 0]*100)     //set the values
a.set(\mul, #[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])          //activate 1 read head
a.set(\mul, #[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0])          //activate 2 read heads
a.set(\mul, #[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0.25, 0, 0, 0, 0, 0])
a.set(\list, #[4, 0, -4, 2, 0, 0, 0, 0, 3, 0, -3, 2, 0, 0, 0, 0]*100)
a.set(\freq, 500)
a.set(\rate, 1.5)
Package icon Pklee.zip3 KB

2 max ports

clean-up #20:

here are two supercollider documents made years ago to resemble two max/msp patches by katsuhiro chiba. his patches are really wonderfully constructed with playful and nice gui design plus they sounded good to me. so i was curious how he made them and to learn more i ported parts of his code to sc. the max4 patches are still available here along with some screenshots.
all credit for the attached code should go to mr chiba.



File autumn.rtf8.93 KB
File sev.rtf4.27 KB


clean-up #19:

there was a sleeping-bag concert as part of the sound of stockholm festival this year. music for sleeping - what a great concept!
first i was assigned to play last and would thereby have had the honour/responsibility of waking everybody up for breakfast at 7:00 in the morning. both fun and daunting. how to let your audience sleep in as long as possible and then wake them up gently but firmly?
i assumed most people would be asleep when it was my turn and that i myself also would be very tired. so i prepared my solo set (using redThermoKontroll) to be extremely simple and static in nature. hardly no variation - only a couple of sounds sources (4 sc patches i think it was) with looong transitions between settings that i could control manually.
then there was the waking up part and for that i wrote the very simple sounding code below. it starts slowly with one little alarm going off. then a second alarm, then more and more until complete chaos. i made it so that this patch could be mixed in with my drones and with separate control over volume.
unfortunately when i got to stockholm they had changed the playing order and i did do my performance around midnight instead. and i never set the alarms off.

//--set alarms
~num= 25;                       //number of alarms
~fadeTime= 10;          //fade in time in seconds{|i|
        Ndef(("alarm"++i).asSymbol, {|amp= 0, lag= 5|
                var src=
                        ExpRand(300, 3000), 30), 0, Rand(0.4, 0.6), Rand(-100, 100)),
                        Rand(0.4, 0.6),
              , 2), 0, LinRand(0.1, 0.5), 0.5)
      , Rand(-0.95, 0.95), amp.lag(lag));
Ndef.all;               //list them

//--start alarms
~task= Task({{|i|
                Ndef(("alarm"++i).asSymbol).play(fadeTime: ~fadeTime).set(\amp, 7/~num).postln;
                i.linlin(0, ~num-1, ~fadeTime*2, ~fadeTime/2).wait;

//--stop alarms
~task= Task({{|i|
                Ndef(("alarm"++i).asSymbol).stop(fadeTime: 1/~fadeTime);
                i.linlin(0, ~num-1, 1/~fadeTime, 10/~fadeTime).wait;


growing more sounds

clean-up #18:

i found more code i never published. again it is about generating synthdefs using genetic algorithms. see here and here for previous stories.
and to run the attached files you will need to install my RedGA library from this page.

first is a little exploration tool called growing_sounds10. it makes a single synthdef from the settings of a multi slider. draw something and press space to generate and play the synthdef. if you like what you hear you can copy the code from the post window and refine it manually.
also try the preset functions. they will either generate, modify or set a fixed setting/drawing in the multislider.

the synthdef generated in the screenshot above was this one...

{, 0.257632, 0.772292).exprange(3.7376802825928, 15.120258769989)).exprange(11935.654205322, 5408.6393985748)).range(0.31427707672119, -0.23100700378418)}.play

another file is called growing_soundsBreed and it gives you control over 6 parent genomes that can be transformed into synthdefs and listened to by clicking the play buttons. mark good sounding parents and breed a new generation. the genomes should now have been mixed and mutated and there are 6 new children as a result of the operation. it is likely that they sound similar to their parents and the longer you repeat the process, the more similar the genomes and in turn the synthdefs (phenomes) will be.

yet another piece of code is growing_soundsBreedFitness and it works the same way as the previous except that you here give a rating i.e. a fitness to each parent. (blue sliders = fitness amount). so instead of marking which parents you give ratings. the system will use these ratings as a guideline of importance when choosing which parents' genes to use for the new generation.

and last is a file called growing_soundsBreedPattern in which you can not only breed synthdefs but also the amplitude pattern they play in a simple sequencer.

as always, all code published under gnu gpl v2 license.

more low life

clean-up #16:

here is another piece of self-referential code. it belongs to my family of low life audiovisual creatures.
supercollider document attached below. it will only work on osx i believe.
at 00:40 i start to type into the document. mainly hitting the delete key as the system runs.

Binary Data redEel.scd636 bytes


Subscribe to RSS - supercollider