Arguments:

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

trigger

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

framesize

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.

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: