Creating a trigger device

sethicus's icon

Hi all,

I'm trying to create a device to essentially achieve something like drum trigger software.
An incoming audio signal is detected and sends midi information out.
The purpose is to use a mic'ed voice, or guitar, or drums, or any other instrument to control vsts, or ableton itself, or lighting equipment, etc...

The part were I'm stuck is how to effectively differentiate between velocities. I want to assign different velocity zones to different midi messages.

Let's say I have zone 1 from -70 to -50db, zone 2 from -50 to -20 db and zone 3 from -20 to 6 db.
If the incoming signal is -30db, then the midi message associated with zone 2 is triggered.

The basic structure is already working, but the problem is that every sound has an attack and decay, of course.
So a -30 db signal fades in from -inf to -30. At the moment my device first triggers zone 1 and THEN zone 2. And of course when the sound stops, it fades back out, triggering zone 1 again.
But I want it to only trigger zone 2.

So I was thinking to introduce some kind of delay, only evaluating the signal after x ms.
It would have to be short enough so it does not mess with the playability (like trying to play guitar with too much latency), but long enough to not misinterprete short sounds with a fast attack, or even miss them alltogether.
This could take care of the problem at the start of the sound, going up. But it would still fade out and go through zone 1 at the end.

Does anyone have any insights on how long the delay should be or how to fix the fading out problem?
Or any suggestions for a more efficient way to achieve my goal?

Christopher Dobrian's icon

I advise setting an attack threshold above which you consider the 'note' to have begun, then tracking the amplitude until it is no longer increasing, and using its amplitude apex to determine the velocity you will assign.

Wetterberg's icon

Also, look at bonk~ for some good inspiration.

Belquer's icon
Andro's icon
Max Patch
Copy patch and select New From Clipboard in Max.

christophers right here. Setting an attack and release threshold will allow the selection of one zone.
Maybe its easier to convert the amplitude to a float with the example patch.
Heres my solution (with the audio analysis from someone else's awesome patching skills)
Probably a better way to do it but hopefully this works.

sethicus's icon

Hi,

Thanks for all the tips.
The trigger is working, or at least in a basic way.
The input signal is evaluated and, depending on the volume, triggers one of four messages.
I fixed the problem of going through all "zones" by adding a count~, so now it only sends the message to the rest of the device if the message is on for longer than 50 ms (adjustable), which seems to do the trick...

I don't know if this is what you guys meant by setting an attack treshold, but if not, it achieves the same thing.

For the moment, I can differentiate between 4 volume zones, each triggering a different envelope.
The envelopes are then mapped to macro's in an instrument rack with a vst.

I've been controlling a dubstep bass synth with my real bass guitar for half an hour, sounds great :p
Of course, there's some fine tuning to do, but it's playable without too much delay. :)

I also tried the same thing with the standard envelope follower (ctrlenvfol) and I must say my method works more precise for what I want to use it for, ie Dubstep-like growls and stuff like that.