Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

I am very new to this field, so please bear with me.

When recording MIDI, there are several kinds of annoying delays. I would like to know what can I do to reduce/eliminate this by changing settings, or, when this is not possible on basic hardware, what kind of (cheap -- for home) hardware do I need?

I have to deal with two kinds of delay:

  1. When playing from a connected MIDI keyboard through a software synthesizer such as Kontakt, there's a tiny delay between pressing a key and hearing the sound. Even though it is a very short delay, it makes it impossible to play fast. What is needed to minimize this delay? Is the CPU speed significant, or does it depend on the sound card? There's a setting in Kontakt to compromise between quality (crackle) and latency. I can turn it down to 50 ms, but I'm not sure this figure is correct (it's still too slow). When using ASIO4ALL, the program claims a delay of 13 ms, but in practice it feels similar to what I get with DirectX.

  2. When recording a new MIDI track in Cubase (at the same time as playing the existing tracks), in the final result there will be a short delay between the previously existing and the newly recorded track. It is possible to correct this later manually. Is it possible to change settings to correct this? (This must be possible if the computer can know how great the delay is due to different factors, and automatically shifts the new track in time to correct for it.)

EDIT: This is on Windows XP, but I'm also interested in Windows 7 solutions.

share|improve this question
    
You should be able to get delay down to less than 10ms for sure, if not a lot less. On a much older (circa 2004) computer that I have here, I've been able to get sub 10ms delays on MIDI to synth. –  Naftuli Tzvi Kay Oct 26 '11 at 22:53
    
@TKKocheran Do you have a dedicated sound card in that machine? Is it the root cause of the problem indeed that I use on-board sound? Also, do you think the delays reported by software are accurate, or just a lower bound on the actual delay? –  Szabolcs Oct 27 '11 at 7:00
    
for comparision, I used to use onboard sound for my guitar(s) (not midi) and was able to get about 10ms with asio4all. DirectX or wav was impossible to use. In my case, setting 96k instead of 48 or 44 was what got the number down. I think asio4all buffer was default (512?). Remember to fiddle with the asio4all config from within the application you are using (Kontakt etc) –  horatio Oct 27 '11 at 21:23
    
@Szabolcs, I did have one, but I didn't really utilize it. I was running a Firepod, so it handled all of the processing, and I could get latency really low. Even with my USB M-Audio MIDI controller, I could get latency really really low, so I don't know what the problem seems to be with your setup. –  Naftuli Tzvi Kay Oct 27 '11 at 21:57
add comment

migrated from avp.stackexchange.com Jan 24 at 18:30

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

3 Answers

up vote 5 down vote accepted

Here are all the places I know of between pressing a key and hearing the sound where latency is likely to be introduced:

  1. Your MIDI interface: This might be built into your keyboard or it might be another device with a female DIN jack on it. Some of these are less latent than others, but the variation is usually pretty small. However, a lot of these work over...
  2. USB: USB generally introduces a nonzero amount of latency. It's usually not much though, unless your USB bus is flooded with data. Firewire has this problem as well, although IMHO to a much smaller extent.
  3. Audio buffers: Processing digital audio involves sampling a short amount of it and then processing those samples. Your plugins all do this, as do parts of your environment (Cubase, in your case). Again, it's pretty short and not likely to be noticed, unless you have a plugin that needs a particularly large buffer. Most of those will have a setting, like you found in Kontakt, for the length of the buffer. Smaller buffer, less latency.
  4. Output buffer: This is the big buffer that stores the output of your audio software on its way to your soundcard, and is the source of most latency problems. This is the one that is managed by ASIO drivers on Windows, and Core Audio on OSX. This buffer tends to be larger, because it's insurance against pops and clicks that can occur when audio software has to compete for system resources. The bigger the buffer, the longer you can wait before having to calculate some more samples.
  5. Driver/hardware: Some audio hardware (or drivers) can include their own internal latency. This is not easily detectible since it doesn't have to be reported to the OS, like the output buffer does.

