supercollider

klee

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= LFSaw.kr(rate, 1, 0.5, 0.5)*list.size;
        var sum= (mul*Select.kr(i+(0..list.size-1)%list.size, list)).sum;
        var src= SinOsc.ar(freq+sum, 0, Decay2.kr(Impulse.kr(list.size*rate), 0.01, 0.1, 0.5));
        Out.ar(0, Pan2.ar(Mix(src)));
}).add;
)
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)
a.free

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= LFSaw.kr(rate, 1, 0.5, 0.5)*list.size;
        var sum= (mul*Select.kr(i+(0..list.size-1)%list.size, list)).sum;
        var src= SinOsc.ar(freq+sum, 0, Decay2.kr(Impulse.kr(list.size*rate), 0.01, 0.1, 0.5));
        Out.ar(0, Pan2.ar(Mix(src)));
}).add;
)
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)
a.free
AttachmentSize
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.

 


 


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

alarm

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
~num.do{|i|
        Ndef(("alarm"++i).asSymbol, {|amp= 0, lag= 5|
                var src= Pulse.ar(
                        ExpRand(300, 3000)+LFPulse.kr(ExpRand(3, 30), 0, Rand(0.4, 0.6), Rand(-100, 100)),
                        Rand(0.4, 0.6),
                        LFPulse.kr(LinRand(0.05, 2), 0, LinRand(0.1, 0.5), 0.5)
                );
                Pan2.ar(src, Rand(-0.95, 0.95), amp.lag(lag));
        });
};
Ndef.all;               //list them
)

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

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

 


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

{LFPar.ar(LFTri.kr(LFDNoise3.kr(0.836588, 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.

AttachmentSize
Binary Data redEel.scd636 bytes

hansm-bird

clean-up #15:

this birdcall synthesis tutorial by andy farnell i found very good when it was published. and as i wanted to learn more by synthetic bird songs i ported the pure-data patches. so here is a version of hansm-bird-control.pd for supercollider.

/*
hansm-bird-control.pd
http://obiwannabe.co.uk/tutorials/html/tutorial_birds.html
sc port by redFrik 080430
*/

s.boot;

(
SynthDef(\birdCall, {|
        out= 0, pan= 0, gate= 1, freq= 0, amp= 0.5, atk= 0.5, dcy= 0.5,
        fmod1= 1, atkf1= 0.5, dcyf1= 0.5,
        fmod2= 1, atkf2= 0.5, dcyf2= 0.5,
        amod1= 1, atka1= 0.5, dcya1= 0.5,
        amod2= 1, atka2= 0.5, dcya2= 0.5|
        var env, freq1, freq2, amp1, amp2, fmod, amod, z;
        env= EnvGen.ar(Env([0, amp, 0], [atk, dcy], -4), gate, timeScale:0.9, doneAction:2);
        freq1= EnvGen.ar(Env([0, fmod1, 0], [atkf1, dcyf1], -4), 1, 3000, 0, 0.9);
        freq2= EnvGen.ar(Env([0, fmod2, 0], [atkf2, dcyf2], -4), 1, 3000, 0, 0.9);
        amp1= EnvGen.ar(Env([0, amod1, 0], [atka1, dcya1], -4), 1, 1, 0, 0.9);
        amp2= EnvGen.ar(Env([0, amod2, 0], [atka2, dcya2], -4), 1, 1, 0, 0.9);
        fmod= SinOsc.ar(freq1, 0, amp1, 1);
        amod= 1-SinOsc.ar(freq2, 0, amp2);
        z= SinOsc.ar(freq*7000+300*fmod, 0, amod);
        Out.ar(out, Pan2.ar(z, pan, env));
}).add;
f= {|freq, atk, dcy, fmod1, atkf1, dcyf1, fmod2, atkf2, dcyf2, amod1, atka1, dcya1, amod2, atka2, dcya2|
        Synth(\birdCall, [\freq, freq, \atk, atk, \dcy, dcy,
                \fmod1, fmod1, \atkf1, atkf1, \dcyf1, dcyf1,
                \fmod2, fmod2, \atkf2, atkf2, \dcyf2, dcyf2,
                \amod1, amod1, \atka1, atka1, \dcya1, dcya1,
                \amod2, amod2, \atka2, atka2, \dcya2, dcya2]);
};
)
(
//triple-tailed-tree-troubler
f.value(0.387755, 0.0204082, 0.204082,
        0.367347, 0.571429, 0.734694,
        0.918367, 1, 0.77551,
        0.571429, 0.367347, 0.22449,
        0.0204082, 0.183673, 0.44898);
)
(
//speckled-throated-spew
f.value(0.183673, 0.591837, 0.387755,
        0.0104082, 0.530612, 0.346939,
        0.244898, 0.55102, 0.122449,
        0.387755, 1, 0.612245,
        0.346939, 0.816327, 0.653061);
)
(
//lesser-spotted-grinchwarbler
f.value(0.55102, 0.591837, 0.387755,
        0.0716327, 0.0204082, 0.346939,
        0.0204082, 0.55102, 0.122449,
        0.632653, 1, 0.612245,
        0.346939, 0.816327, 0.653061);
)
(
//long-toed-mudhopper
f.value(0.163265, 0.22449, 0.183673,
        0.00306122, 0.122449, 1,
        0.0612245, 1, 0.77551,
        0.979592, 0.204082, 0.734694,
        1, 0.142857, 0.612245);
)
(
//yellow-yiffled-yaffle
f.value(0.0204082, 0.367347, 0.183673,
        0.0612245, 0, 1,
        0.285714, 0.22449, 0.489796,
        0.367347, 0.387755, 0.734694,
        0.204082, 0.428571, 0.142857);
)
(
//pointy-beaked-beetlefiend
f.value(0.428571, 0.204082, 0.489796,
        0.0204082, 0.795918, 0.591837,
        0.285714, 0.22449, 0.489796,
        0.204082, 0.836735, 0.734694,
        0.77551, 0.428571, 0.142857);
)
(
//african-boojuboolubala
f.value(0.306122, 0.959184, 0.0408163,
        1, 0, 0.591837,
        0.285714, 0.22449, 0.489796,
        0.204082, 0.836735, 0.734694,
        0.77551, 0.428571, 0.142857
);
)
(
//common-muckoink
f.value(0.0204082, 0.8, 0.0816327,
        0.0204082, 0.001, 0.99,
        0.0204082, 0.01, 1,
        1, 0.142857, 0.734694,
        1, 0.0612245, 0.530612);
)

 


hamburg

clean-up #14:

here is a file from a short introduction to / demonstration of supercollider given at the hochschule für musik und theater hamburg, july 2009. it was all live-coded from scratch during my talk, but in the video above i just run through the lines one by one found in the file (attached).
i recorded this screencast and published the code to serve as an example for people new to and curious of supercollider. pardon the silly music.

the \asdf synth definition is a phase modulation synth with some random panning. \hh and \sn are both built by filtering noise and the \bd is a simple oscillator. all three definitions uses a percussive envelope.
all pdefs (the sequencers sort of) are set to use a quantise of 4. that means that any change i do in the sequencing code waits to kick in until the next bar (4/4, 60bpm).
at 01:35 i start live-coding some changes to the \bd bass drum. first changing the duration from a static 0.5 to a stream of numbers using the pseq. then i change the release time (hard to hear) and last i play with the frequencies. that might give an idea of how one can interact with code in supercollider and change the system as it is running.

AttachmentSize
File hamburg.rtf5.99 KB

Pages

Subscribe to RSS - supercollider