class library: SynthDef - lazy implementation of removeUGen
[supercollider.git] / HelpSource / Classes / PV_MagDiv.schelp
blobcebd67248239c30964a47f77ab9dfadf48cde0bf
1 class:: PV_MagDiv
2 summary:: Division of magnitudes
3 categories:: UGens>FFT
5 description::
6 Divides magnitudes of two inputs and keeps the phases of the first input.
8 classmethods::
9 private:: categories
11 method:: new
12 argument:: bufferA
13 fft buffer A.
14 argument:: bufferB
15 fft buffer B.
16 argument:: zeroed
17 number to use when bins are zeroed out, i.e. causing division by zero (defaults to 0.0001)
19 examples::
20 code::
21 s.boot;
24 SynthDef("help-magMul", { arg out=0;
25         var inA, chainA, inB, chainB, chain;
26         inA = WhiteNoise.ar(0.2);
27         inB = LFSaw.ar(100, 0, 0.2);
28         chainA = FFT(LocalBuf(2048), inA);
29         chainB = FFT(LocalBuf(2048), inB);
30         chain = PV_MagDiv(chainA, chainB);
31         Out.ar(out, 0.5 * IFFT(chain).dup);
32 }).play;
36 c = Buffer.read(s, Help.dir +/+ "sounds/a11wlk01.wav");
39 SynthDef("help-magMul2", { arg out=0, soundBufnum=0;
40         var inA, chainA, inB, chainB, chain;
41         inA = LFSaw.ar([100, 150], 0, 0.2);
42         inB = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
43         chainA = FFT(LocalBuf(2048), inA);
44         chainB = FFT(LocalBuf(2048), inB);
45         chain = PV_MagDiv(chainA, chainB);
46         Out.ar(out,  0.1 * IFFT(chain));
47 }).play(s,[\out, 0, \soundBufnum, c]);
50 c.free;