Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / PV_Diffuser.schelp
blobd5760752c8f7ac00b0907107a849f5ba6134e3d8
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. When triggered, it selects a new set of random phases.
11 classmethods::
13 method::new
15 argument::buffer
17 FFT buffer.
20 argument::trig
22 A trigger, that selects a new set of random values.
25 Examples::
27 code::
32 // trig with MouseY crossing center of screen
34         var in, chain;
35         in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) }) ));
36         chain = FFT(LocalBuf(2048), in);
37         chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
38         0.5 * IFFT(chain).dup;
39 }.play
43 b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
45 // trig with MouseY crossing center of screen
47         var in, chain;
48         in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);
49         chain = FFT(LocalBuf(2048), in);
50         chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
51         0.5 * IFFT(chain).dup;
52 }.play