Mix MIDI Device and physical Keyboard

Hi,

I'd like to work with my MIDI device and my keyboard simultanously, but the keystroke outgoing action does't seem to work like that on MacOS.

I'm on MacOS 10.11 on one machine and 10.12 on the other, and Bome 1.8.2 .

I created 4 buttons, which are either in toggle mode to hold down each one of Shift, ctrl, option and cmd until I push again or in momentary mode to hold them down until I let go. But it the OS let's the hold go as soon as I type anything on my keyboard (and in Photoshop CC as soon as I move the mouse aswell)

Anybody any idea how I can solve that?

Could you please post your project file (or just the translators in scope). I will take a look on Windows. If I can duplicate your problem on Windows, I will suggest a fix. If I cannot, I’ll send to someone with a Mac machine to take a look.

Regards,

Steve

bome@sniz.biz

Independent Bome Programming Specialist

Bome Q&A moderator

Here’s my Preset

Thanks for the quick response


Attachments:
1503443163791_KeyToggle.bmtp

OK so as I’m getting my head around your script:

g0=1 toggle mode g0=0 momentary mode – Controls Toggle or Momentary Mode
g1=1 shift is down g1=0 shift is up
g2=1 control is down g2=0 control is up
g3=1 alt is down g2=- alt is up
g4=1 cmd(windows) is down g4=1 cmd(windows is up)

A value of 7F input sets the variable

A value of 01 input clears it (except for Toggle Shift in which case 7F does both)

Difficult to check but it appears that shift hold is working on Windows until I either toggle it back or hit the shift key. I get caps lock on shift hold. Is OSX taking out of shift mode when it is set to toggle and any other keystroke is struck? If so maybe OSX releases shift, control, alt, and command after any key is struck. Is this what you are saying?

As I say it appears to be working on Windows (at least with shift) however I might have written the code a little differently. 😉

 

I’m checking with someone that has a Mac to test it out there.

(a value of 00 input clears it, I’m using a Novation Launchpad MK1 which only sends Note On, either 7F or 00)
I know, my code is a bit messy.
MacOS is taken out of any key hold as soon as any key is struck, not after it. For example I’m not able to press cmd via my Launchpad and Z on the Keyboard to undo, neither in toggle nor in momentary mode.
I thought it may be because of the Privacy > Accessibility settings of MacOS and changed that, but that didn’t resolve it.

OK, it may be a few days before we have an answer for you on the Mac. Have you tested on WIndows? If not, I will do some further testing with my Launchpad MKII which puts out the same thing as the Mk 1.
Do you have plans to also light up the pads when the value of the variables are 1?

Don’t have a Windows machine available and actually don’t care, because it has to work on Mac.
I allready have the lighting, not perfect, but suitable. In toggle it switches between green and red and in momentary between green and yellow.
No hurry, I’m already really surprised about and thankful for the quick help.

OK, thanks for your patience. I’m happy to help. Maybe if I can get a few good consulting gigs, I can invest in a Mac.

Steve

Hi, when testing with my Launchpad, I was not able to get your project to work as advertised.

I fixed in the attached file. Your rules for key up were messed up.

I changed the buttons to the last row buttons all together to make it easier for me to figure out. You will likely need to change back to the buttons you wish to use. I also added a timer and preset to update the lights. I also did this for easy of troubleshooting.

Let me know if this works better. Perhaps the problem you were experiencing was with this faulty logic.

 

I tested with a Launchpad Mk2 using Windows the Mk2 colors are purple for gx=1 and red for gx=0 where x is 0-4. Not sure if the Mk1 will have the same colors. I’m pretty sure it doesn’t

I also put a key to enable or disable the status light timer (again for troubleshooting) Last row last key in the matrix.

 

 

Regards,

Steve

 

bome@sniz.biz

 

Independent Bome Programming Specialist

 

Bome Q&A moderator

 


Attachments:
1503514500622_KeyToggle-a.bmtp

I am pretty sure that this does not work on macOS by design of macOS. In MT Pro, when you emulate Cmd-Z, it will issue these keystrokes:
Cmd down
Cmd+Z down
Cmd+Z up
Cmd up

Now when you do Cmd separately and Z from a real keyboard, the target application will see this:

Cmd down [MT Pro]
Z down [keyboard]
Z up [keyboard]
Cmd up [MT Pro]

So, unless the target application tracks the modifier keys on its own, it will think that there is just the Z key. It’s a bit strange, but it’s how macOS works internally.

Windows has a different way of using keystrokes, so emulating the modifier keys and combining them with keys typed on a QWERTY keyboard works there.

Maybe there is a way for you to emulate all keys in MT Pro? MT Pro tracks the modifier keys internally, so you can do separate keys and it will issue the correct combined keystrokes.

[offtopic]
For me it’s about the OS itself, Mac suits me more, because it’s unix based and you can still bash, and it’s more userfriendly, more stable and Adobe works better, which I need for my profession. But the investment for a Apple device is a tough one. You could get yourself a pretty good and inexpensive Hackintosh NUC or tower.

I’m sure I’ll get one some day. Don’t want to get religious about platforms here but with cgywin I can bash as well.
Florian, thanks for chiming it. So if I understand, we would tee up all states in BMT and then only send the output
when the final key needs to be sent.
For instance, we set control flag shift flag and then send only when we trigger a MIDI event that sends say and “S” at which point we clear the flags.
Any plans on having a future version of MT to convert a MIDI value to a keystroke value instead of translators for every keystroke? For instance the ASCII for “s” is 0x73. It would be great if we could take whatever the ascii value is and convert it to a keystroke. Of course I’m not considering double byte characters that seem to be more prevalent in today’s world.

Hi Florian, pleased to hear from the master himself.
My goal wasn’t to ditch the QWERTZ completely, but to use single MIDI buttons for common shortcuts and actions in my workflow and still be able to use the keyboard for less common stuff, so I don’t lose track of all the buttons. 80 button may be to much. And I already thought about more Shift situations and double presses and stuff. The only thing I can think of, since I know about this weirdness of MacOS, is to translate all the actual keyboard buttons to themselves. Should there be any concern about doing that, may that compromise the speed of my machine too much?
Oh, and actually it’s not about the target application but a system wide problem. cmd down works, until I strike anything else. It seems like I try to send
cmd down [MT Pro]
Z down [keyboard]
but the system get’s
cmd down [MT Pro]
cmd up [whatever]
Z [keyboard]
greetings from Hannover

I’ve just had a look on your project and I don’t get you version of the rules. Could you explain in detail, why you put them this way?

Not sure where you questions are so I will explain in generality
Preset “Key Toggle” handles all of the in coming midi messages and sets variables accordingly. A note-on message with 7F will generate the key down state. A message other then 7F ( 90 xx yy) where yy is not 7F will generate a key up action.

The Lights Preset handles the messages sent back to my Launchpad Mk2 and controls the color depending on the variable state. I’m using the bottom row of my Launchpad Mk2 for both incoming MIDI messages and lighting the colors going back to the Launchpad Mk2.

The preset “Control” is used to control whether I update the light status. Pushing it once starts a 100ms timer to update the lights and feeds the translators in the LIghts preset which control the actual output to the lights. When I kill the status timer I also turn all lights off .

Hope this helps!

Steve