Page 1 of 1
Creating a more efficient Lemur template.
Posted: 21 Jun 2012 01:44
by fhill2
In OSC specification it says that messages using UDP protocol are always 32bit values.
So my assumption is the size of a message isn't relevant to the latency/workload of the network. (As sending 1 as integer value is the same as sending it as a float value)
However in regarding to send messages from Max (using Max for Live):
If there was multiple content that needed to be sent to the Lemur at the same time then sending those values in an array and assigning each value to a position in that array is more efficient then sending each value indepently in an OSC messages.
This would mean less messages and more information, which would help the latency/workload of the network.
Am I correct to assume this?
Thanks!
Re: Creating a more efficient Lemur template.
Posted: 21 Jun 2012 02:19
by highmountain
Well, you have got the idea right. There is relatively significant overhead in an OSC message because of the text address strings that eat up a relatively large amount of bandwidth and then additionally require a relatively large amount of work to parse. So, sending an array of values instead of a bunch of different ones can indeed potentially save the machines a bit of work.
Of course I said relatively three times because you've got to keep in mind the real world context of running this stuff on stupidly powerful computers. In actual practice, I've yet to bog down Lemur nor the PC with an overload of OSC messages. I'm sure it's possible, but I think you are best off keeping in mind the age-old truism about premature optimization (don't do it!) and just go with whatever makes architectural or organizational sense. That will be enough 95% of the time, and you can worry about the other 5% when you encounter it. Also, keep in mind that the Lemur's scripting language is surely much less efficient than the native code, so if you have to script stuff to get the values out of the arrays and to the right places, most likely you quickly lose more than you gain.
I also suspect that most cases where it might get overloaded are likely the result of sending too many messages that aren't really needed (like updating some value on the Lemur more often than the Lemur's display refreshes), and in such a situation, obviously the first thing to do is to send a more sensible amount of messages instead.
Re: Creating a more efficient Lemur template.
Posted: 21 Jun 2012 06:55
by fhill2
My current project is designing an iTunes browser using my knowledge Max and Applescripts.
I have a grid of 16 columns by 4 rows filled with text objects and a fader to scroll the different tracks. NAME/BPM/KEY/COMMENT.
I could set up the data transfer in 2 different ways:
1. Send each text object a @content command. This means a total of 64 messages to be sent everytime a new track scrolls into view.
2. Assign each text object to an item in an expression, and send a list to the expression.
Ofcourse, I have made sure these text objects would be only updated when needed.
Thankyou for the previous reply!
Re: Creating a more efficient Lemur template.
Posted: 21 Jun 2012 07:10
by findbuddha
I think the issue is not a lack of processing power but network latency. I assume each message takes a set (minimum) amount of time to traverse between iPad and computer via the wifi network. Compressing several OSC messages into one may reduce the overall time to send all the data.
Re: Creating a more efficient Lemur template.
Posted: 21 Jun 2012 10:14
by fhill2
Yes, I am more concerned about the workload of the network, rather the computer.
If the network became overloaded at one point in time it would create some sort of lag and effect other messages immediately before it im 'guessing'.
Possibly similiar to 'lag' in World of Warcraft.