Rolling (aka Moving) Timer

Hello All,

I’m new to Bome Midi Translator Pro but not new to coding, music, DAWs or VST Plugins. I have a group of plugins which decode chords either by reacting to a single note from a midi controller to resolve/decode a simple chord or resolving three(3) or more notes and recognizing more complex chords. The plugins play a sample in real-time and is sync’d to the midi clock (not to be confused with MIDI Time Code) based on either the receipt of a single note or a complex chord and there is no option to turn off the single note recognition. I am attempting to write a Bome Project with a “Rule” which will ignore passing a single note and only pass notes when they occur in groups of three(3) or more note on events in the given timeframe of the variable “Window”.

My current issue is with the timer. The timer needs to run in a continuous loop thus it will always have a “Window of Time” to work within. Should the timer be local or global once I have a means of creating the value? The following is not Bome Language but any SW Developer will understand the intent.

Window=@NOW-50 ms

With this “Window of Time” I plan to count the note on/off events which exist inside the time designated by the variable “Window”. Once the total of active “note on” events is greater than or equal to three(3), they will be output to the plugin. Note counts in the time variable “Window” equal to or less than two(2) will be ignored.

I’ve also yet to find a function to use which will COUNT the number of times a given function or action occurs.

Any ideas on this would be greatly appreciated,


The issue is a bit complex but I’ve done similar before.

  1. You need to have something that counts note-on events. Basically you increment the count with a global variable on each note-on event and decrement the count with a note-off event. If the count is less than three you suppress any outgoing messages.
  2. You need to have a system that captures note-ones and queues them up for playing (assuming the counter is 2 or more). If you need to use only one velocity for on or off, then you can bitmap the note on events. When the count reaches three then you run a repeating timer (with no delay), to iterate and send only the ones that are playing. If you want to track all 128 notes (0-127) then you would need four global variables to track their on states since global variables in MT Pro are 32 bit signed integers.

So here is the way it works.

  1. Notes are counted, within a time window of your choosing. If notes are less than 2 then nothing happens. The note on events start one shot delayed timer to count the notes. The delay is the amount of time you want before determining the note count.

  2. On the one shot timer, if the note count is 2 or more, then you trigger a repeating timer to iterate through all notes and send note-on messages For every 1 value in the bitmap. If the note count is <2 then you exit rules with no outgoing action (do not trigger the iterator timer).

  3. For note-off, just pass them all through as it doesn’t hurt anything and you don’t want any hung notes.

Now if you want to track the velocity of each note-on event (note just on-or off), you will need more global variables. It is simpler to use 128 global variables for this but you could actually bit map the values in groups of 4 (32 global variables). Bitmapping logic is a bit tricky for a newbie though.

I hope this helps set you on the right path.

Steve Caldwell
Bome Customer Care

Also available for paid consulting services:

Yes, lets see what he comes back with.

Thanks Steve,

And I thought I was up late. I think I’m following your logic.

  1. All activity will be restricted to MIDI Channel 4 for this project
  2. Velocity is a “Don’t Care” issue for this project
  3. The working variable should be GLOBAL

Sorry for the “Way to late” reply Steve. I’ve had some non-music related things going on that has taken priority. I should be back to it next week.

Thanks for all your help.