supercollider

harmonicism

clean-up: #50

found more old supercollider code laying around... this little lambdoma experiment was based on this Cymatic Music video.

//--8x8 lambdoma matrix
a= [
        1/1, 2/1, 3/1, 4/1, 5/1, 6/1, 7/1, 8/1,
       
        1/2, 2/2, 3/2, 4/2, 5/2, 6/2, 7/2, 8/2,
       
        1/3, 2/3, 3/3, 4/3, 5/3, 6/3, 7/3, 8/3,
       
        1/4, 2/4, 3/4, 4/4, 5/4, 6/4, 7/4, 8/4,
       
        1/5, 2/5, 3/5, 4/5, 5/5, 6/5, 7/5, 8/5,
       
        1/6, 2/6, 3/6, 4/6, 5/6, 6/6, 7/6, 8/6,
       
        1/7, 2/7, 3/7, 4/7, 5/7, 6/7, 7/7, 8/7,
       
        1/8, 2/8, 3/8, 4/8, 5/8, 6/8, 7/8, 8/8
];

//--simplified
a= {|x| {|y| y+1/(x+1)}.dup(8)}.dup(8).flat;

s.boot
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((0,1..7)))).play
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((0,8..63)))).play
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((8,9..15)))).play
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((32,33..39)))).play
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((48,49..55)))).play
Pbind(\dur, 0.25, \freq, 60.midicps*Pseq(a.at((56,57..63)))).play

Pbind(\dur, 0.125, \freq, 60.midicps*Pseq(a)).play

//--16x16 lambdoma matrix
b= {|x| {|y| y+1/(x+1)}.dup(16)}.dup(16).flat;
Pbind(\dur, 0.125, \freq, 60.midicps*Pseq(b)).play

chipwave

clean-up: #48

here's an old port i did of a pure data patch called chipwave by Phill Phelps.
also see the updated pd version Dan Wilcox made: rc-patches

//after http://www.zenpho.co.uk/chipwave.shtml

s.boot
(
SynthDef(\ioscs, {|out= 0, amp= 0.5, freq= 400, width= 0.25, gate= 1, atk= 0.002, dec= 0, sus= 1, rel= 0.2, ws= #[0, 2, 2, 3, 2, 2, 2, 2, 2], ps= #[0, 12, -12, 0, 7, 0, 7, 0, 7]|
        var e= EnvGen.ar(Env.adsr(atk, dec, sus, rel), gate, amp, doneAction:2);
        var w= Duty.ar(0.025, 0, Dseq(ws));
        var p= Duty.ar(0.025, 0, Dseq(ps));
        var f= freq*p.midiratio;
        var ti= LFTri.ar(f, 0, 0.5, 0.5);
        var sq= LFPulse.ar(f, 0, width*0.5, 2, -1);
        var ns= LFNoise0.ar(f*10);
        var z= Select.ar(w, [DC.ar(0), ti, sq, ns]);
        Out.ar(out, LeakDC.ar(z*e));
}).add;
)

