Forums > MaxMSP

Any object more stable than if?

December 6, 2010 | 3:20 pm

Hi all,
I’ve trying to trigger a recording using the if object, so as soon as I get input from the mic, if triggers a toggle that starts the recording, which toggle, triggers another toggle as soon as it goes off (with an ‘if $i1 == 0 then 1 else 0’) to start the playback.
My problem is that the second toggle goes crazy, and I think it happens because the if object receives values constantly from the mic, so it constantly sends bangs.
Is there any other object that can be used in such a way, but can be more reliable? Select also won’t work cause the value changes are very fast for it to catch.


December 6, 2010 | 3:33 pm

Sounds like an ‘envelope follower’ might help you. Have a search, or there’s a nice one here:

December 6, 2010 | 5:22 pm

Maybe the change object?

December 6, 2010 | 7:48 pm

also maybe not a toggle, which flips when banged. try [led] or as mentioned, [change] will filter out repetitions.

you shouldn’t need [if] in most Max situations. in your case you can use [select] and bang out a 1 if it’s 0 and vice-versa, or even quicker, run the 1/0 through [!- 1] which will invert the values. if you’re using [change] the really-fast-sensing shouldn’t be a problem.

December 6, 2010 | 7:59 pm

he could also include the functionality of [change] INTO his [if].

December 11, 2010 | 1:45 am

Not sure if it’s fast enough, but try the external [pitch~].. Plug your audio in, and one of the outlets will bang whenever a peak in the sound occurs. So the first thing through the mic triggers it, then you could start recording and turn off the signal to pitch~.

December 15, 2010 | 4:42 pm

so you say he shouldn’t need if in most situations, but is there a pressing reason not to use if statements?

December 15, 2010 | 5:42 pm

I spent five years using if for simple routing before I discovered the split object….(hangs head in shame)

December 15, 2010 | 7:54 pm

This sounds like something you should be doing in the signal domain. peakamp~ is a handy object (puts out a float). Also average~ or avg~, depending on the situation, are a good basis for envelop followers. thresh~ is another one.


January 3, 2011 | 7:56 pm

Guys, thank you all for your replies. I still haven’t really solved the problem, but it should be somewhere there. When I’ll deal with the patch seriously again, I’m sure all these tips will be really helpful.
Once again, thanks,

January 4, 2011 | 5:39 am

Not really sure, but perhaps [togedge] will help.

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

Forums > MaxMSP