Band-in-a-Box® 2006 and higher have three latency settings, each of which has a different purpose. You may not need to know all of the details below; Band-in-a-Box® usually does a good job of setting the latency for you automatically.
This tutorial will help if you...
- Are having trouble syncing audio to MIDI.
- Cannot get the on-screen display in time with the MIDI sounds.
- Would like to know how/if you can get lower latency.
- Would like a better understanding of how latency works.
We have another FAQ topic regarding latency that may also be of interest to you:
Why is there a delay between when I play a note on my MIDI keyboard, and when I hear the note play through my computer speakers?.
MIDI Driver Setup dialog - 'Driver Latency'
The purpose of 'Driver Latency' is to sync the playback screen display to the MIDI sounds. Screen display includes scrolling/hilighting the ChordSheet, Notation, and Piano Roll windows, and lighting-up the on-screen piano notes.
If connecting a MIDI cable to a hardware synthesizer, most hardware synths have latency in the ballpark of 3 to 20 mS. For most hardware synths, 'Driver Latency' can be set to zero for good screen sync with the sounds.
If connecting to a standalone softsynth such as the Microsoft GS softsynth or the standalone VSC softsynth, the screen display must be delayed by the audio latency of the softsynth. This latency will vary among different softsynths, and as they run on different computers. On XP SP2, we find that the Microsoft GS Wavetable softsynth needs a latency in the ballpark of 100 mS, and the standalone Roland VSC-3 usually needs a latency in the ballpark of 300 mS.
In other words, if driving the Microsoft synth, BIAB plays a MIDI note, and then some time later the sound comes out of your soundcard. To make the notation or pianoroll notes 'light up' at the same time you hear the sound, the screen display must be delayed.
It is impossible for BIAB to always accurately estimate the exact latency of standalone softsynths and any possible video latency on each computer. So this MIDI Driver Latency must be experimentally adjusted 'by eye and ear' to get a 'perfect' match. If on-screen notes are hilighting BEFORE you hear the notes, INCREASE 'Driver Latency'. If on-screen notes are hilighting AFTER you hear the notes, DECREASE 'Driver Latency'.
Using DXi or VSTi synths, 'Driver Latency' is automatically set to the audio latency of your soundcard driver. If you type in a different value, BIAB will ignore it. In MOST CASES the DXi/VSTi playback latency will be identical to the Audio Driver's latency. If the Audio latency is 100 mS, then we know that sound will come out the speakers about 100 mS after a MIDI Note is played, so it is a good bet that 100 mS is also the proper MIDI 'Driver Latency'.
Audio Settings dialog - 'Audio Latency in mS'
Audio Latency determines how long it takes for audio tracks (or DXi/VSTi rendered sound) to come out of the speakers after the computer program sends audio to the soundcard.
With MME, you can manually adjust Audio Latency in the range of 100 mS to 2000 mS. If you hear no dropouts, use the minimum 100 mS. But if your computer is struggling to keep up, and you hear clicks or dropouts, increase the latency until playback is smooth. Higher latency might be necessary on a slow computer, but dropouts could also happen if you have a fast computer loaded down with many 'bloatware' softwares running in the background.
ASIO latency is user-adjusted by running your ASIO soundcard driver's control panel. BIAB uses whatever latency is preferred by your ASIO driver. Any time you change the soundcard's ASIO latency, BIAB will auto-adjust to use the driver's new latency setting.
You can run the soundcard's ASIO control panel by launching it when BIAB is not running. Often the ASIO control panel can be found in Windows' 'Start|Settings|Control Panel' menu item.
You can also run the ASIO control panel in the BIAB Audio Settings dialog. Open the BIAB Audio Settings dialog with the menu 'Opt|Preferences', then click the 'Audio' button, then click the 'Audio Drivers' button when ASIO is selected as your Audio Driver type. In the ASIO Audio Drivers dialog, click the 'ASIO Driver's Control Panel' button to open your soundcard's ASIO control panel.
Some ASIO control panels list the latency in milliseconds, but other ASIO control panels list the SampleRate and Buffer Size. If your driver only lists buffer size, you can find the latency with this formula--
BufferLatency = 1000 * BufferSizeInSamples / SampleRate
For instance, if you pick 512 buffer size at a sample rate of 44100, the latency is 1000 * 512 / 44100 = 11.61 mS, but often the value will be rounded off to the nearest whole number. You don't have to use a calculator to determine the latency in milliseconds. BIAB will automatically figure that out after you select a buffer size in your soundcard's ASIO Driver control panel.
If you pick a 10 mS ASIO latency, BIAB will probably display about double that value, 20 mS. This is not a program bug. With ASIO, one buffer is 'playing out the soundcard' while another buffer is being prepared to play, so the actual program latency is 'in the ballpark' of double the buffer size.
NOTE 1: If your computer is having difficulty playing low-latency ASIO, it might help to set the 'Resampler Quality' to FAST in the 'ASIO Audio Drivers' dialog. There are machine-measurable audio quality differences in the Resampler choices, but the difference between 'FAST' and 'BEST' may be difficult to hear, and the higher quality choices require more CPU power.
NOTE 2: Some ASIO drivers may have more actual latency than one would expect from the buffer size. For instance, this could be the case with the ASIO4All generic driver, depending on your sound hardware. ASIO4All is wonderful for use with built-in sound chips which do not have a special-written ASIO driver, but the natural latency of some of the cheap built-in sound chips is rather high, and ASIO4All cannot always turn a 'Sows Ear Into A Silk Purse'.
NOTE 3: Remember that if you use DXi/VSTi with ASIO, the MIDI Latency is always set to the Audio Latency value. And the BIAB Audio Latency value is always 'whatever the ASIO driver wants'. So if there is large additional 'hidden audio latency', it may not be possible to precisely sync on-screen hilighted notes with the sound.
Audio Settings dialog - 'Offset in mS'
One more latency setting to go. Audio Offset moves the audio track forward or back in relation to the MIDI playback.
In our testing, Audio Offset has only been necessary when using a standalone softsynth such as the MS GS Softsynthesizer, or the standalone VSC. In our testing, if an audio track was recorded while monitoring a hardware MIDI synth, or DXi/VST synth, the audio track plays in-time with the MIDI when the Audio Offset is set to zero. However, if using a standalone softsynth with substantial latency, the audio track may play noticeably ahead or behind the MIDI.
For instance, using the Demo song 'Tutorial - Audio Harmonies\Listen.MGU': Oliver Gannon sang this demo along to a hardware Roland Sound Canvas, and our computers sync the voice perfectly to the MIDI in the following cases--
Hardware Synth + MME audio, Hardware Synth + ASIO audio, Audigy Synth A + MME audio, Audigy Synth A + ASIO audio, DXi/VSTi + MME audio, DXi/VSTi + ASIO audio.
However, using either ASIO or MME with the MS GS Wavetable Synth, Olly's vocal is noticeably ahead of the MIDI. We can get it synced by setting Audio Offset to about -100 mS, but this value could vary on different computers.
If the audio track is AHEAD of the MIDI, adjust Audio Offset in a NEGATIVE direction (to delay the audio relative to the MIDI). If the audio track is BEHIND the MIDI, adjust Audio Offset in a POSITIVE direction (to advance the audio relative to MIDI).
Possibly, the Audio Offset and MIDI Latency could be unified into one setting, but there are cases where this would lose flexibility. For instance, if an Audio Track is just 'messed up' in time relative to MIDI playback, for some unknown reason, the proper Audio Offset might have nothing in common with the most desirable MIDI Latency.
Unconditional 30-Day Money Back Guarantee on all products purchased from PG Music Inc.