/usr/share/SuperCollider/HelpSource/Classes/StereoConvolution2L.schelp is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | class:: StereoConvolution2L
summary:: Stereo real-time convolver with linear interpolation
categories:: UGens>FFT, UGens>Convolution
related:: Classes/Convolution, Classes/Convolution2L
description::
Strict convolution with fixed kernel which can be updated using a trigger signal. There is a linear crossfade between the buffers upon change.
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::.
Useful applications could include stereo reverberation or HRTF convolution.
See Steven W Smith, The Scientist and Engineer's Guide to Digital Signal Processing: chapter 18: http:// www.dspguide.com/ch18.htm
classmethods::
method:: ar
argument:: in
processing target.
argument:: kernelL
buffer index for the fixed kernel of the left channel, may be modulated in combination with the trigger.
argument:: kernelR
buffer index for the fixed kernel of the right channel, may be modulated in combination with the trigger.
argument:: trigger
update the kernel on a change from <= 0 to > 0.
argument:: framesize
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.
argument:: crossfade
The number of periods over which a crossfade is made. The default is 1. This must be an integer.
argument:: mul
argument:: add
examples::
code::
(//allocate three buffers
b = Buffer.alloc(s, 2048);
c = Buffer.alloc(s, 2048);
d = Buffer.alloc(s, 2048);
b.zero;
c.zero;
d.zero;
)
(
50.do({ |it| c.set(20 * it + 10, 1.0.rand); });
3.do({ |it| b.set(400 * it + 100, 1); });
20.do({ |it| d.set(40 * it + 20, 1); });
)
(
SynthDef(\conv_test, { arg kernel1, kernel2, t_trig = 0;
var input;
input = Impulse.ar(1);
// must have power of two framesize
Out.ar(0, StereoConvolution2L.ar(input, kernel1, kernel2, t_trig, 2048, 1, 0.5));
}).add
)
x = Synth(\conv_test, [\kernel1, b, \kernel2, c]);
// changing the buffer number:
x.set(\kernel1,d);
x.set(\t_trig,1); // after this trigger, the change will take effect.
x.set(\kernel2,d);
x.set(\t_trig,1); // after this trigger, the change will take effect.
d.zero;
40.do({ |it| d.set(20 * it + 10, 1); });// changing the buffers' contents
x.set(\t_trig, 1); // after this trigger, the change will take effect.
x.set(\kernel1, b);
x.set(\t_trig, 1); // after this trigger, the change will take effect.
x.free;
::
|