rsc3/doc-schelp/HelpSource/Classes/PV_MagSmear.schelp

56 lines
1 KiB
Text

class:: PV_MagSmear
summary:: Average magnitudes across bins.
categories:: UGens>FFT
Description::
Average a bin's magnitude with its neighbors.
classmethods::
method::new
argument::buffer
FFT buffer.
argument::bins
Number of bins to average on each side of bin. As this number
rises, so will CPU usage.
Examples::
code::
s.boot;
(
b = Buffer.alloc(s,2048,1);
c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
)
(
SynthDef("help-magSmear", { arg out=0, bufnum=0;
var in, chain;
in = LFSaw.ar(500, 0, Decay2.ar(Impulse.ar(2,0,0.2), 0.01, 2));
chain = FFT(bufnum, in);
chain = PV_MagSmear(chain, MouseX.kr(0, 100));
Out.ar(out, 0.5 * IFFT(chain).dup);
}).play(s,[\out, 0, \bufnum, b.bufnum]);
)
(
SynthDef("help-magSmear2", { arg out=0, bufnum=0, soundBufnum=2;
var in, chain;
in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
chain = FFT(bufnum, in);
chain = PV_MagSmear(chain, MouseX.kr(0, 100));
Out.ar(out, 0.5 * IFFT(chain).dup);
}).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);
)
::