50 ms is a lot of latency in this kind of situation. You have said that Asio4All reports 13ms of latency, which is troublesome but not unusable. And it may be correct: that output buffer may well be 13ms long. But what about Kontakt's buffer? If that plugin has its own internal delay, then that'll be added to whatever Asio4All is working with. Most modern computers, unless they're bogged down with background processes, ought to be able to get under 15-20ms without too much trouble.

In general, the trick is to figure out the minimum latency you can work with without running out of buffer under load, which will sound like popping and glitches. Your limitations are the free resources in your system: available CPU, RAM, and I/O. Your integrated soundcard is probably fine latencywise, so long as it plays nicely with Asio4All. It might not. Try playing back basic audio recordings in a program like Cubase, using no plugins, and see what the latency feels like - this will eliminate Kontakt from the equation. How long after you press play is it until you hear sound? Maybe play along with a simple softsynth such as Synth1 that isn't processing anything terribly complicated (turn the effects off).

As an aside, it's a good idea to look for things that might be intermittently ruining your audio stream, and get rid of them. On my Macbook Pro, which is plenty powerful for audio, I still get audio dropouts when the wireless finds a new network. When working with audio, I generally turn wifi and bluetooth off.

As for your second question about offsets in recording, the recording environment does know the ASIO buffer size and many of them have an automatic compensation feature. However, it generally does not know the delay due to your audio drivers, nor due to your MIDI interface. Some software (I know Ableton Live has this, not sure about Cubase) allows you to specify the amount of latency above the ASIO buffer if you happen to know it or can measure it, and it will compensate your recordings based on whatever you put in.

share|improve this answer
add comment

Assuming that you have a modern processor and a decent amount of RAM, the weak link in the chain is likely to be your built-in sound chip, or the sound chip drivers, or a combination of both.

Again assuming that you're playing to a click, the reason that the MIDI appears to be late, is that the click is reaching your ears late, because of the excessive latency in your sound chip/sound chip drivers.

On Windows, for decent response, you really need ASIO drivers. The most important feature that they provide is a proper system of timing/synchronisation. When working with anything more complicated than iTunes, these elements are of the utmost importance.

If you were on a Mac, things would be slightly different - Mac audio drivers use an API known as CoreAudio, which does provide the proper timing and synchronisation. This is not to say Macs are superior - indeed many of them probably have exactly the same sound chip that you've got. Decent hardware drivers are key here!

Here are the steps I would try to rectify this:

  • Download and install the latest drivers for your sound card from the manufacturer website. If you're lucky, they'll provide ASIO drivers.
  • ASIO4ALL is a good stop gap for those that don't have access to ASIO drivers for their sound card. However, it's really a make or break solution - it either works perfectly or you're back to step one. I've also known ASIO4ALL to cause kernel panics in Windows (also known as the blue screen of death or BSOD). Simply un-installing it will revert this behaviour.
  • Finally, if those two don't work, look into purchasing a decent USB/FireWire external sound card. There are many manufacturers out there. Go to someone like Sound on Sound for decent, well-informed and independent advice.
share|improve this answer
add comment

Delay comes from different sources but it mainly comes from the sound card. Your sound card is just like your graphics card "if you want to play fancy games you will have to get one that makes all that calculations on time".

Which card are you using?

share|improve this answer
    
It's an integrated laptop card, so I don't expect much from it. But being inexperienced, it was not clear to me if the main cause of "MIDI to synth" delay is indeed the sound card, and if the way to go is getting a better one. However, the other type of delay (when recording an additional MIDI track) should surely be possible to eliminate on any type of hardware where the delay is at least consistent? –  Szabolcs Oct 27 '11 at 6:58
    
Your sound card also processes the MIDI... so yes. –  fénix Oct 27 '11 at 16:22
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.