Forums > MaxMSP

volume from contact mic triggers audio file

March 9, 2011 | 5:52 pm

Hello,

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

March 9, 2011 | 7:32 pm

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…


March 9, 2011 | 8:37 pm

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

March 9, 2011 | 9:23 pm

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

– Pasted Max Patch, click to expand. –

March 9, 2011 | 10:12 pm

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.


March 9, 2011 | 10:32 pm

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.


March 9, 2011 | 10:43 pm

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


March 9, 2011 | 10:47 pm

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.


March 9, 2011 | 11:33 pm

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

– Pasted Max Patch, click to expand. –

March 10, 2011 | 4:13 am

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.


March 10, 2011 | 9:53 pm

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.


February 25, 2012 | 10:05 am

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


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