linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / PV_Diffuser.schelp
blob8908973b2a7d9048cf47c73c462cf75df03bb105
1 class:: PV_Diffuser
2 summary:: Random phase shifting.
3 related:: Classes/FFT, Classes/IFFT, Classes/PV_PhaseShift, Classes/PV_PhaseShift90, Classes/PV_PhaseShift270
4 categories:: UGens>FFT
6 Description::
8 Adds a different constant random phase shift to each bin. The trigger
9 will select a new set of random phases.
12 classmethods::
14 method::new
16 argument::buffer
18 FFT buffer.
21 argument::trig
23 A trigger, that selects a new set of random values.
26 Examples::
28 code::
30 s.boot;
32 b = Buffer.alloc(s,2048,1);
33 c = Buffer.read(s, Help.dir +/+ "sounds/a11wlk01.wav");
37 //trig with MouseY
38 SynthDef("help-diffuser", { arg out=0, bufnum=0 ;
39         var in, chain;
40         in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, {rrand(0.1, 0.2)}) ));
41         chain = FFT(bufnum, in);
42         chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
43         Out.ar(out, 0.5 * IFFT(chain).dup);
44 }).play(s,[\out, 0, \bufnum, b.bufnum ]);
48 //trig with MouseY
49 SynthDef("help-diffuser2", { arg out=0, bufnum=0, soundBufnum=2;
50         var in, chain;
51         in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
52         chain = FFT(bufnum, in);
53         chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
54         Out.ar(out, 0.5 * IFFT(chain).dup);
55 }).play(s,[\out, 0, \bufnum, b.bufnum, \soundBufnum, c.bufnum]);