Can't Find the Right Token for MIDI Note Trigger Input

Hey guys,
I'm trying to create a macro for controlling on-screen knobs in an audio workstation by simulating holding the mouse over the knob and then using the mouse scroll wheel. I'm using a hardware MIDI controller (DJTechtools MIDI Twister) that has rotary knobs that can also be pressed for a button functionality.
I was already able to implement the two directions of turning the knob L/R successfully in one macro as can be seen in the first two If/Then condition blocks here:

Test MIDI Twister INC:DEC combo.kmmacros (5.4 KB)

But I can't make that work so far for the button (red action in the macro). I've tried several tokens in order to make the If/Then respond to the button press (which is detected correctly via MIDI learn) but I can't get it working....can anybody help me which token should be used for reading the incoming MIDI note trigger event ?

I've tried %Trigger% ("pressed" as condition), %TriggerValue% (the MIDI note as condition), %Calculation% and some others without success.

And as a feature request / question on KM team: Why are there no "condition choices" that can be used directly for control flow actions for MIDI events as well as for USB hardware key devices ? I mean I can use them as triggers but cannot integrate their conditions - that would be much easier and faster to implement for some tasks....

How are you discerning the TriggerValue of the incoming midi note? The disabled action here shows me the value, which I can then copy and paste into the condition as shown and it works for me.

Detect Midi Note.kmmacros (21 KB)

Screenshot

It's worth pointing out that if you want to use "pressed" as a condition, you have to change it to ends with or contains. This won't work for a midi note as its trigger doesn't include "pressed", but it will work for Hotkey or USB Device Key triggers.

Wow. Great ! Thanks a lot for your help and also your very useable detection tool - which I will use a lot in the future !
That was the missing piece - knowing WHAT the value was supposed to be in particular I needed to relate to....that helped me a lot !

Maybe you have a solution for me also for another problem....

In order to perform the task of conveniently move the knob on the plugin I need to implement some kind of "dwell" function related to a mouse positioning....I'll try to explain what I need:

I want the mouse to jump to the screen position of the knob I want to control with the encoder. Also I want to make the mouse getting back to the original position after turning the knob. For one single action this is not a problem at all:

a) storing the actual mouse position in a variable and also setting a flag variable "positionSET" to "1" (in order to prevent the Mouse position variable to always actualize to the new position and hence making it useless)

b) then performing the action (turning the knob once)

c) recalling the old mouse position and resetting the flag to "0"

As easy as possible so far.

BUT: Because longer turns of the encoder knob fire so many controller commands so fast the whole jumping forth and back for every single "shot"/command makes KM getting off the rail and pretty soon using the knob position data as initial mouse position - resulting in the mouse being stuck on the knob after turning.

In general the whole fast back-and-forth-jumping is very inefficient, ugly to watch (mouse arrow blinking) and just bad programming style....

What I want to accomplish instead is some kind of a "dwell" function that keeps the mouse on the knob position as long as commands keep coming in from the controller and only get back to the original mouse position once a defined time has passed without receiving any data from the encoder.
The dwell would restart that timer again and again as long as it receives another command.....know what I mean ?
Once the timer runs till the end (without being restarted anymore) - let's say after 1 second - the "go back to the stored mouse location and reset the flag" routine will be performed....

The most important concept here is creating that "timer bucket filled with water" that's being emptied with a little lid on the bottom once a controller command is being received. Only once the bucket is being filled completely (after 1 sec) it flows the water over to a "water switch" starting the going back-routine.... :wink:

To clarify, is this what you want to happen...?

  • mouse jumps to predetermined position
  • midi input controls scrollwheel at that position
  • after a period without midi activity, mouse returns to its position before the macro was triggered?

If so...

Test MIDI Twister INC-DEC combo.kmmacros (30 KB)

Macro screenshot

Setup:

  • I used a different midi note for my testing, so change the third trigger.
  • Green action 1: Use Get to set the position for the mouse to jump to.
  • Green action 2: Use the disabled red action to get the TriggerValue for the midi note and replace the condition here.
  • Green action 3: Set how long before the mouse returns to its starting position after midi input ceases.

