Latency and keyboard design issues in real and virtual pianos

I’m blaming the Jitter – today… :grimacing:

Terry

2 Likes

My suck factor is not spontaneous…more like chronic, and nothing to do with software.

3 Likes

He writes " many software instrument hosts don’t use MIDI event timestamps"
Hosts, as opposed to DAWs.

Try this test.

  1. Record a click in your DAW and quantize it. Tight transient click sound like Omnisphere’s UREI click.
  2. Export the audio and import into Cantabile.
  3. Play the file in Cantabile and play along live with the same transient sound. Pan left and right for clarity.
  4. Record the result in Cantabile’s recorder and then bring the file back into your DAW.

How tight was your live performance compared to the quantized click. Was it consistently one way or the other?
If you raise your audio device’s buffer and repeat the test, what changes. And if you lower it?
Can you configure your DAW to send MIDI to Cantabile?
Try the same test using the MIDI from your DAW to trigger the Omnisphere (or whatever) that is in Cantabile and have Cantabile threshold record the audio.
Look at the result back in your DAW, comparing the original DAW audio with the Cantabile recorded audio.
Line up one of the clicks on one hit and then compare the others.
Always in the same relative position? It should be.

Something else to consider is that we make relatively little demand on the midi inputs to our live Cantabile systems as compared to what we expect on playback from our DAWs. The potential for a train wreck of incoming midi is pretty unlikely - but this will be an interesting geekout. :slight_smile:

1 Like

OK - I have one result to kick things off.
Used the second approach - more reliable.
So…
1.Using Nuendo, recorded and quantized a 4’s midi track to trigger Omnisphere UREI click.
Exported the track so that Nuendo now has an audio file in it which looks perfect to the grid, as we would expect. There’s no jitter on playback of DAW midi. (Or shouldn’t be!!)
2. Used loopMIDI to fire the same midi track from Nuendo into Cantabile which was running Omnisphere UREI click.
3. Used the Autorecord Cantabile to create an audio file of the Cantabile hosted Omnisphere.
(this is pretty much ‘live’ midi as far as Cantabile is concerned)
4. Brought the Cantabile audio file into Nuendo

As we have employed threshold recording in Cantabile, we can’t really expect the files to line up, but I wanted a quick test… so… lining up the start of the files, the 2nd Cantabile click (the first we can see in it’s entirety) is 2 ms early. This doesn’t really mean much as all it tells us is when the threshold kicked in, it lost a few samples and so the second click will inevitably be ahead.

Lined the 2nd click up to the sample. Nuendo is the green file

The 3rd click was also perfect.
However… 4th click, Cantabile was 33 samples @48k earlier. That’s less than 1 ms.

Up around the 10th click, Cantabile came in 17 samples late. You would detect any of these as a slight phase shift rather than delay.


The most important thing to take on board is that the variation moves earlier, later and can also be spot on. The tolerances are tiny. No one is going to detect that.
What you might detect is the difference in quality of the midi interface from your controller or the interface.
There are definitely superior interfaces - and cabling matters too.
loopMidi will be faster than any hardware, I’m fairly sure.
I did some tests a few years back on a MOTU MTP AV and with a 15’ USB cable, the performance dropped from around 4ms to around 15ms to process one note. Cables matter.
Anyway, that was an hour of my life devoted to geekdom. :slight_smile:

Oh something to add in;
As Cantabile can’t predict incoming notes, we must assume that anything we see as ‘early’ in the above test is, at best, spot on, and anything that’s late is, in fact, even a little later. As I never saw anything over 1 ms it’s safe to say that jitter could not make any detectable difference. MIDI as a protocol will be doing WAY more damage :bowling:

5 Likes

A little addition;
Cantabile produced a simultaneous MIDI file in which
5 notes out of 84 were 3 ticks late,
22 were 2 ticks late and
the remainder were split between 0 and 1.
No MIDI clock involved. Cantabile set to record at first midi trigger and audio threshold exceeded.
480 PPQ

And looping Nuendo back into itself via loopMIDI, mostly perfect except for about 5 notes which were 9 ticks out!!

1 Like

@Corky
LOL - same here.
Comes from having a ‘meat’ computer for a controller …

1 Like

Interesting coincidence. I’ve been fiddling around with MIDI and VST in Delphi (programming environment) for a few days and discovered a few traps for young players.

The main one was the difference between USB to MIDI converters and direct USB to synth. Of course the converters are for ‘old’ equipment. Anyway the upshot was that the USB to MIDI converters introduce serious latency compared to direct USB.

Whilst I thought MIDI was a slow ponderous protocol where you had plenty of time to do stuff in modern fast computers it turns out that NO you need to tighten up the code. I mean we used to use old Ataris to work MIDI so you’d think current multicore monsters would be able to go out and have a coffee and a smoke between MIDI events.
All the attention goes into the Audio stuff and the MIDI programming is just tacked on with the same old code.

-Technical stuff
Most of us programmers cavalierly use the Window WINMM libraries and the Windows message loop and this might be a big part of the problem. There doesn’t seem to be an ‘ASIO’ for MIDI.

1 Like

@terrybritton
Like having all the hammers out by different amounts - no doubt some old nails do have that problem not having been serviced for 50 years.
So much for modern tech …
:slight_smile:

2 Likes