XML Feeds

.

[maxmsp] Advice with maintaining state / data structs

Adam nanoarchae at gmail.com
Thu Oct 18 17:56:04 MDT 2007


Hello! Newbie to Max here.

So I'm implementing a patch that's meant to accept a command string via a message, parse the arguments, and then send a series of messages to a play~ object.

For example, the initial message might look something like "snare 100 200 127 255 3" meaning the 'snare' buffer~ should be played for 200 ms, starting at 100 ms into the buffer, starting at half volume (127) and ending at full volume (255), and this should loop 3 times. What I'm implementing actually involves a lot more variables and dynamics so this may not be the best example, but it's the basis. The point is that I have a lot of changing variables, math operations, and order-important evaluation going on my current method (a giant mess of cords) it's increasingly difficult to understand, modify, et c.

My question is: what is the best way, or is there a convention in maintaining state and variables? I come from a background in textual programming languages, and can't help but to think in terms of for loops, while loops, conditionals statements, small math operations, all of which I know are supported by Max, but when I go to actually implement these seemingly simple algorithms, I end up with these giant confusing cord orgies, constantly worrying about what is going to get evaluated first, and unable to figure out what I even did the previous day.

Is there any sort of object that I can use to get, set, compare, and manipulate variables via messages? This post is getting lengthy and tangential, but I envision something that I can send a message to like "x = 5" to assign a value to x, or "x = x + 1" or any other math operation to increment x, or "get x" which would send the value of x through its outlet, or "clear" which would clear the symbol table. Does anything like that exist?

Any tips are much appreciated. Thank you in advance!


More information about the maxmsp mailing list