MIDI Latency Problem in Nuendo

Genius Gone Insane

http://www.¯\(°_o)/¯.com
Aug 19, 2003
5,721
18
38
San Francisco Bay Area
www. ̄\(°_o)
I'm running an electronic drumkit into Nuendo (Digi001) and the MIDI track has a latency issue, about a split second. I know for sure this problem is somewhere in the 001 or Nuendo -- I'm sure there is very little latency coming out of the drumkit.

I've been working around it by sliding the "delay" knob back in Nuendo.
The main problem is that there is no consistent delay amount, i.e. it changes with every take, so I can't have one delay setting that works for the whole MIDI track.

Is this a Nuendo issue or an 001 issue?
 
Are just trying to record the midi info, or have the drums in realtime via a plugin?

I just had that problem with a Keyboardist from a videogame band. he forgot his keyboard so i set him up with a old sampler i use as a controller. The guy was actually compensating for the latency by playing all his parts ahead of the beat!
 
Are just trying to record the midi info, or have the drums in realtime via a plugin?

I just had that problem with a Keyboardist from a videogame band. he forgot his keyboard so i set him up with a old sampler i use as a controller. The guy was actually compensating for the latency by playing all his parts ahead of the beat!

Unbelievable!!!

I just want to record the midi info. I've got audio from the brain going to the monitors, and that works fine.

I just don't like having to realign the MIDI over and over after each take. It would be fine if every take there was exactly a 200ms delay, but it switches every take!

PS: I tried a midi keyboard and had the same delay issue - definitely it's not a problem with the electric kit.
 
euh, dunno if its the same thing but....
in cubase if I import a midi file, it does have a latency when you try to switch on the click. its not synchronised to it. there is some kind of latency. i can also correct by slightly moving this "delay" thing.

anyhow, when i route this midi track into a VSTi, the latency does disappear.
 
