Measuring Time Delay with Electroacoustics Toolbox

Measuring Time Delay in an Audio System Using Electroacoustics Toolbox

Although Electroacoustics Toolbox is not limited to measuring audio systems, the measurement of audio systems is a common use that offers convenient ways to demonstrate the capabilities of the software. These examples can then be applied to other applications in which the Toolbox’s measurement capabilities may be considered useful.

At times it is desirable to measure the delay of a signal through some component, or group of components, in an audio system. For example, when a digital signal processor (DSP) is employed in an audio system, to optimize or otherwise alter the listening experience, it may be desirable to measure the delay introduced by the DSP’s algorithms in the audio signal. Alternatively, users may be interested in measuring the difference in time delay as an audio signal passes through each of two different loudspeakers to a reference microphone.
This tutorial requires two free software packages in addition to the Toolbox: Soundflower and AU Lab. AU Lab is distributed with Tiger (Mac OS X, 10.4), although it will run on Panther (Mac OS X, 10.3).
Soundflower is a free system extension for Mac OS X, version 10.2 or later, that allows for convenient routing of audio signals between applications on the Mac. More information regarding Soundflower, as well as a download link may be found at cycling74.com. (Version 1.2 was employed at the time this tutorial was written.)
AU Lab is a digital mixing application, designed as a reference Audio Unit host for those wishing to develop their own Audio Unit plug-ins or Audio Unit hosting applications. AU Lab is provided free of charge with the Apple Developer Tools. After installing the Apple Developer Tools, AU Lab can be found in the directory /Developer/Applications/Audio (that’s the Developer directory at the root level of the hard drive). Documentation for AU Lab should be available from the same directory. (Version 1.0.3 was employed at the time this tutorial was written.)
This tutorial will focus on the configuration and use of Electroacoustics Toolbox to make time delay measurements, rather than on how to tie in to the audio system itself. The reader is encouraged to examine the tutorial “Measuring Audio Unit Effects Plug-ins Using Electroacoustics Toolbox, Soundflower, and AU Lab” since this tutorial starts where that one left off. The Audio Unit tutorial can be downloaded in PDF format, or viewed online in this forum.

AU Lab Configuration
1. Open SFOut12In34.trak, created in the AU Lab tutorial, in AU Lab.
2. In AU Lab, remove all effects from the Audio 2 input track (and any effects that may have been added to other inputs or outputs).
3. In the Audio 2 input track, select the AUSampleDelay effect from the first Effects popup menu. The document window should look like Figure 1.
4. In the Audio Unit interface window, change the delay to 48 samples, as shown in Figure 2.

Figure 1: AU Lab - AUSampleDelay Effect on Audio 2 Input Track

Figure 2: AU Lab - AUSampleDelay Parameters

Measuring Time Delay with Cross Correlation
1. Open SFOut12In34.featproj, created in the AU Lab tutorial in Electroacoustics Toolbox.
2. In the Dual FFT Analyzer, change the Function to Cross Correlation in the Function tab of the controls drawer.
3. In the Function tab of the controls drawer, double click the name of the current measurement to edit it. Change the name to “Sample Delay AU” as shown in Figure 3.

Figure 3: Electroacoustics Toolbox - Dual FFT Analyzer Function Settings

4. In the Cursors tab, select “Sample Delay AU” in both the Horizontal Bar and Peak Track popup menus for Cursor 1, and turn the cursor on, as shown in Figure 4.

Figure 4: Electroacoustics Toolbox - Dual FFT Analyzer Cursor Settings

5. Now, the Dual FFT Analyzer should display a single spike in the correlation at a time offset of 1.0 milliseconds (ms), since the sample rate is nominally 48 kHz and the sample delay was set for 48 samples. The time offset of the peak in the correlation corresponds to the time delay through the system or device under test (DUT). The time offset at the cursor location can be read in the info drawer as the “X” value, as shown in Figure 5.
6. Doubling the sample delay in AU Lab to 96 samples will cause the peak in the cross correlation to move to 2.0 ms, as one would expect. This illustrates how easy it is to measure time delay through a system, in this case a sample delay Audio Unit, using the Cross Correlation function in the Dual FFT Analyzer. One of the keys for such ease in time delay measurements is the use of a spectrally rich excitation signal, or one that has an autocorrelation function approaching a delta function, which, in this case, is a swept sine. The Dual FFT Analyzer’s built-in excitation can also produce random and pseudorandom noise signals with white or pink frequency weightings, each of which would work well for this type of measurement.

Figure 5: Electroacoustics Toolbox - Cross Correlation Time Delay Measurement

Measuring Time Delay with the Impulse Response
A time delay measurement may also be made by measuring the impulse response function of a system or device under test (DUT). Once again, by using an excitation signal with an autocorrelation function characterized by a dominant peak, approaching a delta function, and using the cursor’s peak track capability, a time delay can be measured very easily by the Dual FFT Analyzer.
1. With all else unchanged from the cross correlation measurement, change the function to Impulse Response (H1) in the Function tab of the Dual FFT Analyzer’s controls drawer.
2. Although the display changes to represent an impulse response, the measured time delay is the same. Figure 6 demonstrates the impulse response measurement of the AUSampleDelay Audio Unit with a delay of 96 samples.

Figure 6: Electroacoustics Toolbox - Impulse Response Time Delay Measurement

Measuring Group Delay
Group delay is essentially a frequency dependent measure of time delay. For a linear-phase system, like the sample delay effect being used in this tutorial, the group delay is constant over frequency, and is equal to the overall time delay measured previously. If the phase response of the system is not linear, the group delay at frequency f indicates the amount of time delay experienced by a small group of frequencies, which are centered about f.
1. In the Function Tab, select Group Delay as the current measurement under the Function tab.
2. The group delay, in this case, should appear as a flat line, indicating a delay of 2 ms (assuming the sample rate is still 48 kHz, and the sample delay is set to 96 samples). This is shown in Figure 7.

Figure 7: Electroacoustics Toolbox - Group Delay Measurement

This article was originally published in the forums for an earlier version of Electroacoustics Toolbox. The content still applies to the latest version of the Toolbox.

Leave a Reply

Your email address will not be published. Required fields are marked *