for/while iterations

Andrea's icon

Hi guys,

I just started using max msp, at the moment I'm using it to interface Live with my custom software, so far I'm quite happy with it, however I have some noob questions to ask.

I'm using m4l apis to get some info from Live, there is a function that returns the numbers of tracks available and I'd like to use it to create N osc messages each one containing the track info.

I've google it , but I couldn't find out how to implement the "for" or "while" statement to create the messages, what's the maxmsp approach for it?

thanks.

pid's icon

uzi

Andrea's icon

thanks! :]

Andrea's icon

got one more question, how can I populate a string with the uzi? let's say I have the following messages that get sent individually and in sequence from the uzi(1 2 3) and I want to end up with a single string "1 2 3"

Tim Lloyd's icon

[zl group ] or [zl stream ]

Roman Thilenius's icon

or "prepend 3" or "append 4" an object like zl or messagebox.

Mark Durham's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I find this is a nice way to generate strings with uzi. The sequence of bangs from trigger first clears the previous entry, then fills the message box, then bangs it all out.

ch's icon
Max Patch
Copy patch and select New From Clipboard in Max.

As tim said, [zl group] is perfect for the job here. it's better to avoid UI object if you can. As well the second outlet of uzi is really usefull :

seejayjames's icon

And if you need full "for/while" use, where it's only active for a certain range of numbers, you'd need [select] at the start, checking the numbers coming out of [uzi]. Then you can interrupt the iteration when it reaches a condition, for example:

while (i
{
do something
}

Straight "for" loops are easy with [uzi], as you aren't checking a condition, you're just doing something a given number of times.

[defer] and [deferlow] are sometimes needed when iterating as well, if you need to check a condition...that's a whole different discussion, but good to know. Basically, you don't want things happening too fast for too long, in certain situations.

OK, that probably just made things more confusing. Signing off now :)