linux: shared memory interface - link with librt
[supercollider.git] / HelpSource / Classes / Convolution.schelp
blob0392e8294a6ed881847d9c6ee3dbf8f66c2d80b4
1 class:: Convolution
2 summary:: Real-time convolver.
3 related:: Classes/Convolution2, Classes/Convolution2L, Classes/Convolution3
4 categories::  UGens>FFT, UGens>Convolution
7 Description::
9 Strict convolution of two continuously changing inputs. Also see
10 link::Classes/Convolution2::  for a cheaper CPU cost alternative for the
11 case of a fixed kernel which can be changed with a trigger message.
14 See also  link::http://www.dspguide.com/ch18.htm::  by Steven W.
15 Smith.
18 classmethods::
20 method::ar
22 argument::in
24 Processing target.
27 argument::kernel
29 Processing kernel.
32 argument::framesize
34 Size of FFT frame, must be a power of 2.
37 argument::mul
39 Output will be multiplied by this value.
42 argument::add
44 This value will be added to the output.
47 Examples::
49 code::
52         { var input, kernel;
54         input=AudioIn.ar(1);
55         kernel= Mix.ar(LFSaw.ar([300,500,800,1000]*MouseX.kr(1.0,2.0),0,1.0));
57         //must have power of two framesize
58         Out.ar(0,Convolution.ar(input,kernel, 1024, 0.5));
59          }.play;
64 //must have power of two framesize- FFT size will be sorted by Convolution to be double this
65 //maximum is currently a=8192 for FFT of size 16384
66 a=2048;
67 s = Server.local;
68 //kernel buffer
69 g = Buffer.alloc(s,a,1);
73 //random impulse response
74 g.set(0,1.0);
75 100.do({arg i; g.set(a.rand, 1.0.rand)});
78         { var input, kernel;
80         input=AudioIn.ar(1);
81         kernel= PlayBuf.ar(1,g.bufnum,BufRateScale.kr(g.bufnum),1,0,1);
83         Out.ar(0,Convolution.ar(input,kernel, 2*a, 0.5));
84          }.play;