Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 at 18:30

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

    
Sorry to necro this thread but I was referred here after posting a similar question. I'm currently trying to fix my latency problems with MIDI input for Sibelius. While the above info is good to know, I've already spent a couple hours experimenting with my on-board equipment and settings (Windows 7, motherboard sound card) and I think at this point, the easiest and most foolproof solution for me is to buy an ASIO-supported sound card. I guess I didn't realize what a technical and niche area this is, since even searches I'm doing aren't turning back much info on a relatively low cost, ASIO supp – user12760 Jan 20 '15 at 19:24
    
(continued)...ASIO supported card, which (I think) is all I need. Does anyone have some product recs? Am I way off base about all this? I come from the music side, not the computer side, and really my goal is to get up and running ASAP. Thanks - user12760 – JoshP Jan 20 '15 at 20:11
    
The only card I can recommend is the only one I have experience with which is the RME Fireface. It's very pricey but you get what you pay for: Small latency times and solid drivers. Before this I bought an entry model audio interface and I had nothing but problems. Poor audio, connection was dropping out. So I can only recommend you search the internet for "Audio Interface", look at what you can get for your budget and read all the reviews you can for that device. Hope this helps – cworner1 Jan 22 '15 at 15:04
up vote 10 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

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

How I FINALLY won my MIDI latency war (Cubase 7 x64, BabyFace interface, Win7 pro x64)

First, here's how I measured my real latency in milliseconds:

  • Set up your system and DAW optimized as best you can.
  • Record, using another device like an iPhone, the sound of your finger hitting the keyboard followed by the sound of your virtual instrument.
  • Email yourself that recording and import the sound file into your DAW
  • Change the scale to show seconds. Zoom in if needed.
  • Move the sound file so the first peak (the sound of your finger hitting the keyboard) is positioned at 0.
  • Count the ticks between the sound of your finger hitting the key and the actual sound. If your MIDI produced sound peaks at 9 ticks between 0 and before 0.1 seconds, that's a 9ms latency. If the triggered sound shows up at 0.2 seconds, that is a 200ms latency, and so on.
  • NOTE: If you slowly press a key on your keyboard until you find the spot at which the sound is triggered, you may notice that this is not a fair test because the A-88, just like a real piano, has some smooth movement with no sound, then hits a bit more resistance and at this point the sound is triggered. Thus, the real trigger point for the sound on the A88 is between your finger hitting the key and the key bouncing back up after you hit it.

After doing everything below, Cubase 7.0.7 tells me I have a 1.656 ms input latency and 1.99 ms output latency. The real measured latency using the method above, is now around 4 ms.

For many of you anything under 10 ms will seem great, but compared to playing a real acoustic piano as a professional musician 8.5 ms was driving me nuts.

