SuperCollider CLASSES (extension)

AtkKernelConv
ExtensionExtension

Kernel convolution from the Ambisonic Toolkit (ATK)
Inherits from: Object

Description

Convolve an Array of channels to an Array of channels.

NOTE: AtkKernelConv is usually called internally by the Ambisonic Toolkit's encoders, transformers and decoders.

Class Methods

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

Arguments:

in

The input signal, an array.

kernel

The convolution kernel.

mul

Output will be multiplied by this value.

add

This value will be added to the output.

Returns:

An array of channels.

Discussion:

NOTE: In normal circumstances, the user will not call AtkKernelConv directly.

Inherited class methods

Instance Methods

Inherited instance methods

Examples

Monophonic to decorrelated FOA

// hand code a mono signal to a decorrelated soundfield in B-format
// NOTE: the demonstrated kernel is not ideal for this task

// define encoding kernel
(
var kernelSize;
var scale;

kernelSize = 256;
scale = 24.neg.dbamp;

~kernel = [[
    Buffer.loadCollection(s, FloatArray.fill(kernelSize, {(3/2).sqrt * scale.rand2})),
    Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),
    Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2})),
    Buffer.loadCollection(s, FloatArray.fill(kernelSize, {scale.rand2}))
]]
)

// convolve
(
{ 
    var sig;

    // pink noise
    sig = PinkNoise.ar;

    // encode
    AtkKernelConv.ar(sig, ~kernel);
}.scope
)

// free kernel when finished
~kernel.at(0).do({arg kern; kern.free})