MIDI Quantization during Recording?

Is it possible that C3 is aligning recorded MIDI Notes on 1msec boundaries?

I am recording two streams of MIDI over USB into a single .MID file. The streams are related, in that they arrive from the same source over different paths (I am doing latency tests). One stream is always behind the other (as expected), but the latency is always an exact multiple of 1.00 msec.

I am measuring the time difference by opening the MIDI file in Reaper.

When I record the same setup directly in Reaper, I get no such “quantization” effect. Latency varies from test to test at the sample level.

Here is a diagram of my test setup:

My two signal paths are a direct USB link and a Radio link to a receiver. You can see that the latency between the two - in Samples at 44.1 kHz - is always a multiple of 44.1. All of my latency numbers are (in samples) 44, 88, 132, etc.

Has anyone experienced this in Cantabile??

Here’s another example of what I am calling MIDI “quantization” …

The text on the graphic (in case it is not readable) reads:

11 tests of MIDI RTL (Round Trip Latency) on 18Dec2021 with a physical DIN5
loopback cable on a M-Audio MidiSport 2x2 Anniversary Edition MIDI interface
showed RTL times of:
265, 309, 309, 309, 309,
265, 265, 309, 309, 309,
and 309 samples @ 44.1 kHz,
when measured in Reaper. These results demonstrate a “quantization” of the recorded
MIDI notes on 1.000 msec boundaries:
265 samples @ 44.1 kHz = 6.009 msec
309 samples @ 44.1 kHz = 7.007 msec

I am hoping that maybe @brad or someone else experienced in this area can shed some light on this phenomenon … I am hesitant to do more testing using Cantabile with this suspect behavior.

Hi Clint,

I found this explanation of why MIDI works in mS and possibly it can explain your delay findings.


1 Like

I’m not surprised that you get quantisation of MIDI notes using classic DIN cables - remember, MIDI is a serial protocol - and a relatively slow one. So there is an exact time it takes to transmit a MIDI note, and to reconstitute it from its individual bits. The time to send 3 bytes along this serial connection is 960 microseconds - almost a millisecond. So that should explain the quantisation with the DIN connection. So nothing funky involved at the Cantabile end of things - just the nature of the connection, I suspect…

I don’t think that this would happen over an all-USB connection, though. Transporting bits along a USB connection happens a lot faster. But of course your Sylpho wireless link will also have some serial comms involved in its transmission mechanism that may have similar speeds to “wired” MIDI, so it may actually have similar characteristics.

I would suspect that the “later” stream is the wireless one - correct? In that case, that would lead me to suspect that the wireless communication mechanism has a similar data rate to “classic” MIDI

Hope this helps!



1 Like

Thank you to both @Torsten and @dave_dore for the info!

One thing that may confound timing is the “running status byte” optimization in MIDI (good explanation Here).

However, I did a direct comparison (same hardware config) between Reaper and Cantabile, and get very different results. Reaper results are quantized, but at a smaller granularity than Cantabile (0.522 vs. 1.000 msec or 23 vs. 44 samples) and Round Trip Latency (RTL) is lower in Reaper than Cantabile (4.59 vs. 7.70 msec).

The host, MIDI driver, MIDI files, and analysis method are the same for both tests. I can only think that there is some significant difference in the way Cantabile handles MIDI that produces these different results.

Here are the diagrams (and info) for these two tests, first using Reaper as the DAW:

… and then using Cantabile as the DAW:

Any thoughts are welcome! (I’m runnin out of ideas …)

[EDIT: Corrected the two diagrams]

It looks like the setting of the Buffer Size on the Audio interface affects the MIDI RTL
(Round Trip Latency). I did tests using the Null Audio driver. When I changed the Buffer Size from 64 to 4096, the MIDI RTL shot up from 4.2 msec to over 85 msec.

I’m not sure how the Audio Buffer comes into play for MIDI operations. However, Reaper seems to have the same behavior: when using the Dummy Audio driver in Reaper, the setting of the Buffer Size had a similar effect on MIDI RTL.

As an aside, I’m curious why Cantabile does not allow a Buffer Size of 0 on the Null Audio driver. Reaper does. The minimum Null Audio buffer size is 64 in Cantabile.

This addresses the issue that MIDI RTL times were higher in Cantabile than Reaper, but does not address the primary issue of this thread: Quantization of MIDI events recorded by Cantabile on 1 msec boundaries.

Here is the diagram with specifics of the test:

I just ran similar tests on two other MIDI interfaces - the MIDI ports on an RME UCX II and the MIDI ports on an Aodyo Link Receiver. Both had similar results to the M-Audio MidiSport 2x2 interface: the MIDI Round Trip Latency is dependent on the Buffer Size setting of whatever audio driver is in use (including Null Audio).

I am randomly wondering if the half-duplex nature of USB 2.0 is causing the 1 msec “quantization” of MIDI that I am seeing. In doing an RTL (Round-Trip Latency) test, I am sending a MIDI command down the wire and then listening for how long it takes to come back.

Is there a cost of change-in-direction in USB 2.0? … and might that explain my results being aligned on 1msec boundaries?

1 millisecond? That’s faster than a speeding bullet and that never slowed Superman! :wink:

… is the quantization of the MIDI that I am seeing … i.e. MIDI commands are aligned on exactly 1 msec boundaries … sometimes I get MIDI returned at 1.000 msec and at other times I get MIDI returned in as late as 12.000 msec, with no discernable. So, this basically gives me 11.000 msec of jitter.

A bit disconcerting to see (and it also feels that way when I’m playing …)

Also, I was doing this with “cleaned up” MIDI - only Note On/Note Off events. When I add the CC commands - which my Sylphyo wind synth can generate up to 1000 x per second for Breath Pressure - things can get bad fast for latency. In practice, I reduce CC#2 to 125x or 250x per second, to allow for pitch bends and all the other CC’s (pitch, yaw, and roll) that the Sylphyo generates …

Ah, yes, to be young again! I’m 72 yo and have slowed WAY down. That’s why my EWI5000 and Cantabile 3 are fast enough for my needs. :notes::+1:

1 Like