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 hope someone can clear something up for me because internet research doesn't cover this exact question.

I am currently running Cubase with a midi keyboard (Akai MPK49) connected via USB. If I was to try and improve latency times will changing my sound card work on the basis that I still want to connect my keyboard through USB?

My keyboard doesn't go through my any midi sound card, nor do I want it to. But the way I see it is when the keyboard sends a note message to Cubase there's obviously a delay between Cubase sending that sound to the sound card to then replicate that sound through my monitors.

share|improve this question

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.

add comment

2 Answers 2

up vote 5 down vote accepted

Latency is due to the audio driver for the audio card. Cubase uses ASIO-drivers (an invention by Steinberg themselves) which mean they are optimized for the sound card if the manufacturer of the sound card makes ASIO-drivers available.

For sound cards that doesn't support ASIO there are workarounds such as DirectX ASIO (built-in in Cubase IIRC) and Asio4All driver wrapper.

In other words, it doesn't have so much to do with Cubase as to how the drivers work and are configured as well as the system's hardware.

Number one adjustment is always the buffer size. And here's why:

How buffers work

Audio data is processed using double or triple buffering. This is 2 or 3 buffers that are filled with data and then rotated so that while one buffer is played at the sound card, another buffer is filled with new data.

The buffers are rotated based on a timer, so no matter what, the buffers get rotated regardless of what currently is in the buffer. This is because the buffers are of a certain size which is related to data-rate and therefor synchronization - so this is important.

The software fills a buffer (f.ex after a MIDI note is received) and signal that it has finished and then receives a new buffer to fill. The process of rotating buffer is however expensive CPU-wise and to compensate for this one increase buffer size.

If the cost is still too high the CPU cannot process the data fast enough and fill a buffer before it gets rotated resulting in that the buffer contains no data or in some cases uncleared data which will cause noise and gaps in the audio.

This means that the buffer size must be increased more. And now the timer problem arises: the mentioned timer waits for the buffer based on its size. That means the bigger buffer, the longer wait.

If the delay becomes too long (>10ms) you will start to notice the delay when you play the keyboard compared to when the audio arrive at the speakers.

The obvious solution is therefor to tweak the buffer size so that the delay is lower as well as the CPU able to fill them before they get rotated internally.

At this point another factor comes into play, the harddisk if you are loading recordings/samples from disk - this applies also when you freeze tracks (I'm not covering this here, but in essence: the more fragmented it is the more time the disk controller use to look up file chains, seek sectors - with the exception of SSD disks - and load data into memory which add to the load on the CPU).

Some solutions

  • Always use a dedicated ASIO driver. These are optimized and work directly with the soundcard bypassing the system chain and therefor also reducing the CPU usage as well as delays.

  • Tweak the soundcard's buffers so that you find a balance between size and CPU capability. If you have a lot going on in the DAW the more the CPU is strained and therefor require a bigger buffer leading to increased delay. "Freezing" tracks that contains soft-synths and long effect-chains is always wise in these situation.

  • Optimize the harddisk by defragmenting it (seek permanent solutions such as Diskeeper). Can you reformat the disk with larger sector sizes then this is preferred (use f.ex. 16kb block sizes). This way more data is loaded per request and reduces overhead due to number of requests.

  • Is there enough memory in the computer so it doesn't swap to page file which again increase the bottleneck regarding the harddisk? Cubase is not necessarily having its data swapped, but other parts of the system may. Again, freezing tracks is a good way to get around this problem as well if putting in more memory isn't an option.

  • Do you work in 32-float? Try reducing to 24-bit or even 16-bit if needed. 16-bit consume only 50% of the data amount compared to 24-bit integer and 32-bits float, and is easier to process. At the final stage set 24-bit for render (Cubase uses 32-bit float internally when doing a final render). If you use samples this isn't always an option, but you can work with downsampled version of them and replace them at the final stage. It also affect some soft-synths as well as effects that adopt to the project's bit-resolution and therefor uses more CPU to process the sounds.

  • Upgrade hardware.

share|improve this answer
    
Amazing information, thank you for your effort. If it wasn't for my reputation points I'd '+1' your comment. Would you agree with the other answer on this topic that the software synthesizer plays a part in this issue also? –  cworner1 Jan 10 '13 at 10:43
    
@cworner1 No problem. Certainly, softsynths are a factor as they process everything (excluding helper-hardware which do exist) on the CPU, but anything doing this like effects (especially reverb and complex dynamics) do this too "preventing" the cpu to fill the buffers. It's all about how much cpu-time the CPU has left after X processes something. –  Ken Fyrstenberg Jan 10 '13 at 13:54
    
@cworner1 Don't worry, I +1'd it for you since it's a good answer :) –  Warrior Bob Jan 10 '13 at 15:53
add comment

the biggest portion of latency is almost always in the software synthesizer.

the lame ones (who don't use the minimum latency that the sound card says it can handle) have to be configured for the number of millisecs of audio they will buffer. Or, if they're REALLY lame, you won't be able to change that buffer size and will have to just suffer with their latency (I'm looking at you, built in Microsoft Synthesizer)

You will notice that exact number of millisec latency plus a couple more if you're playing tons of chords at once, etc. (midi latency).

share|improve this answer
    
That's very interesting. I obviously need to research more into this. I'm using "Microsoft GS Wavetable SW" which I presume is rubbish. So is it just the case of downloading better software or is this something that is paired with a better sound card? Could you recommend one? –  cworner1 Jan 10 '13 at 10:36
    
I'm pretty sure you can't get around the latency of the "Microsoft GS Wavetable SW" synth. There are a ton of VSTs out there, but don't ask me for help with them. The only softsynth I can =recommend= is the one I wrote. SYN which is part of the install at pianocheetah.com - however, it'll only work with the midi sequencer it comes with (PianoCheetah). If you need any help with it, my email is on the homepage, too, and I will DEFINITELY help ya with it - it's my top priority :) –  Stephen Hazel Jan 10 '13 at 16:31
    
I need to do my research. I don't fully understand what the GS wavetable does really. I have read it up but I don't fully understand it. Thus everything else you just explained is out of my depth. Thank you for help. Really appreciated. I would "+1" but my reputation points won't allow me. –  cworner1 Jan 10 '13 at 16:33
    
oh i don't care about +1 stuff:) If your keyboard doesn't generate sound (I think you have a controller keyboard, right?) then it'll just send midi keypress info to your pc. Your pc turns those keypress "note on" and "note off"s into audio in that "Microsoft GS Wavetable SW" (a possible software synthesizer to use). You may want to read up about midi over here: pianocheetah.com/midi and about piano basics here: pianocheetah.com/piano –  Stephen Hazel Jan 10 '13 at 17:58
    
Correct, and thank you. I will have a look. –  cworner1 Jan 10 '13 at 18:30
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.