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

46 lines
1.3 KiB
Text

class:: PV_Conj
summary:: Complex conjugate
categories:: UGens>FFT
description::
Converts the FFT frames to their complex conjugate (i.e. reverses the sign of their imaginary part). This is not usually a useful audio effect in itself, but may be a component of other analysis or transformation processes...
classmethods::
method:: new
argument:: buffer
FFT chain.
examples::
code::
s.boot;
(
b = Buffer.alloc(s,2048,1);
c = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
d = Buffer.alloc(s,2048,1);
)
(
SynthDef(\help_pvconj, { 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_Conj(chain);
// Original is left, conj is right
Out.ar(out, 0.3 * [in, IFFT(chain)]);
}).play(s,[\out, 0, \bufnum, b, \soundBufnum, c]);
)
(
SynthDef(\help_pvconj2, { arg out=0, bufnum=0, soundBufnum=2;
var in, chainA, chainB;
in = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
chainA = FFT(bufnum, in);
chainB = PV_Copy(chainA, d);
chainB = PV_Conj(chainB);
// Now we have the original and conjugate, what happens if we add them?
Out.ar(out, 0.3 * (IFFT(PV_Add(chainA, chainB)).dup));
}).play(s,[\out, 0, \bufnum, b, \soundBufnum, c]);
)
::