MIDI real-time quantization

Hello Bomers,

I am looking forward to create code to quantize incoming midi note-on messages not only to my MIDI clock but also to the beat.

I want to buffer MIDI note-on messages and at the same time count the MIDI clock messages after the MIDI start message. Then I want to play back all MIDI Note-on messages in the buffer at once, if the first beat of a 4/4 measure occurs.

This I call MIDI real-time quantization according my beat. I need that to control multiple Arpeggiators in my Acces Virus TI2 Multimode patch.

I want my arpeggiator not to start immediately if I press some keys. Instead I want the Arpeggiator only to start on the first beat of a 4/4 measure. To do so, I need to buffer the midi-note-on messages and play them, if the right time in my time grid has occurred.

Is that possible with the Bome box?

Hi and welcome to the Bome Community!

BomeBox itself would not be able to do this but with some extensive programming in Bome MIDI Translator Pro (MT Pro), you could probably load a project file into BomeBox and achieve this. You would also need to purchase MT Pro. Keep in mind, that the more message you need to queue up, the more complex it would be to program in MT Pro. Delaying the start (without tracking previous incoming notes), is much easer to program but also requires an MT Pro project running on the BomeBox.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

Thank you for your kind answer. I have already briefly checked the cooperation of the Bome box and the MT Pro application, and I was aware of this.

You are right, I don’t need to queue up a lot of messages. In fact I want to play back only these notes that still are pressed on the keyboard. But remember: I want to play them not immediately, but delayed. So I have to store them in variables for later playback.

For example a 3-notes chord on the left hand and a 2-notes chord on the right hand - both controlling different Arpeggiators of my Access Virus TI2.

And the delay time is not fixed. The delay is always according to the midi clock. To do so, I have to count the midi clock messages since the midi start message has occurred. If the counter has reached the number of ticks that correspond to 1 bar (or to 1/2, 1/4, 1/8 - according to my configuration) I need to send the formerly stored note-on messages to the output.

Since I am a software developer, it should not be too difficult. The only difficulty that I currently see, is that the simple script language of MT pro is much more simple than the high level programming languages (like C) that I am used to use.

If you tell me, that this is possible, I will give it a try.

Yes it is possible with MT Pro but as you said, the programming might be a bit of a challenge.

You need global variables for queued notes (MT Pro does not do arrays yet). And then you count timing click messages after the start message and release the queued notes every 96 (4*24 for 4/4 time) clocks if you want to release them on the down beat. When you release them you unallocate the global variable.

If you only allow for a few queued notes, things are not to difficult.

I suggest you get the free trial version of MTPro if you don’t mind the 20 minute timeout. I’ll see if I can find something that can help with some of this. I’ve done some before but not sure where I put it.

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like

I have already prepared a flow chart, on how this algorithm has to work. My biggest concern is, that MT pro has no array element to work as a buffer. But there are workarounds.

Yes, if you have 5 notes just create 5 global variables (ie g1-g5) to store the last 5 notes played.
Set empty slots as gx=-1.

You can then create an algorithm to fill empty slots. You use their note numbers when allocated. When de-allocated set them back to -1.

Then you use a repeating timer to send the notes on the next required clock signal (counting timing clock). Once sent you release the slots by setting the global variable back to -1.

If you need velocities as well, you will need to 5 more globals to track them.

Here is a little algorithm but be careful because you do not want to be stuck in an infinite loop. I use pp as the incoming note to allocate to an empty slot.

if pp<gb then exit rules, skip Outgoing Action
if pp>gc then exit rules, skip Outgoing Action
// increment note count
gd=gd+1
// set current note
g0=pp
// qq=-1 = note not found = default
qq=-1

// See if we already have it assigned

if pp==g1 then qq=pp
if pp==g2 then qq=pp
if pp==g3 then qq=pp
if pp==g4 then qq=pp
if pp==g5 then qq=pp
if qq==-1 then Goto "Find Slot"
if qq>=0 then Log "Log Found"
//if qq>=0 then exit rules, skip Outgoing Action

// Find a slot to put it in
Label "Find Slot"

// qq=-0  1 = slot found
qq=0
// counter
rr=0
Label "Loop"
if qq==1 then Goto "Done"
// to determine where to store the note
rr=rr+1
// break out of loop if > 5
if rr>5 then Goto "Done"
// occupied already
if g1>-1 then skip next rule
if rr==1 then g1=pp
if g1==pp then Goto "Done"
if g2>-1 then skip next rule
if rr==2 then g2=pp
if g2==pp then Goto "Done"
if g3>-1 then skip next rule
if rr==3 then g3=pp
if g3==pp then Goto "Done"
if g4>-1 then skip next rule
if rr==4 then g4=pp
if g4==pp then Goto "Done"
if g5>-1 then skip next rule
if rr==5 then g5=pp
if g5==pp then Goto "Done"
Goto "Loop"

Label "Done"




I hope this helps!

Steve Caldwell
Bome Customer Care


Also available for paid consulting services: bome@sniz.biz
1 Like