Latency Test

From Audacity Manual

Jump to: navigation, search


What is Latency?

Latency refers to the delay between the time the audio enters the computer and the time Audacity is able to record it to a track. For example, if you are recording a keyboard track, latency is the delay between the time you strike a key and the time that note is recorded.

Latency is important only when you are overdubbing, that is, recording a new track while listening to previously-recorded track(s). You want what you play to be in sync with the tracks you are listening to. Audacity can correct for latency, but you have to tell it what the correction amount is. You enter this correction amount in the Recording tab of the Preferences dialog.

What you need

To do a latency test you will need a loop-back cable. The type of cable you need will depend on the way you are connecting your recording equipment to the computer.

Connecting to the line input and line output ports on the computer

If you are connecting your recording equipment to the line input and line output jacks on your computer you need a cable with a stereo mini-plug at each end.

picture of a stereo loop-back cable picture of a loop-back cable plugged in to the back of a computer
A stereo loop-back cable A loop-back cable plugged in

Using an external USB audio interface

If you are not using the line input and/or line output ports on your computer but are instead using a USB audio interface device for input and/or output, plug the loop-back cable into the appropriate jacks on the USB interface. Depending on your interface you may need a different type of loop-back cable.

picture of USB interface with loopback cable
Example of loopback with a USB audio adapter

Using a microphone

If you are using a microphone to record overdubs then the loop-back cable method will not work for you. Instead you need to set up the microphone in front of a speaker or headphones! Don't worry, you won't get feedback because you've turned Software Playthrough and Hardware Playthrough off.

picture of earbud held against a microphone
Example of loopback using a microphone
Warning icon Note that using a USB microphone is not the best way to record overdubs. These microphones are great for podcasters who just want to record their voice and are not worried about syncing to music. The problem with these microphones is that the only way you can hear yourself in your headphones is by turning Software Playthrough On. Software playthrough introduces its own delay (different from latency) which you will hear in your headphones. Tests on the same system used for the latency test below revealed that the Software Playthrough delay was 65 milliseconds. This doesn't sound like much, but it's like hearing your voice coming out of speakers 70 feet away. If you are serious about overdubbing, get an inexpensive mixer and a good microphone to go with it.

For more information on overdubbing with Audacity, see our Tutorial - Recording Multi-track Overdubs

Doing the latency test

Plug in the appropriate loop-back cable for your setup.

Launch Audacity. Click on Edit > Preferences, select the Recording tab and make the following settings.

  • CheckboxChecked.png Overdub: Play other tracks while recording new one checked.
  • CheckboxNotChecked.png Hardware Playthrough: Listen while recording or monitoring new track not checked (Mac only).
  • CheckboxNotChecked.png Software Playthrough: Listen while recording or monitoring new track not checked.
  • Set the Latency Correction to 0 (zero).
  • Leave the Audio to Buffer amount at its default value.
  • Click OK.
The Audio to Buffer amount will affect latency, but the effect will vary between systems. 100 milliseconds is a safe value that will not put too much load on the CPU. Too low a value may put too much load on the CPU causing dropouts in the recording. If you are feeling adventurous you can repeat this test with different values for Audio to Buffer. But in the end you should settle on a value for both Audio to Buffer and Latency Correction and leave them there.

In the Selection Toolbar make sure that Snap To is not checked. Above the second group of numbers, make sure that Length is selected. Click on one of the downward-pointing arrows to the right of Snap To and select hh:mm:ss + milliseconds.

Click on Generate > Click Track. Generate 2 bars of click track, and choose the "Tick" sound. Click OK to generate the click track. Now click the Record button in the Transport Toolbar - the click track will be played back and recorded on a new track through the loop-back cable. You'll now have something like this:

image of two tracks showing latency
The top track is the original click track, the bottom track is the looped-back recording. Note the delay.


Zoom in so you can see one of the clicks in the top track and its delayed version on the bottom track. Using the Selection Tool drag a selection starting at the start of the click in the top track and ending at the start of the delayed click in the second track. You should see something like this (your numbers will likely be different):


image of two tracks with selection showing latency amount
The selections goes from the original click to the delayed version in the bottom track.


You can now read the latency directly from the second panel of numbers. In this case it is 0.073 seconds, or 73 milliseconds. Click on Edit > Preferences, click on the Recording tab, and enter the negative of this number in the Latency Correction box - in this case it would be -73.

Checking the result

Delete the second track by clicking the close box X in its Track Control Panel. Click the Zoom to Fit Image for the "Zoom to fit" button button to see the entire click track. Click in the Track Control Panel of the remaining track to select it, then click the Record button. After the recording is finished Audacity will apply the latency Correction by pushing the newly-recorded track back by the Latency Correction amount. Note the two arrows at the left end of the second track - they are warning you that latency correction has been applied and part of the recorded track has been pushed left so that it starts before 0 seconds. This is OK, it is what we wanted to happen. The arrows are there to remind you that latency correction has been applied, just in case that's not what you wanted.

image of track showing arrows at left end
Note arrows at left end of track: latency correction has been applied.

Zoom in on one of the clicks and verify that the clicks in the two tracks line up.

image of two tracks with selection showing latency amount after correction
Note that there is still a tiny delay between the two tracks

You'll never get it absolutely perfect. In this case we're still off by 8 samples. At 44100 samples per second that's about 0.18 milliseconds. This is as close as we're going to get, and it is nothing to worry about - this is the length of time it takes a sound wave to travel about 2.5 inches.

If you change input or output devices

If you change any of your input or output connections - for example if you change from using the line input port on your computer to using a USB audio interface - you will need to do this test again. The test you just did only applies for the specific inputs and outputs used during the test.

All audio behind zero warning

If you make a recording that is shorter than the latency correction the entire recorded track will be pushed left before 0 seconds. In this case Audacity will issue a warning dialog telling you that this has happened, and that Audacity has moved the track to start at 0 seconds. In this case you will have to manually correct for the latency using the Time Shift Tool. This is unlikely to be an issue, since in the example presented a recording of less than 73 milliseconds would need to be made at the start of the track in order to trigger this warning.

Views
Help Location