Here's my 2016 Secret Low Latency Recipe!

  1. Good MIDI keyboard. I'm using the Roland A-88 with 88 weighted keys.
  2. Good Interface. I'm using a Babyface, which is taking the MIDI output from the A-88.
  3. Update Interface Driver/Firmware. Using latest drivers and firmware from RME. RME Fireface driver 1.089, Hardware revision 223.
  4. Good Hardware (Motherboard): Using a Gigabyte GA-X79-UD3 motherboard. (Built my own silent PC with a fanless power supply and SSD to remove ambient computer noises my microphone was picking up in recordings.)
  5. Good Hardware (CPU): Intel Core i7 3820 @ 3.60GHz
  6. Good Hardware (Memory): 8 GB memory DDr3
  7. Good Hardware (HardDrive): 500GB SDD. ATA Samsung SSD 840 SCSI
  8. Update BIOS: Using latest gigabyte F20 BIOS.
  9. Update chipset drivers: Detected and updated to latest from Intel (http://www.intel.com/content/www/us/en/support/detect.htm).
  10. Latest Windows 7 Professional x64 updates.
  11. Install hotfix for "Sound is lost for a while on a MIDI device" in Windows 7/8. See Microsoft KB Article 2919139.
  12. Update display drivers.
  13. Use just Windows drivers for keyboard and mouse instead of 3rd party.
  14. "Speakers RME Babyface" set to be the default playback device in the Windows Sound settings. For this to show up, on Fireface USB Settings, set WDM Devices to at least 1. Try disabling all but "RME Babyface" in Windows device manager under "Sound, video and game controllers"
  15. Change Windows power management to High Performance.
  16. Disable all background programs not needed for DAW.
  17. Disable Hyper-Threading in BIOS (It can have a negative impact on performance).
  18. Disable TurboBoost in BIOS. (Disable any other power-saving and dynamic performance options for your CPU like Enhanced Intel SpeedStep (EIST), AMD Cool 'n' Quiet, or AMD Turbo CORE.)
  19. Win32 VST Plug-ins may perform poorly in a 64-bit Host Sequencer. In Cubase 7 go to Plugin Information. For each that says "(win32)" stop using that plug-in, move it to a separate folder from the current location and reboot Cubase, repeat until all gone, then verify (Ctrl+Alt+Del and open the Windows Task Manager) that VSTBridgeApp.exe is no longer running.
  20. Change the sample rate in Cubase Project settings from 44.1 kHz to 96.000 kHz.
  21. Change the bit resolution in Cubase Project settings to 24 Bit resolution. Tried 16 bit, no improvement.
  22. With Cubase not running, in Fireface USB Settings (RME icon in Windows tray), change clock mode to 96000 Hz and clock source Internal. 44100 Hz will be double the latency.
  23. In Fireface USB Settings (RME icon in Windows tray) change buffer size to 48 samples (lowest possible). Good interfaces like the Babyface let you get down to at least 48 samples.
  24. In Cubase Device Setup VST Audio System, select "ASIO Fireface USB" ASIO driver. (Has lower Latency than ASIO4All 2.3 http://asio4all.com/)
  25. Cubase Device Setup | VST Audio System | Advanced options | Audio Priority = Normal. If you set this to "Boost" you are giving auto higher priority than MIDI.
  26. Cubase Device Setup | VST Audio System | Advanced options | Multi-Processing. Doesn't seem to matter on or off.
  27. RME TotalMix FX software 1.12 | Options | Settings | MIDI | MiDI Connection In & Out set to None. (These are for using MIDI to control TotalMix, not needed for MIDI keyboard use with Babyface & Cubase).
  28. Cubase Device Setup | VST Audio System | Advanced options | ASIO-Guard off (Cannot be used for real time dependent signals (no link due to low rep). Looking at ASIO-Guard latency, mine says 8.7 ms, which is the real latency I measured.
  29. Cubase Device Setup | MIDI Port Setup, input device is DirectMusic Babface MIDI Port 1 active in 'All MIDI Inputs'. Set "Use System Timestamp for 'DirectMusic' Inputs. On or off, doen't change real midi performance latency.
  30. Turn off unneeded Windows features. Control Panel\All Control Panel Items\Programs and Features. Remove IE 10, Windows Gadget Platform, Window Search, Tablet PC Components, Media Features, Windows Fax and Scan. Reboot.
  31. From a command prompt as administrator, run "chkdsk" to make sure your file structure has no problems.
  32. From a command prompt as administrator, run "sfc /SCANNOW" to check Windows system file integrity.
  33. Scan your computer with Malwarebytes and Spybot Search and Destroy. Make sure your system is clean. If it isn't, back up to external disk then re-install the OS from the original media.
  34. Remove antivirus and any other programs that run in the background which you don't need using Revo Uninstaller.
share|improve this answer
    
I would never disable hyper-threading for a Windows computer. Also attempting to remove any version of IE won't ever fully work, it's better not to try. About 80% of this "answer" seems to be a kind of humblebrag about specific equipment, rather than actual recommendations the asker could implement. – Todd Wilcox Feb 2 at 22:32
    
Hi Todd, If you would never disable hyper-threading for a Windows computer, then you would never be following Steinberg's recommendations for optimizing Windows for a DAW. steinberg.net/en/support/knowledgebase_new/show_details/kb_show/… IE is fully removed from my system insomuch as it does not show up in Windows features and I don't see it anywhere. I've never heard of "humblebrag" but you're obviously on to my clever ploy to spend time trying to help people so I can somehow anonymously profit. ;-) – JoeS yesterday
    
if you read the text carefully on the Steinberg page you linked to, you'll see they only recommend that "...if your CPU supports it (e.g. Intel i7) and you use older sequencer versions than Cubase 7 and Nuendo 6". Starting with Cubase 7 and Nuendo 6, the "details" link explains that having hyper threading on can increase performance. Why it took Steinberg so long to make their applications Hyper Threading compatible I don't know. In general, most applications have supported hyper threading for many years now. – Todd Wilcox yesterday
    
Read about ASIO Guard. It can't be used for real time dependent signals. steinberg.net/en/support/knowledgebase_new/show_details/kb_show/…, I have Cubase 7, but it appears I have more latency if I enable ASIO Guard. – JoeS 8 hours ago

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.