Looping for set time amount

shawnt's icon

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.

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

There is probably a better way, but this works.

shawnt's icon

That worked great. Thank you very much!

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

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).

mike fonte's icon

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.

shawnt's icon

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.