7th Order Harmonics/IEM VST question

Hi -
Sorry for this question being slightly OT - it deals with a Quark and a VST, which might mean most don’t have experience here.

I’m attempting to experiment with 7th-order ambisonics in SuperCollider, to my knowledge, the IEM VST is the only way to do that at the current time… (or, at least, the only way without a lot of math.)

For some reason, though, this is telling me that I have too few busses for 7th-order. Any idea what’s wrong with my code?

(
s.options.numOutputBusChannels = 64;   // binaural output
s.options.numInputBusChannels = 64;
s.options.memSize = 2.pow(20);
s.reboot;
)
~hoaBus = Bus.audio(s, 64);

(
SynthDef(\encode, {
    var src, enc;
    src = SinOsc.ar(LFDNoise1.ar(2000).range(100, 1000)) * 0.2 ! 2;
    enc = VSTPlugin.ar(src, numOut: 64, id: \encoder);
    Out.ar(~hoaBus, enc);
}).add;

SynthDef(\decode, {
    var hoa, bin;
    hoa = In.ar(~hoaBus, 64);
    bin = VSTPlugin.ar(hoa, 64, id: \decoder);
    Out.ar(0, bin);
}).add;
)

(
s.waitForBoot {
    ~encSynth = Synth(\encode,);
    ~decSynth = Synth(\decode, addAction: \addToTail);

    ~enc = VSTPluginController(~encSynth, \encoder);
    ~dec = VSTPluginController(~decSynth, \decoder);
	~enc.open("/Library/Audio/Plug-Ins/VST3/IEM/StereoEncoder.vst3");
	~dec.open("/Library/Audio/Plug-Ins/VST3/IEM/BinauralDecoder.vst3");   
};

~enc.editor;
~dec.editor;

Hi, the problem is that the VST3 SDK only has limited support for multichannel processing. VST2 plugins could specify arbitrary number of input channels, but VST3 have an upper limit per bus. If you need more channels, you need to use multiple input busses.

VSTPlugin does support multiple input busses, so it should be possible to use the VST3 plugins for 7th order. However, I would suggest to simply use the VST version instead. I just tested it and everything works as expected there.


Some notes:

enc = VSTPlugin.ar(src, numOut: 64, id: \encoder);
// ...
~enc = VSTPluginController(~encSynth, \encoder);

You only need to provide IDs if you are using multiple VSTPlugin instances in the same SynthDef. If you only have a single instance, you can just omit the ID.

~enc.open("/Library/Audio/Plug-Ins/VST3/IEM/StereoEncoder.vst3");

Don’t use absolute paths. Instead, call VSTPlugin.search to scan for plugins and then you can use them by name/key. (Depending on the number of plugins, the very first search might take a while. Once the plugins have been scanned and the info has been cached, VSTPlugin.search should be almost instantaneous.)

So here’s your updated example, using the VST2 plugins:

~hoaBus = Bus.audio(s, 64);

VSTPlugin.search;

(
SynthDef(\encode, {
    var src, enc;
    src = SinOsc.ar(LFDNoise1.ar(2000).range(100, 1000)) * 0.2 ! 2;
    enc = VSTPlugin.ar(src, 64);
    Out.ar(~hoaBus, enc);
}).add;

SynthDef(\decode, {
    var hoa, bin;
    hoa = In.ar(~hoaBus, 64);
    bin = VSTPlugin.ar(hoa, 2);
    Out.ar(0, bin);
}).add;
)

(
s.waitForBoot {
    ~encSynth = Synth(\encode,);
    ~decSynth = Synth(\decode, addAction: \addToTail);

    ~enc = VSTPluginController(~encSynth);
    ~dec = VSTPluginController(~decSynth);
	~enc.open("StereoEncoder");
	~dec.open("BinauralDecoder");   
};

~enc.editor;
~dec.editor;
1 Like

If you review the Features section of ABCs of the ATK you’ll see:

Ambisonic order is merely limited by system speed, channel capacity and numerical precision rather than by design.

So, indeed, the SuperCollider version of the Ambisonic Toolkit (ATK), aka atk-sc3 can certainly do 7th order and higher. The ATK nicely does “a lot of math” for you.

Some other pages you may also like to review:

2 Likes

Hi @joslloand
I’m trying: {HOAEncoder.ar(7, SinOsc.ar(200))}.play;
and getting this error:

this order is not implemented for HOAEncPan
ERROR: binary operator '*' failed.

Do you get different results?

Hello @boxnumber HOAEncoder is a pseudo-UGen which is part of Florian Grond’s SC-HOA, which is a different package.

ATK for SuperCollider, aka atk-sc3, can be found here.

The equivalent line of code for atk-sc3 is:

// be sure to install atk-sc3
// https://github.com/ambisonictoolkit/atk-sc3#installing

x = {
    HoaEncodeDirection.ar(SinOsc.ar(200), order: 7)
}.play;

// finished? ... free
x.free;