Recording 2 channe buffer (in FFT) with PV_RecordBuf

Hello everyone, im trying to store some buffers in their fourier transformation representation. Somehow however they turn out to be one channel only. I dont see why that is. Here is my code for recording this buffer:

SynthDef("pvrec", { arg recBuf=1, soundBufnum=2;
	var in, sig, bufnum;
	bufnum = LocalBuf.new(1024,2);
	Line.kr(1, 1, BufDur.kr(soundBufnum), doneAction: 2);
	in = PlayBuf.ar(2, soundBufnum, BufRateScale.kr(soundBufnum), loop: 0);
	sig = FFT(bufnum, in, 0.25, 1);
	sig = PV_RecordBuf(sig, recBuf, 0, 1, 0, 0.25, 1);
}).add;

This Synthdef should record another buffer in its fast fourier transformed
form. Say ~b is already a 2 channel buffer you’ve loadede before. you can now allocate ~b_fft as:

~b_fft = Buffer.alloc(s,~b.duration.calcPVRecSize(1024, 0.25),~b.numChannels));
Synth("pvrec", [\recBuf, ~b_fft, \soundBufnum, ~b]);

An easy way to check if it has 2 channels is to simply plot the fft buffer and see if there is some noise on both channels.

Any idea why i dont have 2 channels after this method and how to make a 2 channel FFT buffer? Thank you very much

hey, i think you have to put LocalBuf into a function have a look at the Helpfile of FFT.

bufnum = { LocalBuf(1024) } !2;

1 Like

Oh yes, that did the trick. Thanks, I should’ve done that!