Quick and Long Press Button

Next question for the night!

Im trying to maximize the functionality of my available buttons on the LPD-8 (see previous post, if interested). What I would like to happen is to use one physical button to execute two functions. One MIDI note (sent to Ableton Live) if the button is short pressed, and a second MIDI note sent if the button is long pressed. Heres the trick, I would like there to be as little delay as possible if the button is short pressed... but the first note cannot trigger if the button is long pressed. Does that make sense? Example: I short press the button, and little to no time elapses before the first MIDI note is sent. I long press the button, the second note is sent, and the first one is not.

Any help would be greatly appreciated! Thanks so much!

See the following example of “gestures”. It should have most, if not all that you need.

 

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz


Attachments:
1571546302741_Gestures-2019-10-09.bmtp

Thanks Steve!

Sorry Im just now having a look at this! … living that dad life! Im looking at the code, and Im somewhat confused as to what you put in 1.0 rules. rr=oo&224? What is &? Sorry Im not familiar with that.

Actually, I take that back.. Im totally confused now actually. I started playing with it, and Im not seeing any output at all from anything that I press. Im sure that theres something glaring that Im missing here though.

224 is hex E0 if you AND 90 H or 80 Hex with E0 Hex you will always get 80 Hex which means it is either a note on (90 Hex) or Note off (80 hex). This is my shortcut to allow for both note-on or note-off messages through. If I AND the incoming Status byte with 224 and it isn’t 128 (80 Hex), then it is some other kind of MIDI message, otherwise it is either note on or note off.

This new version, allows you also to distinguish the incoming message by MIDI channel. The last one would act on any MIDI channel.

I also bumped up the delay to slightly longer as my fingers are not that quick.

The way it works is 1.0 takes the incoming message and captures its message type (cc or note) MIDI channel, the note or cc number and the velocity/value and fires a one shot timer (with 300ms delay)”Evaluate”, that counts and analyzes the button presses and releases within that 300ms.

1.2 (Evaluate) counts the press downs (gd) and ups (ge) and determines by the count what kind of gesture it is (based on key down and key up counts) and then sets the value of gf to the gesture type. Then it fires of a timer “Gesture Dispatch”.

I create translators for every possible gesture type based on gf and send out with each a unique midi message (in this case various PC messages). Each translator fires simultaneously looking for their MIDI channel, Message type CC or note number and gesture type. It only fires the output if it is a match. You can disable gestures you don’t want by disabling the respective translator.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

 

 


Attachments:
1571622266935_Gestures-2019-10-20.bmtp

Got it! That’s awesome! Ok. So if I wanted to use this for only one button specifically, I could replace the local variable with the note designator (in raw midi) and delete the button 2 and 3 translator sets right?

Also confused about something in the initialize translator. The -1, 1 2 settings for what type of action? Are those numbers that I need to change?

I just use -1 as no input 1 as note and 2 a CC as a designator for what kind of control it is.

In the latest file I also defined the button values as g0 g1 and g2 for button 1 2 and 3. I have 1 and 3 set as notes and 2 set as a CC. You can change the value there and the CC type in translators you are using. To evaluate different target note/cc numbers. I would just disable (uncheck) the translators you are not using. That way if you ever wanted to use them, all you would need to do is re-enable those.

// Look for note if ga=1 2 then it is a CC
if ga!=1 then exit rules, skip Outgoing Action
// uncomment below to target MIDI channel
// otherwise any MIDI channel
// Example below is MIDI Channel 9
//if gb!=8 then exit rules, skip outgoing action
// Note g0 (as set up in init global variables translator rules)
// gc is the current note so if it is not for this translator, then skip
if gc!=g0 then exit rules, skip Outgoing Action
// single press and release
// gf is the type of gesture (see rule in Init global translator for definitions of gestures and their numbers)
if gf!=2 then exit rules, skip Outgoing Action

 

 

Alright Steve, I apologize, but Im still not getting it to work. I have attached an image of what my rules progression looks like in the Log Window. But Im not sure whats going on. If you look at the bottom 1.3-1.8 all say to exit rules and skip outgoing. So Im not getting an output. Any input would be most helpful. This is exactly what I need… I just can’t make it work :/


Attachments:
![](upload://zhKSLLciKa85mC0IzSDkxnUmlh.png)

Hi,

Yes, it appears that the Akai APC-MINI as well as the LPD8 sends note-off messages with velocity 7F which is really odd. I modified the rules within the 3 Byte Pedal Press translator to accommodate this change. See attached.

Just replace the entire rules with what I have in the attached by copy and paste.

I’m also including an update project file with the new rules already loaded.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

 


Attachments:
1571707443381_Gestures-2019-10-21.bmtp
1571707443429_3-byte-pedal-press-2019-10-21.txt

You are the man! Ok, now, am I correct in assuming that if i only wanted this set to function on a specific note, that I replace the variable pp with my note value. Then The translator will only be looking for one specific note? correct?

I just checked the new version, and it works great. Im sorry that took so much effort! But thank you so much for helping all the way through

You got it. No issue at all. I had original tested with a different controller but yesterday when I tested with my APC-MINI I got the same issue so I made it more bullet proof.

Yes set the note or CC number and type (1 for note and 2 for CC) and optionally MIDI Channel (unless you want to recognize all MIDI channels) and you should be all set.

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

Ok sweet! As I was playing around with it (because originally when I tried replacing pp it don’t work) I found that there is a rule that converts pp to a global variable (g0 maybe… sorry I’m away from the file) and then tries to recall that global variable.

If this isn’t commented out, the translation won’t work. (Just mentioning in case someone else has my goals in mind)

Also, is there somewhere I can go to learn about bit mapping in home’s? The &, >>, etc functions seem extremely useful, but I have no understanding of them whatsoever! Would love to learn some!

I set up g0, g1 and g2 as button1 button2 and button3 in the file at startup
Then I copy from one of those into pp for evaluation in the translator.
Probably best to define all of your target notes as global variables and then copy into pp in the translators.
Saves a lot of time if you later copy the translators for future use as you don’t have to go in an edit a lot, only the global variable you want to pull from.

As far as bit mapping, just do some web searches on binary math or binary bit shift or binary numbering.

There is lots out there to learn from.

That makes perfect sense. Thanks again for your help!

And just so I’m clear, notes come in as midi, are displayed in hex and then my confusion, is what/how/when/if they get converted to binary (I mean I know that the information is always in binary…) and how I can get that info in Bomes to use it effectively… if you can’t tell, I’m pretty new to this aspect.

Everything is binary natively. We just use hex to make it easier to interpret.

Easier to say FF then 1111 1111
Bome shows variables in decimal so using WIndows calculator in programming mode will yield the decimal number 255 for the above

Ok… I think I’m catching on…. so there would actually be 3 sets of “binary numbers” for a midi message. On/off/channel, value, and velocity (for a note message) assign a variable to one part (while working in hex, then manipulate in binary from there? Am I semi on the right track?

Also scouting the forum archives to find things as well! Thanks again so much for your help!!

Go to http://www.midi.org