56 lines
1 KiB
Text
56 lines
1 KiB
Text
class:: PV_Diffuser
|
|
summary:: Random phase shifting.
|
|
related:: Classes/FFT, Classes/IFFT, Classes/PV_PhaseShift, Classes/PV_PhaseShift90, Classes/PV_PhaseShift270
|
|
categories:: UGens>FFT
|
|
|
|
Description::
|
|
|
|
Adds a different constant random phase shift to each bin. When triggered, it selects a new set of random phases.
|
|
|
|
|
|
classmethods::
|
|
|
|
method::new
|
|
|
|
argument::buffer
|
|
|
|
FFT buffer.
|
|
|
|
|
|
argument::trig
|
|
|
|
A trigger, that selects a new set of random values.
|
|
|
|
|
|
Examples::
|
|
|
|
code::
|
|
|
|
|
|
|
|
(
|
|
// trig with MouseY crossing center of screen
|
|
{
|
|
var in, chain;
|
|
in = Mix.ar(SinOsc.ar(200 * (1..10), 0, Array.fill(10, { rrand(0.1, 0.2) }) ));
|
|
chain = FFT(LocalBuf(2048), in);
|
|
chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
|
|
0.5 * IFFT(chain).dup;
|
|
}.play
|
|
);
|
|
|
|
(
|
|
b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
|
|
|
|
// trig with MouseY crossing center of screen
|
|
{
|
|
var in, chain;
|
|
in = PlayBuf.ar(1, b, BufRateScale.kr(b), loop: 1);
|
|
chain = FFT(LocalBuf(2048), in);
|
|
chain = PV_Diffuser(chain, MouseY.kr > 0.5 );
|
|
0.5 * IFFT(chain).dup;
|
|
}.play
|
|
);
|
|
|
|
::
|
|
|