Adjusting sensitivity of midi jog wheel

I'm evaluating keyboard maestro to interface a DJ2Go Touch and a Radio. Specifically, I am trying to create a macro that is triggered by the jogwheel being rotated and which sends a specific HTML message to the radio (e.g. to increase frequency). The jog wheel sends a message each time it moves and sends a different message for clockwise and anti-clockwise.

I've got the basic macro working, but the wheel sensitivity is too high. I need to damp it down so that the macro only triggers if (say) 3 messages are received, rather than every time.

Any ideas?

Your macro will always "trigger" when macOS says the wheel has moved, but you can use some coding to get the macro to take action only every third time, if you think that will solve the problem. What you need is a global variable that will increment by one each time the macro is triggered, but you need an IF statement to take action only if that variable is divisible by 3.

But I think you are taking the wrong approach. Instead of thinking that you want every third message to trigger, I think you would get better results if you measure a period of time and trigger (or take action) only if that amount of time has passed. This would be easy. Try this approach for your macro:

image

The first action is a Semaphore Lock action which will "pause" for 0.35 seconds. Here's the details for that action:

After the semaphore action, you will have your code that you want to perform when the device triggers. Then after that you need to pause for 0.33 seconds (slightly shorter than the Semaphore).

What all this will do is make sure that each time the macro is triggered, it will take a minimum of 0.33 seconds to execute, and any subsequent call to that macro will "abort".

In my opinion, this is more likely to get the results you want. But you can still do it your way if you want.

I picked 0.33 seconds as the maximum time, but you can choose any value. I have no idea which value will work for you. If 0.33 is too slow, try a smaller number. Perhaps 0.1 would be better.

1 Like

Thanks for the suggested alternative approach. I've tried that and it works. However, it doesn't allow for using the jogwheel at different speeds.

In this use case - controlling the frequency of a radio - it's quite possible that I'd want to change frequency quickly sometimes. I'll have a go with using a variable.

Thanks again. It's great to know there is a knowledgable user community.

Gareth

Something like this could work to send the HTML on every third execution:

image

1 Like

Yes, as you said, a variable can solve this. But bear in mind that the timeout field in the properties for the Semaphore action does not permit the use of a variable.

The reason you want the timeout is because if you spin the jogwheel too fast, it's possible that you might get more than 50 macros triggered simultaneously, and the semaphore timeout prevents 50 from being reached. Once you hit 50, all macros terminate.

It is possible to mitigate this problem, which is to create a Switch statement and partition several possible timeout values in it. This is a hack, but sometimes hacks are tolerable when there's no other solution.