< Back to IRCAM Forum

Multiple spat~ objects and CPU

Hi everyone,
I’m creating a max patch that requires 10 individual binaural renders of a composition. I have therefore 10 instances of spat~/oper/viewer etc but the approach seems to be very CPU intensive. I have experiemented already with the binaural~ object and adding some individual components eg doppler, which seems less computationally expensive, however is missing alot of features inherent in spat~/oper and doesnt quite sound or “feel” the same. Largely the distance attenuation. Reading the forum I understand the reverb requires alot of CPU and perhaps this is the main culprit? My questions…

  1. Is there a way to manage CPU using multiple instances of spat~ etc?
  2. If using individual objects for each component is better, can you please help advise what objects/components are most important to replace spat~?
  3. Is there an alternative method?

Many thanks,
M

Hi, I presume the 10 individual renders are needed for headtracking? My advice would be to make one mix, and do separate head tracking using [spat5.transform] or in the HOA domain [Spat5.hoa.rotate]. yes, you will need 10 binaural renders but only one [spat5.viewer]. All processing such as doppler, reverberation, attenuation and other effects are only computed once and rotated later. This saves CPU.

Doppler, and attenuation
Add the [spat5.source~] object to your input channels to create doppler, attenuation and air Freq

Reverb virtualisation:

Dedicate one spat5.spat or spat5.ircamverb~ to reverb, then spatialise the internals in the HOA domain. This way the entire ircamverb can become part of the HOA structure.

The main difference is, everything is computed once, except for the head tracking and binaural rendering.

Greetings, Marijn

Have a look at this example:

I created a head tracked binaural situation for multiple headphones with low CPU usage.


----------begin_max5_patcher----------
1939.3oc6asraiaCEcs8WgfPWU33HR8tqlNn.ylY.JZWzEYFDPKS6vDYQUJp
7nES91KeHJK6HqnDK6joIFXhkEoz8xy8dHO7w7uiGYOidKtv15WrNyZzn+c7
nQpaIuwnpeOxdE51jTTgpZ1ojqwSmSPo1SzkdMhkgVg2rvyb+lo7EzjxhYT1
bLKglRYZi4L0E3FB8mriqbr9V0ySlqd0zYWdhqi4kliXBaxwrywYnYoJqCpJ
KqbEsjmh4JGFVcW8s32ki0Nfs8DK6EoTD2t1T4HdxEjrkmyvIbc0B8Bl5LwB
3FI+xyS82nFtmvZjLiwLtPA5Z77yQbNiLqjiWeUQExVAsRzKsDSWXts49Mag
ozrkc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ydHC0RbOnVmZbUzencvOwv3rmrG5HcIeW4G4Uf
fHgL5A04TGfrOIFA9I6aRfxQk+5GCA9JbDzL+8o6f5YYo1hBoGVjWM7fZmLF
+8w+GSvx3QB
-----------end_max5_patcher-----------

All processing can be done in the Hoa Domain.

Hi,

If possible, it’s preferable to use one single spat~ + oper/viewer, rather than multiple instances
(when using one instance with multiple sources, the sources can share the late reverb, therefore saving cpu)

When it comes to binaural, one crucial thing to look at is the HRTFs you are using.
For optimized CPU rendering, I recommend to use SOS filters, with 12 or 24 IIR sections (see spat5.sofa.loader)

With “only” 10 sources, things should run quite smoothly on most modern computers.

If you still face difficulties, please send a minimal working patch, so that it would be easier to pinpoint cpu intensive parts.

Best,
T.

Hi
Thank you both for your responses.

Yes, each render is to facilitate headtracking, but I also require unique listening positions for each one (apologies, a detail I probably should have added). If I encode everything once to HOA and use a single viewer object, can I still decode with different listening positions? My other issue is that doppler etc would also be unique for each listener. Currently, for each I have the following.

spat5.viewer - spat5.abs2rel - spat5.oper - spat5.spat~

I could manage reverb separately as you suggest and will also look at the HRTFs. If, I did this and changed to using the spat5.source~/spat5.viewer/spat5.binaural~ per listener would this be acceptable? This avoids multiple spat~/oper objects but will having multiple viewer objects still be a problem? or should I still encode to HOA.

Many thanks,
M

Using spat5.source~/spat5.viewer/spat5.binaural~ would be cheaper than using spat5.spat~.
But you would lose the reverb (which is really helpful for externalization and distance perception).

I recommend you first try with SOS HRTF, and “measure” your patch (you can do so with “Show CPU Usage” in Max/View menu).

Also, head-tracking can be intensive because it generally comes with high refresh rate. In most situations, it’s OK to “speedlim” the message to reduce the refresh rate, without noticeable difference (and that could save a lot of cpu).

HOA is probably not a viable option if you need different listening positions (each listener would require its own HOA decoder, and that is cpu expensive)

Cheers,
T.

Hi, If you want different listener positions then indeed you need to do the processing for every source. That being said, you could share a reverb between the sources? Since the reverb is the most expensive part of the processing this could go a long way.

Thank you both, thats given me some food for thought and options to try.

Best wishes,
M

Hi
I’ve been trying out binaural~ and pan~ and they dont appear to support source orientation. Is this correct? Is there a way to use these objects that allow the source to be rotated? or a different object? I was using orientation modes lookat and fixed yaw for different sources perhaps this is the issue?

Thanks
M

Hi,
Yes, this is correct.
Only spat5.spat~ supports source orientation/directivity, as this is achieved by adjusting the reverb level/filtering.

Best,
T.

1 Like