Using Gen~as a transient detection for a drum trigger patch.

Ricardo's icon

I'm seeking some assistance with my project. I found this YouTube video that demonstrate how to detect transient in an audio signal. That gave me an idea.

Here's what I'm trying to accomplish with my patch:

  1. Process an incoming audio signal (from a Yamaha TP70 drum pad strike)

  2. Identify the transient in the signal

  3. Generate a MIDI note with the strike's "velocity" translated from the audio to MIDI domain

My challenges:

  1. I'm having trouble synchronizing the velocity with the transient detection and MIDI note creation.

  2. I'd like to visually represent the strike, but using "live.scope~" in "Trigger Mode" results in significant lag.

I'm unsure if this is the optimal approach for creating a simple, user-friendly audio-to-MIDI trigger patch for Ableton Live.

I've tried using bonk~, but it's an obscure object, and I can't seem to adjust the velocity accurately since the "cooked" output has an unfamiliar numeric range that I don't know how to scale between 0 and 127.

I would be grateful for any helpful advice, updates, or suggestions. Thank you!

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

Ricardo's icon

Or if anyone can explain how to scale the "cooked output velocity" between 0 - 127. That would also solve my issue.

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

Source Audio's icon

record Yamaha pad input, playing loud and soft and slow - fast variations.
it is probably only cheap piezo element,
but could be quite dump in sound with all that rubber.

Then play it back in a loop to tweak the settings.

Holland Hopson's icon

Addressing challenge 1 above: You have to delay the trigger a bit so the level of the audio can be measured. Here's a modified version of your patch with a simple envelope follower added and a delay to handle the MIDI output. Experiment with changing the envelope follower attack and release times, the scaling of volume to MIDI values and the delay time.

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