I try to send FFT data using OSC.
getnSynchronous dosenot work .
Is there Alternative way,method,function?
var fftArray= ~kbus.getnSynchronous(~buffersize2_fft);
~oscOut.sendMsg("/fftArray", *fftArray); //sending 1024 values
I referred this.
https://sccode.org/1-4Ty
Hm… FFT data are in a Buffer (not on buses).
getnSynchronous
is only for control buses, not buffers. So, if you’re only running an FFT synth, then getnSynchronous
can’t access the buffer data.
The sccode example uses a Synth to write the buffer data onto a series of consecutive bus numbers – after transferring the data to buses, then getnSynchronous
can operate.
So… are you running a transfer-to-buses synth? Or only the standard FFT?
hjh
Definitions is below.
I thought , if i play some synth ( just SinOsc is fine) then i could get FFT data.
But var fftArray= ~kbus.getnSynchronous(~buffersize2_fft);
fftArray has no value.
~buffersize_fft= 2048;
~buffersize2_fft= ~buffersize_fft.div(2);
~kbus= Bus.control(s, ~buffersize2_fft);
~fftData= Synth(\fft_synth, [\in, 0, \bus, ~kbus]);
//for fft
(
SynthDef(\fft_synth, {
arg in= 0, bus;
var z= Mix( In.ar(in, 2) );
var chain= FFT( LocalBuf( ~buffersize_fft ), z);
Array.fill(~buffersize2_fft, { |i|
var a= Unpack1FFT(chain, ~buffersize_fft, i);
var d= Demand.kr(chain>=0, 0, a);
Out.kr(bus+i, d.min(1));
});
}).add;
);
Check the order of execution. The In
synth needs to come after its source.
http://doc.sccode.org/Guides/Order-of-execution.html
hjh