//arp
a= Synth(\ioscs, [\freq, 60.midicps, \amp, 0.5, \width, 0.5]).setn(\ws, #[0, 2, 2, 3, 2, 2, 2, 2, 2], \ps, #[0, 12, -12, 0, 7, 0, 7, 0, 7])
a.release
a= Pbind(\instrument, \ioscs, \midinote, Pseq([60, 60, 70, 60, 65, 63], inf), \amp, 0.5, \dur, 0.25, \width, Pseg(Pseq([0, 1], inf), 5)).play
a.stop

//kick
a= Synth(\ioscs, [\freq, 60.midicps, \amp, 1, \atk, 0.002, \dec, 0, \sus, 1, \rel, 0.3, \width, 0.5]).setn(\ws, #[0, 3, 2, 2, 2, 2, 2, 2, 2], \ps, #[0, 18, -12, 0, 0, -6, -12, -24, -48])
a.release
a= Pbind(\instrument, \ioscs, \midinote, Pseq([40, 48], inf), \amp, 0.5, \rel, 0.3, \legato, 0.3, \dur, 0.5, \width, 0.5, \ws, #[[0, 3, 2, 2, 2, 2, 2, 2, 2]], \ps, #[[0, 18, -12, 0, 0, -6, -12, -24, -48]]).play
a.stop

//snare
a= Synth(\ioscs, [\freq, 60.midicps, \amp, 1, \atk, 0.002, \dec, 0, \sus, 1, \rel, 0.3, \width, 0.5]).setn(\ws, #[0, 3, 2, 3, 3, 3, 3, 3, 3], \ps, #[0, 18, 0, 3, 12, 18, 24, 36, 36])
a.release
a= Pbind(\instrument, \ioscs, \midinote, 70, \amp, Pseq([0, 0.5, 0, 0.25], inf), \rel, 0.3, \dur, 0.5, \width, 0.5, \ws, #[[0, 3, 2, 3, 3, 3, 3, 3, 3]], \ps, #[[0, 18, 0, 3, 12, 18, 24, 36, 36]]).play
a.stop

//bass
a= Synth(\ioscs, [\freq, 60.midicps, \amp, 1, \atk, 0.002, \dec, 0, \sus, 1, \rel, 0.3, \width, 0.5]).setn(\ws, #[0, 1, 1, 1, 1, 1, 1, 1, 1], \ps, #[0, 24, 0, 12, 0, -1, 1, -1, 0])
a.release
a= Pbind(\instrument, \ioscs, \midinote, Pseq([40, 48, 48, 60], inf), \amp, 0.5, \rel, 0.3, \dur, 0.25, \width, 0.5, \ws, #[[0, 1, 1, 1, 1, 1, 1, 1, 1]], \ps, #[[0, 24, 0, 12, 0, -1, 1, -1, 0]]).play
a.stop

(
Ppar([
        Pbind(\instrument, \ioscs, \amp, 0.5, \midinote, Pseq([64, 66, 52], inf), \dur, 0.25),
        Pbind(\instrument, \ioscs, \amp, 0.5, \midinote, Pseq([60, 70], inf), \dur, 0.5),
        Pbind(\instrument, \ioscs, \amp, 0.5, \midinote, 100, \dur, 1/3)
]).play;
)

feedback synths

clean-up: #47

today i found some old code in my supercollider folder that i thought i'd clean up and publish.
experiments in audio feedback.

s.boot

(
SynthDef(\feedback1, {|freq= 400, amp= 0.1|
        var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
        var lin= LocalIn.ar(1);
        var src= SinOsc.ar(freq, lin*2pi, amp*env);
        LocalOut.ar(src);
        Out.ar(0, Pan2.ar(src));
}).add;
)
Synth(\feedback1)
Synth(\feedback1, [\freq, 300])
Synth(\feedback1, [\freq, 300, \amp, 0.255])

(
SynthDef(\feedback2, {|freq= 400, amp= 0.1, fb= 2, del= 0.1|
        var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
        var lin= DelayN.ar(LocalIn.ar(1), 1, del);
        var src= SinOsc.ar(freq, lin*2pi*fb, amp)*env;
        LocalOut.ar(src);
        Out.ar(0, Pan2.ar(src));
}).add;
)
Synth(\feedback2)
Synth(\feedback2, [\del, 0.5])
Synth(\feedback2, [\del, 0.01])
Synth(\feedback2, [\del, 0.01, \fb, 3])
Synth(\feedback2, [\freq, 300, \del, 0.1, \fb, 2.5])

(
SynthDef(\feedback3, {|freq= 400, amp= 0.1, fb= 2, del= 0.1, lfo= 1, rate= 2|
        var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
        var lin= DelayN.ar(LocalIn.ar(1), 1, del);
        var src= SinOsc.ar(freq+SinOsc.ar(rate, 0, lfo), lin*2pi*fb, amp)*env;
        LocalOut.ar(src);
        Out.ar(0, Pan2.ar(src));
}).add;
)
Synth(\feedback3)
Synth(\feedback3, [\del, 0.5])
Synth(\feedback3, [\del, 0.01])
Synth(\feedback3, [\del, 0.01, \fb, 3])
Synth(\feedback3, [\del, 0.01, \fb, 2, \lfo, 15])
Synth(\feedback3, [\del, 0.01, \fb, 3, \lfo, 100, \freq, 100])
Synth(\feedback3, [\del, 0.02, \fb, 3, \lfo, 100, \freq, 100])
Synth(\feedback3, [\del, 0.5, \fb, 201, \lfo, 200, \freq, 200, \rate, 202])
Synth(\feedback3, [\del, 0.5, \fb, 1, \lfo, 200, \freq, 300, \rate, 0.01])

(
SynthDef(\feedback4, {|freq= 400, amp= 0.1, fb= 2, del= 0.1, lfo= 1, rate= 2, cutoff= 500|
        var env= EnvGen.kr(Env.perc(1, 4), doneAction:2);
        var lin= DelayN.ar(HPF.ar(LocalIn.ar(1), cutoff), 1, del);
        var src= SinOsc.ar(freq+SinOsc.ar(rate, 0, lfo), lin*2pi*fb, amp)*env;
        LocalOut.ar(src);
        Out.ar(0, Pan2.ar(src));
}).add;
)
Synth(\feedback4)
Synth(\feedback4, [\del, 0.5])
Synth(\feedback4, [\del, 0.01, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 3, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 2, \lfo, 15, \cutoff, 100])
Synth(\feedback4, [\del, 0.01, \fb, 3, \lfo, 100, \freq, 100, \cutoff, 100])
Synth(\feedback4, [\del, 0.02, \fb, 3, \lfo, 100, \freq, 100, \cutoff, 100])
Synth(\feedback4, [\del, 0.5, \fb, 201, \lfo, 200, \freq, 200, \rate, 202, \cutoff, 100])
Synth(\feedback4, [\del, 0.5, \fb, 1, \lfo, 200, \freq, 300, \rate, 0.01, \cutoff, 100])

2nd fluid simulator in supercollider

clean-up: #46

here's another supercollider port of msafluid by Memo Akten. it is very similar to the MSAFluidSolver2D i ported from java, but this one is from the c++ version (openframeworks ofxMSAFluid) and has more features and a gui interface.

unfortunately it runs slower than the java port.

classes, helpfiles and an example are attached as a zip archive below.

AttachmentSize
Package icon MSAFluidSolver.zip17.34 KB

tweets 0220-0225

clean-up: #45

today i recorded and uploaded my latest six supercollider sctweets to my soundcloud account. they were all recorded using sc3.7a0 and audacity for trimming, normalizing, adding a quick fadeout and exporting.
recording short soundfiles of these one-liners help non sc-users get an idea about what is going on and it's also good for archiving. they make it possible to, in the future when sc3.7a0 is long gone, go back and listen to what the code did produce.

//--tweet0220
a=SinOsc;play{RecordBuf.ar(c=InFeedback.ar,b=Buffer.alloc(s,9e4));HPF.ar(a.ar(99,c*6)/9+TGrains.ar(2,a ar:3,b,c+3,2,12),9)}// #SuperCollider

 

//--tweet0221
a=SinOsc;play{tanh((c=InFeedback.ar(0,2))+HPF.ar(a.ar(b=1/[5,4],a.ar(a.ar(b*1.1,a.ar(b*2))+a.ar(b*1.4,c,5,4).ceil*99)),9))}// #SuperCollider

 

//--tweet0222
a=SinOscFB;play{((c=InFeedback.ar(0,2).lag(b=1/67))+DelayL.ar(HPF.ar(a.ar([99,98]*50.666*a.ar(c+b*b,c),c%2),50),b,b)).tanh}// #SuperCollider

 

//--tweet0223
a=LFSaw;play{Splay.ar(BPF.ar(a.ar(f=Duty.ar(a.ar(a.ar(c=3/d=(2..6)))*a.ar(d)/c,0,Dseq(ceil(a ar:d)+d*99,inf))+a.ar(c)),f))}// #SuperCollider

 

//--tweet0224
a=SinOsc;play{d=BufRd.ar(2,b=LocalBuf(c=2e5,2).clear,a.ar([2,3]*9)*c,0);BufWr.ar(a.ar(3/[2,3])/3,b,a.ar([99,145]).abs*c);d}// #SuperCollider

 

//--tweet0225
a=LFSaw;play{b=(1..8)*99;Splay.ar(CombN.ar(Blip.ar(b/2+a.kr(-8/b,1,99),b/4+a.kr(1/b,1,99))*SinOsc.ar(8/b,a.ar(99/b)))).sin}// #SuperCollider

fluid simulator in supercollider

clean-up: #44

this is a supercollider port of Memo Akten's processing library MSAFluid. i looked at his MSAFluidSolver2D.java version 1.3.0 and rewrote it for sc. i also optimized it as much as i could but still it is slow and the framerate is very low. i blame the slow sc graphics. the fluid system itself should perform ok - it's just the drawing that doesn't live up to being useful.
the good news is that one doesn't need use the fancy graphics. sc is anyway made for sound synthesis and the fluid simulator can run and particles can be mapped to sound without displaying anything.

classes, helpfiles and examples are attached as a zip archive below.

msafluid2d from redFrik on Vimeo.

AttachmentSize
Package icon MSAFluidSolver2D.zip15.74 KB

failed tweet

clean-up: #43

during today's clean-up-of-old-projects i got stuck shrinking an old piece of supercollider code down to under 140 characters (sctweet). the shortest i could get it down to was 165 characters. still i thought i'd post the results of my efforts here - both if someone have suggestions or if someone want to study the process. it's the same code, just rewritten over and over to be shorter - using every trick i could think of.

of course one could imagine other goals than briefness - better sounding or less cpu taxing are two (probably better and more) common goals when optimizing code in this manner.

n=Pbind(\tempo,2.5,\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),\dur, 0.5);Ptpar([0,n,5,Pmul(\dur,2,Pmul(\freq,2,n)),15,Pmul(\freq,3,n),30,Pmul(\freq,3.5,n),80,Pmul(\dur,3,Pmul(\freq,5.035, n)),140,Pmul(\dur,1,Pmul(\freq,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(\freq,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(d,1,Pmul(f,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(f,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(d,1,Pmul(f,8,n))]).play

n=Pbind(\tempo,2.5,f=\freq,Pseq([Pseq([103.8],14),Pseq([82.4],14)],inf),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur, 0.5);Ptpar([0,n,5,Pmul(d,2,Pmul(f,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035, n)),140,Pmul(f,8,n)]).play

Ptpar([0,n=Pbind(\tempo,2.5,f=\freq,Pstutter(14,Pseq([103.8,82.4],inf)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur,0.5),5,Pmul(d,2,Pmul(f,2,n)),15,Pmul(f,3,n),30,Pmul(f,3.5,n),80,Pmul(d,3,Pmul(f,5.035,n)),140,Pmul(f,8,n)]).play

a={|a,b|Pmul(a,b,n)};Ptpar([0,n=Pbind(\tempo,2.5,f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur,0.5),5,Pmul(d,2,a.(f,2)),15,a.(f,3),30,a.(f,3.5),80,Pmul(d,3,a.(f,5.035)),140,a.(f,8)]).play

a={|a,b|Pmul(a,b,n)};Ptpar([0,n=Pbind(\tempo,5,f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf)),10,Pmul(d,2,a.(f,2)),30,a.(f,3),60,a.(f,3.5),160,Pmul(d,3,a.(f,5.035)),280,a.(f,8)]).play

a={|a,b|Pmul(a,b,n)};Ptpar([0,n=Pbind(\tempo,5,f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf)),10,Pmul(d=\dur,2,a.(f,2)),30,a.(f,3),60,a.(f,3.5),160,Pmul(d,3,a.(f,5.035)),280,a.(f,8)]).play

a={|x|Pmul(f,x,n)};Ptpar([0,n=Pbind(\tempo,5,f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf)),10,Pmul(d=\dur,2,a.(2)),30,a.(3),60,a.(3.5),160,Pmul(d,3,a.(5.035)),280,a.(8)]).play

a=Pmul(f,_,n);b={|y,x|Pmul(\dur,y,a.(x))};Ptpar([0,n=Pbind(\tempo,5,f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf)),10,b.(2,2),30,a.(3),60,a.(3.5),160,b.(3,5.035),280,a.(8)]).play

TempoClock.tempo= 1 //need to reset default clock tempo

a=Pmul(f,_,n);b={|y,x|Pmul(d,y,a.(x))};Ptpar([0,n=Pbind(f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur,0.2),2,b.(2,2),6,a.(3),12,a.(3.5),32,b.(3,5.035),56,a.(8)]).play

a=Pmul(f,_,n);Ptpar([0,n=Pbind(f=\freq,Pstutter(14,Pseq([103.8,82.4],99)),\amp,Pseq([2,1,1,2,2,1,1]/2,inf),d=\dur,0.2),2,Pmul(d,2,a.(2)),6,a.(3),12,a.(3.5),32,Pmul(d,3,a.(5.035)),56,a.(8)]).play

a=Pmul(f,_,n);Ptpar([0,n=Pbind(f=\freq,Pseq([103.8,82.4],99).stutter(14),\amp,Pseq([2,1,1,2,2,1,1]/2,99),d=\dur,0.2),2,Pmul(d,2,a.(2)),6,a.(3),12,a.(3.5),32,Pmul(d,3,a.(5.035)),56,a.(8)]).play

n={|x,y=1|Pbind(\freq,Pseq([103.8,82.4],99).stutter(14)*x,\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,y/5)};Ptpar([0,n.(1),2,n.(2,2),6,n.(3),12,n.(3.5),32,n.(5.035,3),56,n.(8)]).play

n={|x,y=1|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x,\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,y/5)};Ptpar([0,n.(1),2,n.(2,2),6,n.(3),12,n.(3.5),32,n.(5.035,3),56,n.(8)]).play

n={|x,y=1|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x,\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,y/5)};Ptpar([0,n.(1),2,n.(2,2),6,n.(3),12,n.(3.5),32,n.(5.04,3),56,n.(8)]).play

a=[0,1,1,2,2,2,6,3,1,12,3.5,1,32,5.04,3,56,8,1];{|i|Pbind(\lag,a[b=i*3],\freq,Pseq([104,82.5] stutter:14,99)*a[b+1],\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,a[b+2]/5).play}!6

[0,1,1,2,2,2,6,3,1,12,3.5,1,32,5.04,3,56,8,1].clump(3).do{|x|Pbind(\freq,Pseq([104,82.5] stutter:14,99)*x[1],\amp,Pseq([2,1,1,2,2,1,1]/2,99),\dur,x[2]/5,\lag,x[0]).play}

Pages

Subscribe to RSS - supercollider