1 class:: StereoConvolution2L
2 summary:: Stereo real-time convolver with linear interpolation
3 categories:: UGens>FFT, UGens>Convolution
4 related:: Classes/Convolution, Classes/Convolution2L
7 Strict convolution with fixed kernel which can be updated using a trigger signal. There is a linear crossfade between the buffers upon change.
9 Like link::Classes/Convolution2L::, but convolves with two buffers and outputs a stereo signal. This saves one FFT transformation per period, as compared to using two copies of link::Classes/Convolution2L::.
11 Useful applications could include stereo reverberation or HRTF convolution.
13 See Steven W Smith, The Scientist and Engineer's Guide to Digital Signal Processing: chapter 18: http:// www.dspguide.com/ch18.htm
21 buffer index for the fixed kernel of the left channel, may be modulated in combination with the trigger.
23 buffer index for the fixed kernel of the right channel, may be modulated in combination with the trigger.
25 update the kernel on a change from <= 0 to > 0.
27 size of FFT frame, must be a power of two. Convolution uses twice this number internally, maximum value you can give this argument is 2^16=65536. Note that it gets progressively more expensive to run for higher powers! 512, 1024, 2048, 4096 standard.
29 The number of periods over which a crossfade is made. The default is 1. This must be an integer.
33 (//allocate three buffers
34 b = Buffer.alloc(s, 2048);
35 c = Buffer.alloc(s, 2048);
36 d = Buffer.alloc(s, 2048);
44 50.do({ |it| c.set(20 * it + 10, 1.0.rand); });
45 3.do({ |it| b.set(400 * it + 100, 1); });
46 20.do({ |it| d.set(40 * it + 20, 1); });
51 SynthDef(\conv_test, { arg kernel1, kernel2, t_trig = 0;
54 input = Impulse.ar(1);
56 // must have power of two framesize
57 Out.ar(0, StereoConvolution2L.ar(input, kernel1, kernel2, t_trig, 2048, 1, 0.5));
63 x = Synth(\conv_test, [\kernel1, b, \kernel2, c]);
65 // changing the buffer number:
67 x.set(\t_trig,1); // after this trigger, the change will take effect.
69 x.set(\t_trig,1); // after this trigger, the change will take effect.
72 40.do({ |it| d.set(20 * it + 10, 1); });// changing the buffers' contents
73 x.set(\t_trig, 1); // after this trigger, the change will take effect.
76 x.set(\t_trig, 1); // after this trigger, the change will take effect.