Send MIDI message in sync with MIDI clock after receiving it

I want to send a MIDI message to my DAW on the beat with the currently playing song.

 

Is it possible to use MIDI translator to achieve such "quantized trigger" behavior?

Wow, I had to give this little thought, but I think it is possible but would take a fair amount programming. This is a very atypical request.

I suggest the following strategy.

You have triggers for incoming notes that capture the incoming MIDI channel, note number, and velocity and store them in a queue (a series of global variables). When storing them, you also calculate when to trigger them based on when they came in and the quantization you want. The calculation is stored as the number of ticks (sync signals) you want before you release the note to your DAW. Since MT Pro uses 32 b it integers, you could bit stuff each note,MIDI channel, velocity and count into a single global variable .

You have another trigger for each clock signal that iterates through the queue (global variables), decrementing the clock value of each variable. When the clock value for a given note is 0, you then disassemble the global variable into the note MIDI message, send it out to your DAW and then 0 out the global variable indicating that that queue position is now available for re-use. Any global variables that are all 0 are then ignored for sending notes.

This would work as long as the queue didn’t fill up faster than the notes are being released. You would need some logic to drop note-on messages if this happens, but for safety sake you should probably always pass through note-off messages when the queue is full. Also for safety, you should send all notes off at the point the queue is entirely empty (to avoid stuck note-ons). You would set up the size of the queue (number of global variables) to balance out the anticipated rate of “queue full” and the time it takes for the note dispatcher process the queue.

So essentially you have a collector/scheduler based on incoming note messages and a dispatcher, based on midi sync count).

Anyway that is the architectural idea however implementing this is pretty new ground so there may be additonal factors to consider during the implementation.

The idea is similar to what I do to track multiple LED light conditions to update a controller LED’s.

I press a button and based on the button pressed a bit is set in a global variable. (collector).

I periodically iterate through the bits and update the LED matrix (Send note messages) to update the entire matrix. (the dispatcher)

I hope this give you some ideas. If you need an exact implementation example, it would be beyond the scope of free support here, but you can always email me for paid support if you need me to create a proof-of-concept project file or a complete solution. I would probably only quote a proof-of-concept at this point in time since this is such new ground.

I didn’t search this board to see if it had been done before. I’ve been supporting here for about 2 years but you could search the old forum to see if someone has already solved this in some other way.

 

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

 

 

 

This sounds cool, but perhaps I did not explain my use case well enough. What I would like to achieve is very simple. Let me give you a scenario. Studio One does not (yet) allow tempo syncing when jumping to a marker in the timeline. I can assign a keyboard shortcut to jump to a marker, but the playhead jumps to the marker as soon as I press the shortcut key. What I would like to achieve is to press a button on my midi controller and trigger the marker jump keyboard shortcut in Studio One not immediately, but on the next beat (or measure or whatever).

I thought of using Bome MIDI translator for this… is it possible?

Yes, actually that is much simpler.

You set a translator to capture the note (or other MIDI message) you want to send for the transition. In the rules you define how many sync messages you want until it triggers and set that number in a global variable.

Then on the incoming sync messages, you just count down on each one until the counter (global variable) reaches 0 and then release the message to Studio one to trigger the marker.

 

 

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

Thanks for your prompt reply. This would ensure that my trigger would fire in sync with the master tempo. In addition to this, would it be possible to:

  1. read the master tempo from the DAW instead of the controller I am using to trigger the keyboard shortcut -> marker jump in my DAW?
  2. trigger keyboard shortcut on the next beat or measure? (not just after a predefined number of sync messages)
    Thanks a lot!!!

“Thanks for your prompt reply. This would ensure that my trigger would fire in sync with the master tempo. In addition to this, would it be possible to: 1) read the master tempo from the DAW instead of the controller I am using to trigger the keyboard shortcut -> marker jump in my DAW? 2) trigger keyboard shortcut on the next beat or measure? (not just after a predefined number of sync messages) Thanks a lot!!!”

Hi,

If the DAW sends Sync messages it will send them at 24 per quarter note no matter what tempo it is at. This is, if your DAW follows the MIDI standard for timing clock.

 

If faster tempo, your DAW should send 24 syncs faster. So what you would need to do is send a “start” MIDI message from your DAW to MT Pro to let it MT know when to start counting and then count down 96 sync messages from there. You could set up continues counter that counts down as each message comes in then reset to 96 when it reaches 0 so that you always know where you are in MT Pro within a given measure.

 

Of course if the note comes in between measures, you would need to subtract the current count from 96 so that you would know when to begin the next measure and send your shortcut. Yes you could send it as a shortcut instead of MIDI message if you would like.

 

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

 

This should do what you are looking for.

Your DAW will need to be set up to send MIDI Start Messages when you start the music and to be able to send MIDI sync message thereafter.

You push the note 60 on your external controller (or change to whatever incoming message you want) and when the next measure starts (assuming 4/4 timing) the project will send out a Program Change 4 to your DAW, but you can change that to whatever MIDI message or keystroke you want to send.

The value for 4/4 timing is 4*24 or 96

The value for 3/4 timing is 3*24 or 72

This value is changed as global variable g0 in the rules of translator 0.3. Changing and restart the project to re-initialize it to the timing you want.

 

 

 

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


Attachments:
1571024792074_song-start-2019-10-13.bmtp

Hi, the project file I posted yesterday had a few errors.

1- I set initial value to 96 and when I count to 0 it ends up counting 97 for each member, so over time the beat gets off.

2- I put the Initialize Global variables in the wrong translator.

3- I added comments so you could understand more how I did this.

 


Attachments:
1571055431908_song-start-2019-10-14.bmtp

Thank you very much for the project file! I will test it out this evening on my side.

Best regards