UnityOSC icon indicating copy to clipboard operation
UnityOSC copied to clipboard

Question: How to handle a large number of Messages?

Open StudioOnno opened this issue 3 years ago • 3 comments

I would like to make some optimalisations for sending a large amount of messages

  • Only send message on value change
  • Reuse message() function
  • Control the speed at which messages are send

any advice for me?

Greetings, Marijn

StudioOnno avatar Mar 07 '21 17:03 StudioOnno

It will, most likely, depend on your use cases.

Only sensing a message when a value changes can work if your receiver doesn't need to know of a new value, but in some cases a receiver being passed the same value again can have a different meaning to not receiving one at all.

Do you have some examples of where you are experiencing performance issues? Have you done benchmarking to see where your bottlenecks are?

glynternet avatar Mar 07 '21 17:03 glynternet

Hi,

My usecase is this:

I am sending lots of OSC messages from Unity3D to Ableton Live. Using Ircam tools for spatialisation.

When I send all these params, my max for live device uses up a lot of CPU. It seems like just sending messages to the UDPRECEIVE in Maxmsp is already a big workload.

So I am looking for a way to send these value's only

  • when the user changes them,
  • when the game launches (initialize)
  • Decrease sending rate?

What would be the best approach?

Schermafbeelding 2021-03-08 om 09 45 21

Spatial Engine(5-3-2021).unitypackage.zip

StudioOnno avatar Mar 08 '21 08:03 StudioOnno

Hum, I have an installation running with an OSC link between Max and Live without any major incident. I do not think the problem is with the actual reception of the UDP messages, but rather the code that is triggered inside the Max for Live patch when it receives them.

My solution was to do most of the processing outside of Max 4 Live and only send the minimum to Live through OSC. Remember that Live has a lot of stuff to manage between audio blocks and that a lot of Max computation can slow things down.

thomasfredericks avatar Mar 08 '21 22:03 thomasfredericks