PV_BinGap pseudo ugen keeping the complement of a spectral range
Part of: miSCellaneous
Inherits from: PV_ChainUGen
Based on PV_BrickWall, but instead of wipe parameters it takes two bin numbers.
See also: PV_BinRange, FFT Overview
Creation / Class Methods
*new (buffer, loBin, hiBin)
Creates a new PV_BinGap object.
buffer - FFT buffer.
loBin - low bin index of excluded range.
hiBin - high bin index of excluded range.
Examples
(
s = Server.local;
Server.default = s;
s.boot;
)
// frequencies are rounded to nearest bins
(
f = { |loFreq = 800, hiFreq = 1500, fundFreq = 50, amp = 0.1|
var bufSize = 1024, binRange, loBin, hiBin, sig, chain;
sig = Saw.ar(fundFreq, amp);
binRange = s.sampleRate / bufSize;
loBin = (loFreq / binRange).round;
hiBin = (hiFreq / binRange).round;
chain = FFT(LocalBuf(bufSize), sig);
chain = PV_BinGap(chain, loBin, hiBin);
IFFT(chain) ! 2;
};
x = f.play;
s.freqscope;
)
x.set(\loFreq, 300);
x.set(\hiFreq, 3000);
x.release;
// for multichannel expansion an array of mono buffers must be provided
(
g = { |loFreq = 800, hiFreq = #[1500, 1500] fundFreq = 50, amp = 0.1|
var bufSize = 1024, binRange, loBin, hiBin, sig, chain;
sig = Saw.ar(fundFreq, amp);
binRange = s.sampleRate / bufSize;
loBin = (loFreq / binRange).round;
hiBin = (hiFreq / binRange).round;
chain = FFT({ LocalBuf(bufSize) } ! 2, sig);
chain = PV_BinGap(chain, loBin, hiBin);
IFFT(chain);
};
x = g.play;
s.freqscope;
)
x.set(\loFreq, 300);
x.set(\hiFreq, [1200, 1200]);
x.set(\hiFreq, [800, 2000]);
x.set(\hiFreq, [2000, 800]);
x.release;