Detecting and amplifying sound above a certain threshold

electrolyte's icon

I'm pretty new to Max, and I'm having a peak detection problem.

I've built some boxes with microphones in them. When you hit the boxes, I want only mic input above a certain threshold to be processed and amplified, but I'm failing the first step, which is getting the peak detection right.

Max Patch
Copy patch and select New From Clipboard in Max.

Right now I have a patch that sends a bang when it gets input above a certain level and activates a function that I've used to specify an envelope, but right it's only amplifying clicks and not the mic input, and there's a new click for every new bang (it's currently checking for peaks every 100ms). I know this isn't the way to go, so I need another approach. Any master tips would be awesome! Thanks so much for having a look.

Mark Durham's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Maybe something like this?:

Doing it all with MSP objects will be more accurate/responsive.

electrolyte's icon

Mark, this is so, so helpful. Thanks so much for taking the time to answer and sending such a great example! :)

Jonathan Gunnell's icon

I posted a question about using an analog damper pedal earlier this morning. Could this solution be related to my yet-to-be-determined solution? I just need to send a bang when a damper pedal is pressed...