So rather than run a background timer that gets reset on every keypress, you simply use a pause in the macro itself and "reset" the pause by cancelling previous still-running (but, presumably, paused) instances of the same macro?

Neat! Rather embarrassed about my async sub macro timer attempt now...

1 Like

That was my thought too. I got as far as posting the code in the comment box before I had a :bulb: moment and went back to the drawing board. Perfectly good idea. :+1:t3:

As I'm no stranger to ridicule, here's as far as I got. It demos by clicking the Apple menu item and beeping while you mash the "Knob Tweaker" hotkey -- 1 second without a hotkey press and the pointer should return to its original position.

Two macros changing the same Global variable -- ewwwww! :slight_smile:

Knob Tweaking Macros.kmmacros (7.4 KB)

Summary


1 Like

Wow. Thanks Nige_S and noisneil for these great ideas ! :+1: :+1: :+1:

I'll check them out within the next 2 hours....!
As you both seem to be a bit more experienced with KM and see each other's approach....which would you call being programmed more efficiently / easier on the KM engine ?

As I'm right in the process of transferring a huge load of ControllerMate programmings into KM on a quite big controller setup in a music studio I'd like to keep any single process as light as possible....

I don't personally know of a way to test macro resource usage, but you can try both and watch activity monitor in real time.

If you think you might use this kind of functionality extensively, you might want to look at investing in a nObcontrol. I have one and I can't say enough good things about it.

Use @noisneil's rather than mine! Not because of the reasons you list but because my macros run simultaneously and both have unmediated write access to the same Global variables -- so there's a chance of unintended consequences.

But maybe seeing the "spawn a second, asynchronous, process" approach in action will give you ideas of how to use similar elsewhere.

Thanks for the link - interesting device which I didn't know about yet and which looks like having a great feel using it!
But I prefer having many knobs for a more direct and immediate control of many parameters instead of first chosing a control via shortcut and then control the knob....see only my desk here:

Btw, at the bottom right corner you see the MIDI twister I use for controlling plugins (custom caps)....

1 Like

Yes - that's definitely a great new approach I'll keep in mind for further developments in KM !

Mastering engineer?! That's a heck of a setup!!

Couldn't be more different to mine! :joy:

:joy: :joy: :joy:

Yes. Analog/Hybrid Mixing and Mastering. This is the complete setup though....:wink: And still some units missing while in service.....

1 Like

Holy crap that's a lot of outboard!! I bet you have a lot of fun with all that! I'm more of the school of Andrew Scheps, completely ITB, but I'm lucky enough to have access to one of the world's greatest studios (my wife's family business), so I do occasionally get to use some nice gear. I remember an attended mastering session at Abbey Rd and they had hardly anything in there. I guess they're used to finessing near-perfect mixes, so don't have to do much.

Yes. Very happy to have the opportunity to play around with this setup - and it's even more a hobby now (my main job for money is working as voice talent) although I used to be full-time sound engineer until 12 years ago. If that's not too private, which of the "world's greatest studios" are you talking about and where is it located ? Just being curious.....
In my setup (and the ProTools template related to it) I use a combination of Andrew Scheps' and Michael Brauer's (multibus) mixing approaches...see the two Warm Audio 1176's on the right ? Theses are "Andrew's Rear Bus units" :wink: :wink: :wink:
In general I DO believe that Analog still sounds a thud better regarding spaces and phantom imaging....I also strongly believe that Andrew has switched to ITB first and foremost for workflow reasons (working with so many projects at a time, recallability and many projects he's working on all around the world and even on airplanes - at least often being away from home / the studio...)
And yes - Big studios like AR mostly have clients that won't need much repair work and more "fairy dust" - which needs less units (especially compressors)....

Mate I'm all about the Rear Buss!!!!! We'll continue the convo in the DMs. :joy:

What's the DMs ?

Direct messages. Weird - I sent you one but it's not in my sent messages list.