«first  …12 13 14 15 16 17 18 last»

Tweets

2010-12-07 03:07 supercollider

clean-up #22:

Here are my best-of twitter tweets so far. See twitter.com/redFrik 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.

tweet0001

r{99.do{|i|x={Pan2.ar(SinOsc.ar(i+1,SinOsc.ar((i%9).div(3)*100+(i%9)+500),0.03),1.0.rand2)}.play;2.wait;x.release(25)}}.play//#SuperCollider

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.

tweet0006

r{loop{x={GVerb.ar(MoogFF.ar(ClipNoise.ar*0.4,LFPar.kr({0.3.rand}!2,0,600,990)),9,9,1)}.play(s,0,19);3.wait;x.release}}.play//#SuperCollider

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 most, there is 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.

tweet0014

play{a=SinOscFB;sum({|i|a.ar(a.ar(a.ar(a.ar(i+1,1/9,999),1/9,a.ar(1/9,1,1/9)),a.ar(0.1,3),i+2*999),a.ar(1/9,1/9),1/9)}!9)!2}//#SuperCollider

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 consists 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 character and subtle though deterministic variation in the details.

play{b=LocalBuf(9e4,2).clear;i=Sweep.ar(BufRd.ar(2,b,Saw.ar(12,3e4,4e4)),9e4);BufWr.ar(Saw.ar([8,9]),b,i);BufRd.ar(2,b,i)/2}//#SuperCollider
play{b=LocalBuf(8e4,2).clear;i=Sweep.ar(BufRd.ar(2,b,Saw.ar(3.1,4e4,4e4)),8e4);BufWr.ar(Blip.ar([2,3]),b,i);BufRd.ar(2,b,i)}//#SuperCollider
play{b=LocalBuf(5e3,2).clear;i=Sweep.ar(BufRd.ar(2,b,Saw.ar(50,2e3,5e3)),6e4);BufWr.ar(Saw.ar([4,3]),b,i);BufRd.ar(2,b,i)/6}//#SuperCollider
play{b=LocalBuf(1e4,2).clear;i=Sweep.ar(BufRd.ar(2,b,Saw.ar(1,2e3,5e3)),5e5);BufWr.ar(Saw.ar([8,50]),b,i);BufRd.ar(2,b,i)/3}//#SuperCollider

tweet0020

play{a=LFPulse;b=(1..4);Mix(a.ar(a.ar(a.ar(a.ar(b/32)+1/8)+1*b)+(Mix(a.ar(b/64))+a.ar(4/b)*(a.ar(a.ar(b/8))*2+b))*100))/8!2}//#SuperCollider

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.

tweet0021

r{{|j|a=play{sin(Decay.ar(Duty.ar(1/50,0,Dseq(flat({|i|asBinaryDigits(j+1*i)}!8),4),2),j+1*0.008))/2!2};5.12.wait}!256}.play//#SuperCollider

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.

tweet0024

{|j|r{{|i|x=sin(i/5+(j*5));Ndef(i%5+(j*5),{Pan2.ar(LFCub.ar(j*2+x*40+400+i)/15,i%5/2-1)}).play;wait(x.abs+0.5)}!500}.play}!5//#SuperCollider

Another tweet without any randomness. There are five parallel 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 jagged 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.


Klee

2010-12-06 03:45 supercollider

clean-up #21:

Attached is a Klee step-sequencer as a SuperCollider list-pattern class. The included help file 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

Updates:

  • 180101: added new help file
Attachments:
Pklee.zip

2 Max Ports

2010-12-05 03:56 supercollider

clean-up #20:

Here are two SuperCollider documents made years ago to resemble two MaxMSP patches by Katsuhiro Chiba. His patches are 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 SuperCollider. The Max4 patches are still available here along with some screenshots.

All credit for the attached code should go to Mr Chiba.

Updates:

  • 180101: changed file format from rtf to scd and confirmed it working under SC 3.9
Attachments:
autumn.scd
sev.scd

Alarm

2010-12-04 02:43 supercollider

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 also would be very tired. So I prepared my solo set (using redThermoKontroll) to be extremely simple and static in nature. Hardly any variation - only a couple of sounds sources (4 SuperCollider 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

2010-12-03 03:25 supercollider

clean-up #18:

I found more code I never published. Again it is about generating SynthDefs using genetic algorithms. See /f0blog/growing-sounds/ and /f0blog/work-with-mark-genetics/ for previous stories.

To run the attached files you will need to install my RedGA library from the /code/sc/#classes 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 multi-slider.

growing_sounds10 screenshot

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.

growing_soundsBreed screenshot

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

growing_soundsBreedFitness

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.

growing_soundsBreedPattern

As always, all code published under GNU GPL v2 license.

Updates:

  • 180101: changed file format from rtf to scd and confirmed it working under SC 3.9
Attachments:
growing_sounds10.scd
growing_soundsBreed.scd
growing_soundsBreedFitness.scd
growing_soundsBreedPattern.scd

Even More Low Life

2010-12-01 20:31 supercollider

clean-up #17:

This one also belongs to my family of low life audiovisual creatures.

The SuperCollider code attached below will only work on older OSX versions of SuperCollider (Cocoa, <3.6).

Attachments:
redSlug.scd

More Low Life

2010-12-01 15:55 supercollider

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 older OSX versions of SuperCollider (Cocoa, <3.6)

At 00:40 I start to type into the document. Mainly hitting the delete key as the system runs.

Attachments:
redEel.scd

hansm-bird

2010-11-30 03:56 supercollider

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

«first  …12 13 14 15 16 17 18 last»