I’m working with ATK or HOA, so when doing source encoding, I’m taking mono (or stereo) sources and encoding them to ambisonic form (e.g. 3rd order, which requires 16 channels, or 4 channels for 1st order). I think the usual “convention” would be to create a NodeProxy with the required number of output channels, and just use the first one/two of those as (mono/stereo) input, and output the 16 encoded channels as usual. But is there a way to explicitly have different in vs out size? With Synths, of course I can just In
from a Bus with two channels and Out
to a bus with 16…is there a way to do something equivalent with NodeProxy? (I’d love to use Ndef to help manage these things conveniently for live-coding, and easy patching of connections).
Update: After further investigation, I’ve found that this more or less works:
HOADecLebedev26.loadHrirFilters(s);
// Make a mono source
Ndef(\src, { PinkNoise.ar(0.1) * Decay2.ar(Dust.ar(2), 0.1, 1.5) });
// Encode with to 3rd-order ambisonics (1 in, 16 out)
Ndef(\encode, { HOAEncoder.ar(3, \in.ar(0), SinOsc.kr(0.1).range(-45,45).degrad, 0.degrad, 0, plane_spherical: 1, radius: 2) });
// Map the source to the encoder's input
Ndef(\encode) <<> Ndef(\src)
// Decode to binaural stereo (16 in, 2 out)
Ndef(\decode, { HOADecLebedev26.ar(3, \in.ar(0!16), hrir_Filters: 1) });
// Map the encoded source to the decoder
Ndef(\decode) <<> Ndef(\encode)
// Play the result... (don't really need to state 2 channels here,
// since \decode is a 2-channel NodeProxy, but just to be explicit...
Ndef(\decode).play(out: 0, numChannels: 2);
Two things with this – I’d like to output multiple sources to the decoder, so it needs a 16-channel bus of its own. I guess I could create another NodeProxy “in the middle” just to receive all the sources.
The other issue, if I try to remap (e.g. a different source to the encoder), it doesn’t work:
Ndef(\anotherSrc, { var n = 8; EnvGen.kr(Env.perc(0.01, 1), Dust.kr(2)) * SinOscFB.ar(440 * LFDNoise3.kr(0.1!n).range(0.7,1.4), 0.8, 0.2 / n.sqrt).sum });
Ndef(\encode) <<> Ndef(\anotherSrc)
// WARNING: Could not link node proxies, no matching input found.
Thanks for any suggestions,
Glen.