Forums > MaxMSP

Looping for set time amount

September 20, 2013 | 5:03 pm

This may have been answered (I’m brand new to this program). Is there a way to run a loop for a set amount of time so the loop turns itself off? I am setting up a sound installation that needs to run for 30 minutes based on a single sound. I may not be able to be there to turn it off and want a way for the loop to shut itself off so the people running the installation wont have to do it themselves.


September 20, 2013 | 9:36 pm

There is probably a better way, but this works.

<code>

– Pasted Max Patch, click to expand. –

</code>


September 21, 2013 | 12:20 pm

That worked great. Thank you very much!


September 21, 2013 | 1:12 pm

The principle you want to be aware of is scheduling an event to happen at some time in the future. That’s what Max excels at. Mike’s solution continually schedules events 1 second in the future, counts them, and reports when 1800 of them have occurred. But that means lots of scheduling and testing, and you know that 1799 of the tests will have a negative result. If you know in advance the point in time when you want something to happen, you can simply schedule that one event. The delay object is fine for that (or the timepoint object if you’re working in transport-based time).
<code>

– Pasted Max Patch, click to expand. –

</code>


September 21, 2013 | 5:58 pm

I knew there was a better way! Thanks Christopher for helping me think from the "schedular’s" perspective.

Your welcome ShawnT, hope the installation goes swimmingly.


September 21, 2013 | 6:57 pm

Thank you Christopher and Mike! I am testing out the delay feature now (need to be certain over 30 minutes not just the 5 seconds I tried first) though I am sure it will work. Mike your option was also very effective thank you. The trick with this installation is that I may not be able to be there so I have to design it to be idiot proof and to turn off when the time is up.


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