// title: example fft sc->processing // author: Fredrik Olofsson // description: // template code for sending lots of data (1024 fft values 61 times per second) from sc to processing. sound function from an old sc-tweet. updated to work with sc3.9 and processing 3.3.6 // code: /* //--processing code: import oscP5.*; import netP5.*; OscP5 oscP5; final int BUFFERSIZE= 2048; //should correspond with fft size in supercollider final int BUFFERSIZE2= BUFFERSIZE/2; float[] fftArray; void setup() { size(1280, 768); frameRate(60); background(0); noSmooth(); fftArray= new float[BUFFERSIZE2]; for (int i= 0; i=0, 0, a); Out.kr(bus+i, d.min(1)); }); }).load; s.sync; ~trk= Synth(\avTrk, [\in, 0, \amp, 0.3, \bus, c]); a= play{var a=SinOsc;Splay.ar(a.ar(PulseCount.ar(f=InFeedback.ar(0,2).sum)%999+(60,63.0005..99)*a.ar(2**f)*2+[3,4],f>0*f*9)).tanh*MouseX.kr(0, 1)}; Routine.run({ inf.do{ var fftArray= c.getnSynchronous(buffersize2); n.sendMsg(\fftArray, *fftArray); //sending 1024 values (1/61).wait; //a tiny bit faster than framerate }; }); CmdPeriod.doOnce({c.free}); }; )