volume from contact mic triggers audio file

Mar 9, 2011 at 5:52pm

volume from contact mic triggers audio file


I’m new to Max. I am trying to create a patch in which the volume from the input received from a contact microphone triggers an audio file to play. I have a patch that does this, however the toggle switch fluctuates between on and off. I would like this patch to play an entire audio file as soon as the volume reaches a certain threshold (so I DON’T want the file to turn off once the input recedes from the set threshold). Any help would be greatly appreciated. Here is the patch so far:

– Pasted Max Patch, click to expand. –
Mar 9, 2011 at 7:32pm

assuming you’re happy with the rest of the patch: after your edge~, put a [t 0 b] followed by [gate 1 1]. connect the trigger’s trigger’s left and right outlets to the gates left and right ins. so trigger will first pass the edge’s bang through the gate and then trigger will send a 0 to the gate telling it to close so nothing else can get through. there are lots more ways of course…

Mar 9, 2011 at 8:37pm

Thanks a lot for the info.

I tried what you suggested, and it worked once, but for some reason I’m not able to make it work again! Should the trigger “reset” and be able to receive another bang once the audio file has finished playing? I want to be able to play it again and again. Here is the patch:

– Pasted Max Patch, click to expand. –
Mar 9, 2011 at 9:23pm

I was messing around with it a little bit and you could use play~ instead of sfplay~.

– Pasted Max Patch, click to expand. –
Mar 9, 2011 at 10:12pm

right, thats what it is supposed to do. 0 closes the gate and it stays closed till it receives a 1. so when sfplay~ is done playing, have it bang a [int 1] which you could connect to the gate to make it open again.

Mar 9, 2011 at 10:32pm

thanks for all the help.

here is the patch so far:

– Pasted Max Patch, click to expand. –

I’m not sure why the [thresh~] is not producing bangs anymore – do I have something connected incorrectly? Also, should the [int 1] object go to the left outlet of the gate?

thanks again.

Mar 9, 2011 at 10:43pm

It looks like this is working fine to me. Is the problem that it’s playing the file too much?

Mar 9, 2011 at 10:47pm

my problem is that when i reach the threshold from the microphone, it won’t play the file at all!

If this problem could be fixed, I would like it to play the entire sound file regardless of any more incoming signals (from the microphone) and then once it has finished playing, I would like it to be able to take another signal from the mic and repeat.

Mar 9, 2011 at 11:33pm

you are almost there. use this to understand your problem with thresh.

– Pasted Max Patch, click to expand. –
Mar 10, 2011 at 4:13am

It was all working for me but it wasn’t cutting off the mic input so the sfplay~ object was being triggered continuously until the audio went below the threshold. So the sound file was in a constant stutter at first and would retrigger when the threshold was reached. I was also changing the arguments for thresh~ with the number boxes.

Mar 10, 2011 at 9:53pm

thats because you guys are sending the value from 1 flonum to both the upper and lower limits of thresh~ so it doesn’t do anything. you have to specify a range. should be clear in the code i posted above.

Feb 25, 2012 at 10:05am

Moin moin… I figure out your posts and here is my solution! It kills the flank bouncing and sends a bang withe first flank. There are probably many ways to Rome. :D


You must be logged in to reply to this topic.