SuperCollider CLASSES


Real-time partitioned convolution
Inherits from: UGen : AbstractFunction : Object


Partitioned convolution. Various additional buffers must be supplied.

Mono impulse response only! If inputting multiple channels, you'll need independent PartConvs, one for each channel.

But the charm is: impulse response can be as large as you like (CPU load increases with IR size. Various tradeoffs based on fftsize choice, due to rarer but larger FFTs. This plug-in uses amortisation to spread processing and avoid spikes).

Normalisation factors difficult to anticipate; convolution piles up multiple copies of the input on top of itself, so can easily overload.

Class Methods

*ar (in, fftsize, irbufnum, mul: 1, add: 0)



processing target.


spectral convolution partition size (twice partition size). You must ensure that the blocksize divides the partition size and there are at least two blocks per partition (to allow for amortisation).


prepared buffer of spectra for each partition of the inpulse response.


Inherited class methods

Undocumented class methods

*calcBufSize (fftsize, irbuffer)

*calcNumPartitions (fftsize, irbuffer)

Instance Methods

Inherited instance methods


// preparation; essentially, allocate an impulse response buffer, then follow a special buffer preparation step to set up the data the plugin needs. Different options are provided commented out for loading impulse responses from soundfiles.
~fftsize=2048; // also 4096 works on my machine; 1024 too often and amortisation too pushed, 8192 more high load FFT


var ir, irbuffer, bufsize;

    // // MONO ONLY
    // pre-existing impulse response sound files
    // (could also use any general soundfile too for cross-synthesis effects)
    // irbuffer=, "/Volumes/data/audio/ir/ir2.wav");
    // irbuffer=, "/Volumes/data/audio/ir/ir.wav");
    // this is a two second long hall IR
    // irbuffer=, "/Volumes/data/audio/ir/bighall2.wav");

    // synthesise the honourable 'Dan Stowell' impulse response

    ir = ([1] ++0.dup(100) ++ ((1, 0.99998 .. 0).collect{|f| f =
    f.squared.squared; f = if(f.coin){0}{f.squared}; f =
    if(0.5.coin){0-f}{f} } * 0.1)).normalizeSum;
    // ir.plot;

    irbuffer = Buffer.loadCollection(s, ir);


    bufsize= PartConv.calcBufSize(~fftsize, irbuffer);

    // ~numpartitions= PartConv.calcNumPartitions(~fftsize, irbuffer);

    ~irspectrum= Buffer.alloc(s, bufsize, 1);

    ~irspectrum.preparePartConv(irbuffer, ~fftsize);

    s.sync;; // don't need time domain data anymore, just needed spectral version



~target=, Platform.resourceDir +/+ "sounds/a11wlk01.wav");
// ~target=, "sounds/break");


{ var input, kernel;

input=, ~target, loop:1);,, ~fftsize, ~irspectrum.bufnum, 0.5));


// convolve with live input

{ var input, kernel;

input=;,, ~fftsize, ~irspectrum.bufnum));

// should get back original impulse response (once every four seconds)

{ var input, kernel;

input=;,, ~fftsize, ~irspectrum.bufnum));


// only free buffers once you're finished with examples
// if you free whilst PartConv is still running, the server won't crash, but PartConv output will go to zero abruptly