Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Confetti2X
name
code content
//Confetti 2, Xenakis-variant Server.default.boot; ( ~red=0; ~green=1; ~maxValue=32; //change maxValue to 255 for the complete experience ( /*There is a decreasing linear connection between log(freq) and value. log(freq)=log(maxfreq)-((log(maxfreq)-log(minfreq))*value/maxValue), so freq=exp(log(maxfreq)-((log(maxfreq)-log(minfreq))*value/maxValue))*/ SynthDef(\beeper, { arg value=150, pan=0; var maxfreq=10000, minfreq=50; Out.ar(0, Pan2.ar(SinOsc.ar(exp(log(maxfreq)-((log(maxfreq)-log(minfreq))*value/~maxValue)), 0, 0.01), pan, 1)); }).send(s); ); ) ( ~maxIndex=10; z=40; w=Window("Confetti2X", Rect(400, 300, z*~maxIndex, z*~maxIndex)).front; w.view.background_(Color.white); w.front; //function for drawing array on screen w.drawHook = { for(0, ~maxIndex-1, { arg v; for(0, ~maxIndex-1, {arg h; ~red=~tabel[v,h]/~maxValue; ~green=1-(~tabel[v,h]/~maxValue); r = Rect(h*z+10, v*z, z,z); Pen.color=Color(~red, ~green, 0); Pen.addRect(Rect(h*z, v*z, z, z)); Pen.fill; (~tabel[v,h]+32).asAscii.asString.drawInRect(r, Font("Times", 24)); //remove "+32" when maxValue > 222, this may initially cause a blank window }); }); }; //initialize array and put on screen ( Routine{ ~tabel=Array2D(~maxIndex, ~maxIndex); for(0, ~maxIndex-1, { arg v; for(0, ~maxIndex-1, {arg h; ~tabel.put(v, h,0); }); }); {w.refresh}.defer; }.play;); //Initialize synths ( Routine{ ~syntabel=Array2D(~maxIndex, ~maxIndex); for(0, ~maxIndex-1, { arg v; for(0, ~maxIndex-1, {arg h; ~syntabel.put(v, h,Synth(\beeper, [\value, 0, \pan, (2*h/~maxIndex)-1])); //pan corresponds with horizontal position in array }); }); }.play; ); Routine({ v= ~maxIndex.rand; h= ~maxIndex.rand; while ({~tabel.at(v,h) <= ~maxValue}, { ~tabel.put(v, h, ~tabel.at(v, h) + 1); ~syntabel[v,h].set(\value, ~tabel.at(v,h)); {w.refresh}.defer; v= ~maxIndex.rand; h= ~maxIndex.rand; 0.125.wait }); 10.wait; for(0, ~maxIndex-1, { arg v; for(0, ~maxIndex-1, {arg h; ~syntabel[v,h].free; }); }); }).play; )
code description
As Confetti2: http://sccode.org/1-31X in which you heard only one oscillator at the time. In SuperCollider it is easy to use 100 oscillators at the same time, so while a distribution is made, you can hear sounds that correspond with all the values in the box. That doesn't swing at all, instead it gives a kind of Xenakis-like experience.
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change