SuperCollider CLASSES


Real-time fixed kernel convolver.
Inherits from: UGen : AbstractFunction : Object


Strict convolution with fixed kernel which can be updated using a trigger signal.

Internally, this unit uses FFT to accelerate the calculation, which means that (a) you must specify a "framesize", and (b) if the kernel is longer than this framesize, the end of it will be ignored.

See also by Steven W. Smith.

Class Methods

*ar (in, kernel, trigger: 0, framesize: 2048, mul: 1, add: 0)



Processing target.


Buffer index for the fixed kernel, may be modulated in combination with the trigger. It's size must be <= framesize.


Update the kernel on a change from non-positive to positive value.


Size of FFT frame, must be a power of two (512, 1024, 2048, 4096 are standard choices). Convolution uses twice this number internally. Note that the convolution gets progressively more expensive to run for higher powers! The maximum value you can use is 2^16=16384. (This upper limit is half of "SC_FFT_MAXSIZE" defined in the SC source code.) Larger convolutions than this can be done using PartConv.


Inherited class methods

Instance Methods

Inherited instance methods


( // allocate three buffers
b = Buffer.alloc(s,2048);
c = Buffer.alloc(s,2048);
d = Buffer.alloc(s,2048);;;;

({ |it| c.set(20*it+10, 1.0.rand); });{ |it| b.set(400*it+100, 1); });{ |it| d.set(40*it+20, 1); });

SynthDef( "conv-test", { arg kernel, trig=0;
    var input;;

    //must have power of two framesize,,kernel,trig,2048, 0.5));


x ="conv-test",[\kernel,b.bufnum]);

// changing the buffer number:
x.set(\trig,1); // after this trigger, the change will take effect.
x.set(\trig,1); // after this trigger, the change will take effect.;{ |it| d.set(20*it+10, 1); });// changing the buffers' contents
x.set(\trig,1); // after this trigger, the change will take effect.

x.set(\trig,1); // after this trigger, the change will take effect.

// next example
b =, Platform.resourceDir +/+ "sounds/a11wlk01.wav");

    { var input, kernel;;

    //must have power of two framesize,,b.bufnum,0,512, 0.5));


// another example
//must have power of two framesize- FFT size will be sorted by Convolution2 to be double this
//maximum is currently a=8192 for FFT of size 16384
s = Server.local;
//kernel buffer
g = Buffer.alloc(s,a,1);

g.set(0,1.0);{arg i; g.set(a.rand, (i+1).reciprocal)});

// random impulse response

    var input,inputAmp,threshhold,gate;

input =;
inputAmp =;
threshhold = 0.02;    // noise gating threshold
gate = > threshhold, 0.01);,*gate,g.bufnum,0, a, 0.5));


// one last example
b = Buffer.alloc(s, 512, 1);
b.sine1(1.0/[1,2,3,4,5,6], true, true, true);

    { var input, kernel;;

    //must have power of two framesize,,b.bufnum,0, 512, 0.5));


Instead of triggering the kernel update yourself, as in the first example, you can use a UGen trigger signal to do so. In the next example, we use two Convolution2 UGens in order to continuously and smoothly change the impulse response: RecordBuf is used to record a random frequency Saw oscillator every trigPeriod seconds. Right after the recording (trigPeriod gets delayed by the buffer duration BufDur, using the TDelay UGen) the two convolution UGens alternatively update their kernels (using two triggers convTrigs). At the frequency of the kernel updates a crossfader XFade2 moves between conv1 and conv2, using a triangle oscillator LFTri at half the trigger frequency as a panning input. The result is a constantly shifting spectral colorization of the Dust impulses:

b = Buffer.alloc( s, 2048, 1, _.zeroMsg );
    x = { arg i_kernel, density = 100, trigPeriod = 5.0, cutOff = 1000, minFreq = 200, maxFreq = 2000;
        var input, trigFreq, recTrig, irSig, convTrig, convTrigs, bufFrames, conv1, conv2;

        input        = density ), cutOff );
        trigFreq        = trigPeriod.reciprocal;
        recTrig        = trigFreq );
        irSig        = minFreq, maxFreq, recTrig ), 0.4 ); irSig, i_kernel, recTrig, loop: 0, trigger: recTrig );
        convTrig        = recTrig, i_kernel ));
        // split updates across two triggers. Note that [ 1, 0 ] creates
        // a MultiChannel expansion!
        convTrigs        = convTrig, 2, [ 1, 0 ]);
        bufFrames        = i_kernel );
        // create the two alternatingly updated convolution ugens
        #conv1, conv2    = input, i_kernel, convTrigs, bufFrames ); conv1, conv2, trigFreq * 0.5, 1 )) ! 2;
    }.play( s, [ \i_kernel, b ]);

x.set( \trigPeriod, 0.1 );    // fast changes
x.set( \trigPeriod, 10.0 );    // slow changes;    // delete synth