Forums > MaxMSP

Loops

December 6, 2009 | 2:02 am

I know Max doesn’t like loops but what if you want to create a loop?

I am new to max but the project I am working on has led me to design a patch that is meant to loop. And silly me cant figure how to submit the patch code, how do i do this?


December 6, 2009 | 3:23 am

select what you want to copy- edit – copy compressed

groove~ is a common object for looping

you can also use count~ and line~ in conjunction with index~ or play~


December 7, 2009 | 1:46 pm

Ok so below is my patch I have been working on. What I have tried to create is a record loop of 10secs, which will continue to record until a peak is detected, which then deducts 3secs from the record timer so that if someone speaks near the end of 10secs it is not cut, this also counts to 3secs and stops the recording loop and starts the playback cycle loop, which plays back the recording 3 times and then triggers the record loop cycle all over again!

– Pasted Max Patch, click to expand. –

So this is supposed to be a loop for it to work, however, I always get the ‘Stack Overflow’ message when I click the bang to initiate the process! How can I get around this?


December 7, 2009 | 4:51 pm

‘Stack Overflow’ is surely due to a loop… in your control flow! You want an audio loop, not a loop in your control processes. Piece of advice: for such a simple patch, try first to have everything in view, hard to debug when there are several levels (patchers). Maybe instead of banging the [toggle], you could give it the message 1 or 0, that can make things easier to debug as well.


December 8, 2009 | 12:39 pm

Yes it is dues to a loop in my control flow. But this has been intentional! To realise the idea the programs operation is required to loop, for example:

Loop recording in 10secs cycles > until a peak is detected > then stop recording (after 3sec delay) > start a playback cycle > once playback cycle is complete restart record cycle and begin process again!

Surely, there is some way of achieving this without Overflowing the Stack??


December 8, 2009 | 4:14 pm

Well I think the issue is you want it to loop but you do not want
to create a loop in your control path. From looking at your patch
you have control lines going all over the place. It is actually
pretty hard to figure out what is going on.

I think your design would be better implemented as a state diagram.
That way you can control discrete conditions and when you need to
change.


Viewing 6 posts - 1 through 6 (of 6 total)