Cannot use FoaEncoderKernel.newUHJ within a SynthDef

I am trying to use FoaEncoderKernel.newUHJ within a SynthDef without much luck. In the simple case of:

~encoder = FoaEncoderKernel.newUHJ;

I get the following output:-

-> FoaEncoderKernel(uhj, 2, 2, 0, nil)
Kernel UHJ_L.wav, channel 0 loaded.
Kernel UHJ_L.wav, channel 1 loaded.
Kernel UHJ_L.wav, channel 2 loaded.
Kernel UHJ_R.wav, channel 0 loaded.
Kernel UHJ_R.wav, channel 1 loaded.
Kernel UHJ_R.wav, channel 2 loaded.

then wrapping the following in a function:

	~foa = {
var encoder, sig, encSig;
encoder = FoaEncoderKernel.newUHJ;
sig = SinOsc.ar([440, 880]);
encSig  = FoaEncode.ar(sig, encoder);
};

~foa.value;

I obtain:

-> [ a BinaryOpUGen, a BinaryOpUGen, a BinaryOpUGen, an OutputProxy ]
Kernel UHJ_L.wav, channel 0 loaded.
Kernel UHJ_L.wav, channel 1 loaded.
Kernel UHJ_L.wav, channel 2 loaded.
Kernel UHJ_R.wav, channel 0 loaded.
Kernel UHJ_R.wav, channel 1 loaded.
Kernel UHJ_R.wav, channel 2 loaded.

(Which is, I presume all present and correct.)

Building this into a SynthDef:

SynthDef(\foa, {
var encoder, sig, encSig;
encoder = FoaEncoderKernel.newUHJ;
sig = SinOsc.ar([440,880]);
encSig  = FoaEncode.ar(sig, encoder);});

returns this:-

The preceding error dump is for ERROR: Convolution2 arg: ‘framesize’ has bad input: nil
Kernel UHJ_L.wav, channel 0 loaded.
Kernel UHJ_L.wav, channel 1 loaded.
Kernel UHJ_L.wav, channel 2 loaded.
Kernel UHJ_R.wav, channel 0 loaded.
Kernel UHJ_R.wav, channel 1 loaded.
Kernel UHJ_R.wav, channel 2 loaded.

I have checked the drivers for consistent frame sizes and all appears ok:

incidentally:

SynthDef(\Foamatrix, {
var encoderMatrix, sig, encSig;
encoderMatrix = FoaEncoderMatrix.newOmni;
sig = SinOsc.ar([440,880]);
encSig  = FoaEncode.ar(sig, encoderMatrix);
});

compiles OK.

There’s appears to be something about FoaEncoderKernel.newUHJ being in a SynthDef that is causing problems; or something’s staring me in the face and is going unnoticed. I wonder whether anybody has experienced anything similar and has found a solution? Thx in advance.

You shouldn’t put it in the SynthDef.

Loading buffers should always be done outside the SynthDef.

hjh