Merge pull request #506 from andrewcsmith/patch-2
[supercollider.git] / HelpSource / Classes / PV_CopyPhase.schelp
blob77a0c473cb56a9c280fbe670090b9b0aa7a26738
1 class:: PV_CopyPhase
2 summary:: Copy magnitudes and phases.
3 related:: Classes/FFT, Classes/IFFT, Classes/PV_Add, Classes/PV_MagMul, Classes/PV_Max, Classes/PV_Min, Classes/PV_Mul
4 categories:: UGens>FFT
6 Description::
8 Combines magnitudes of first input and phases of the second input.
11 classmethods::
13 method::new
15 argument::bufferA
16 FFT buffer A.
18 argument::bufferB
19 FFT buffer B.
21 Examples::
23 code::
24 s.boot;
25 b = Buffer.read(s, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
28 SynthDef("help-copyPhase", { arg out=0;
29         var inA, chainA, inB, chainB, chain;
30         inA = SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));
31         inB = WhiteNoise.ar(0.2);
32         chainA = FFT(LocalBuf(2048), inA);
33         chainB = FFT(LocalBuf(2048), inB);
34         chain = PV_CopyPhase(chainA, chainB);
35         Out.ar(out, 0.1 * IFFT(chain).dup);
36 }).play(s);
40 SynthDef("help-copyPhase2", { arg out=0, soundBufnum=2;
41         var inA, chainA, inB, chainB, chain;
42         inA = PlayBuf.ar(1, soundBufnum, BufRateScale.kr(soundBufnum), loop: 1);
43         inB =  SinOsc.ar(SinOsc.kr(SinOsc.kr(0.08, 0, 6, 6.2).squared, 0, 100, 800));
44         chainA = FFT(LocalBuf(2048), inA);
45         chainB = FFT(LocalBuf(2048), inB);
46         chain = PV_CopyPhase(chainA, chainB);
47         Out.ar(out, 0.1 * IFFT(chain).dup);
48 }).play(s, [\soundBufnum, b]);