Decoding to Speakers in SC

The ATK can decode Ambisonics to loudspeaker arrays with a few simple steps. For illustrative purposes this example show decoding to a regular quad setup. This example assumes that an encoded signal has been created with Encoding Ambisonics in SC.


Define the Decoder

First step is to create an array with the speaker directions in radians - degrad makes it easier. Although the example setup is a 2D quad layout, it is defined in 3D, each speaker a pair of [azimuth,elevation]. The array with the layout is then used to create the decoder matrix:

(
// a regular quad setup with two front and two rear speakers
~directions = [ [45,0], [-45,0] , [-135,0], [135,0]].degrad;

// calculate the decoder
~decoder = HoaMatrixDecoder.newDirections(~directions, order: 1);
)

// inspect angles of decoder matrix
~decoder.directions.raddeg

Decode

Decoding happens in one compact synth. The HoaDecodeMatrix UGen gets the encoded bus and the decoder matrix and outputs the loudspeaker signals to the first four SC output buses:

(
~speaker_decode = {
  HoaDecodeMatrix.ar(In.ar(~ambi_BUS, ~nHOA), ~decoder)
}.play(target: ~encoder_B, addAction: \addAfter);
)

Make sure the decoder is placed after the encoder in the signal flow.


Sanity Check

With the default angles (0,0) the signal is coming from the front with no elevation. The meter (s.meter) shows that:

/images/spatial/sc_quad_meter.png:width:40%:figwidth:100%:align:center

References

2017

  • Florian Grond and Pierre Lecomte. Higher order ambisonics for supercollider. In Linux audio conference 2017 proceedings. 2017.
    [details] [BibTeX▼]