FYI This is great (I'll post the text just in case the link dies):

http://www.jay.fm/blog/cat_technical.html


May 15, 2004
PC MIDI Timing and Nuendo
Updated
Users of Steinberg’s Nuendo and Cubase often run into trouble with MIDI timing. I’m not affiliated with Steinberg, but I am a programmer, and I’ve done a lot of experimenting with MIDI timing on the PC. Here is, I hope, the definitive list of problems and workarounds. Note that I talk mostly about Nuendo here, but Nuendo and Cubase SX are the same application under the covers, and everything I write applies to both. The explanations are lengthy, but it’s a complicated topic, where many problems can cause the same system, and I think it’s important to understand the background; if you think I should provide a long and short version of this FAQ, leave a comment to that effect.

1. Emulated Ports
By far, the most common cause of MIDI timing problems is using emulated MIDI ports. Once upon a time, there was only one type of MIDI driver, known as Windows MIDI. Later on, Microsoft introduced a new driver type, DirectMusic, which could theoretically offer better timing, but due to some limitations, this was mostly taken advantage of by gaming cards, not pro-audio cards.

To encourage application developers to switch from Windows MIDI to DirectMusic, Windows provides “emulated” DirectMusic ports for all Windows MIDI drivers; as far as the application knows, it’s talking to a genuine DirectMusic driver, with Windows doing the translation under the covers. This means that an application like Nuendo can, in theory, be written solely to the DirectMusic interface, and if your card doesn’t actually support DirectMusic, Windows will cover for it.

The reality is more complicated; sometimes the emulated DirectMusic drivers don’t work at all, or only work in one direction. Sometimes the emulated ports don’t work but the original Windows MIDI ports do. Sometimes the timing is off on one port or the other. Sometimes there are actually both Windows MIDI and genuine DirectMusic drivers for a device. So if there is both a Windows MIDI and DirectMusic version of a port, Nuendo tries to guess which one is the right one, and it filters out the other. Sometimes—usually, in my experience—it guesses wrong, especially where emulated ports are involved. And on some systems, though certainly not all, the emulated ports have timing problems.

(By the way, these two driver types—driver APIs, really—have nothing to do with WDM vs. MME drivers. Those are driver models, and affect how a driver is built, not what API it uses. A WDM driver can be either Windows MIDI or DirectMusic, and I believe the same is true of MME. We don’t care about WDM vs. MME here.)

The fix
Nuendo keeps a zero-length file called ignoreportfilter in the directory C:\Program Files\Steinberg\Nuendo\MIDI Port Enabler. Using Windows Explorer, you can drag this file up one level to the Nuendo directory, restart Nuendo, and you will now see both the emulated and non-emulated ports. In my experience, you nearly always want the non-emulated ports; you should go into Device Setup and set “Show” to “No” for the emulated DirectMusic ports so that you don’t accidentally use them.

This will only solve your problem if yours is a system where the emulated ports have timing issues. On my system, they don’t.

2. The two-clock problem
All MIDI interfaces on Windows timestamp their data before providing it to the application. This avoids timing problems when the application doesn’t immediately see the incoming notes, perhaps due to higher-priority interrupts, or things chewing up CPU time, or simply a burst of notes too quick for the app to process. The app just looks at the timestamp, does a quick calculation, and poof: instant latency compensation for all MIDI. This has been part of the MIDI driver spec forever.

But Windows provides two different multimedia timers - specifically, one called timeGetTime, or TGT, and one called QueryPerformanceCounter, or QPC. The QPC timer is more precise (although the actual precision is up to the motherboard), and often more accurate, but it’s only available on newer versions of Windows, and there were some motherboards a while back that had major inaccuracies with it, and some current dual-CPU boards still don’t keep the two CPUs in sync.

So drivers, especially Windows MIDI drivers, that descend from older code, or have to work on older OS’s, or that are simply more cautious, are likely to use TGT, which is what Nuendo normally uses; the VST and ASIO specs are based on TGT. Newer drivers, especially those written under DirectMusic, are likely to use QPC. Since the two end up out of sync on most PCs, you’ll end up with timing problems in Nuendo if your MIDI driver uses QPC.

This problem is likely to affect any sequencer, not just Nuendo - although some sequencers might be based around QPC instead of TGT, and thus they’ll have problems with exactly the interfaces that work fine on Nuendo and vice versa. Sonar does have a hidden option that lets you ignore ALL timestamping from the interface, which is fine unless Sonar can’t keep up with the interface, at which point you’ll have really sloppy timing on ANY interface.

The fix
Nuendo and Cubase 2.20 provide an option in the DirectMusic settings called “Use system timestamp”. This tells Nuendo that for MIDI tracks, they should keep track of time using QPC, not TGT. This affects only DirectMusic drivers. That means that if you have a Windows MIDI driver that uses QPC, you’ll have to use the emulated DirectMusic drivers, which is the exact opposite of what is normally recommended! Hopefully future versions will offer this option in both DirectMusic and Windows MIDI flavors. Meanwhile, hopefully your system isn’t one of those that has timing problems on the emulated ports. My system, an Asus P4C800-E, doesn’t, but certainly some do. A future version of MIDITime will test DirectMusic emulated ports as well, so you’ll know exactly what you’re up against.

The test
If you want to be certain that this is the problem you’re having, and help out the user community at the same time, you can download my MIDITime Utility. You take a cable from a MIDI output port to a MIDI input port, and run the utility until your clocks get out of sync; it then tells you which clock is correct, and thus what setting to use. Simple and definitive.

And please, if you run the utility, and your interface isn’t already listed below, e-mail me the results so I can share them! (I’d prefer that you not leave them as comments, so others don’t have to wade through the details.) The utility can take up to an hour to run (it waits that long to decide that your clocks are staying in sync), but more often takes about 5 minutes.

If there are any Windows programmers out there interested in slapping a simple GUI on this app, drop me a line. I never bothered to learn MFC, and with Windows.Forms and .NET coming of age, it’s not really worth it now.

The results
The following MIDI interfaces will work best with the DirectMusic emulated ports and the “Use System Timestamp” option checked:

Echo Mia
EMU 1212M
Frontier Design Dakota
M-Audio 410 Firewire
M-Audio Audiophile 2496
MOTU 828 MKII
MOTU Express XT
MOTU MTP-AV
Steinberg MIDEX-8
Terratec EWS88MT
Yamaha SW1000XG
The following MIDI interfaces will work best with the native DirectMusic ports and the “Use System Timestamp” option checked:

Wami Rack-24
The following MIDI interfaces will work best with the “Use System Timestamp” option unchecked, and (presumably) the non-emulated Windows MIDI ports:

Aardvark LX6
Aardvark Q10
Edirol UMT-880
Digi 001
Emagic Unitor8 MK1
Emagic Unitor8 MK2
Emagic AMT-8
M-Audio MIDISport
RME Digiface
RME 9632
Roland SC-8820
Roland Super MPU-64
Roland UM-4
The following lucky motherboards have clocks that don’t drift, and so can use any interface with any setting:

Asus A7V333
Asus A7N8X-X
Asus P4D-800D
Asus P4T-533C
Asus TUSL2-C
3. Constrain Latency Compensation
One person has reported that using the Constrain Latency Compensation option—which should, in theory, affect only audio—also improved his MIDI timing. This has not been confirmed by other reports, but it’s certainly easy enough to try. If you find this setting to be helpful, please let me know.

Posted by Jay Levitt at 12:55 AM | Comments (59) | TrackBack