SuperCollider CLASSES (extension)

PV_EvenBin
ExtensionExtension

Return the even numbered bins in an FFT buffer

Description

PV_EvenBin(buffer)

Class Methods

Inherited class methods

Instance Methods

Inherited instance methods

Examples

// resynthesize only odd or even bins
s.boot;

// a sample sig
{SinOsc.ar(440 + SinOsc.kr(0.05).range(0, 440), 0, 0.5)}.play;

(
SynthDef(\evenbin, {arg fftbuf1, fftbuf2;
    var in, chain1, chain2, out1, out2;
    in = SinOsc.ar(440 + SinOsc.kr(0.05).range(0, 440), 0, 0.5);
    chain1 = FFT(fftbuf1, in);
    chain1 = PV_EvenBin(chain1);
    out1 = IFFT(chain1);
    chain2 = FFT(fftbuf2, in);
    chain2 = PV_OddBin(chain2);
    out2 = IFFT(chain2);
    //   Out.ar(0, out1 + out2); // add back together
    Out.ar(0, [out1, out2]); // or split apart
}).add;
)

// the fft buf
s.sendMsg(\b_alloc, 0, 2048);
s.sendMsg(\b_alloc, 1, 2048);

// start the synth
s.sendMsg(\s_new, \evenbin, z = s.nextNodeID, 0, 1, \fftbuf1, 0, \fftbuf2, 1);
// free it
s.sendMsg(\n_free, z);
s.sendMsg(\b_free, 0);
s.sendMsg(\b_free, 1);

s.quit