Audio Signal Delay Project

Hao Huang
Columbia University
Ft. Washington Ave., AP-1310
New York, NY 10032
USA
huangha@flux.cpmc.columbia.edu

Abstract

The main aim of this project is to build an analyzer for measuring the delay between the two channels of the audio input, using the Fast Fourier Transform (FFT) correlation function.  Given a signal from the phone line and a signal transmitted over the Internet, this analyzer also provides the ability to measure one-way delay.

Introduction

Audio Signal Delay Analyzer is a tool to measure the delay between the signals of the two channels in a stereo audio input.  It decodes the audio data, calculates the correlation between the signals of the two channels, and report the delay.  This analyzer can read directly from the audio device or a recorded stereo audio file.  The supported audio file formats include .au, .snd and .aiff files.  The supported audio encoding are U-law, A-law, 8-bit linear, 16-bit linear and 32-bit linear.

It has been common practice to measure round trip delay in the internet.  However, there has been difficult to measure the one-way delay in the internet.  With this analyzer, we can split one audio signal to two channels, one transmitted by the telephone network and the other by the internet, and measure the delay between these two channels at the receiver machine.  Because the transmission time by telephone network is stable, we can then measure the one way delay from the source to the destination.

Architecture

The delay utility is an audio signal delay analyzer.  It reads the data from the input device or a file, calculates correlation between the two channels using FFT, and report the delay between them.

In correlation, we compare two sets of data directly superposed, and with one of them shifted left or right.   The relation that holds when two functions, g(t) and h(t), are interchanged is:
        Corr(g,h)(t) = Corr(h,g)(-t)
The discrete correlation of two sampled functions gk and hk, each periodic with period N, is defined by
        Corr(g,h)[j] = Sum[k=0 to N-1](g[j+k] + h[k])
The discrete correlation theorem says that this discrete correlation of two real functions g and h is one member of the discrete Fourier transform pair
        Corr(g,h)[j] <==> GkHk*
We can compute correlation using FFT as follows: FFT the two data sets, multiply one resulting transform by the complex conjugate of the other, and inverse transform the product.  The result, say r, will formally be a complex vector of length N with all its imaginary parts zero since the original data sets were both real.  The components of r are the values of the correlation at different lags.

The analyzer consists of the FFT library, Audio File Utility module and the main module.

FFT library

It performs Fast Fourier Transform for real data and calculate the correlation between two data set.  It is based on Press <1>.

Audio File Utility Module

It utilizes the netutil library to parse the audio file header and provides facility to print out the information about the audio file.  It also decodes the audio data read in from the file or the audio input device.  Currently, it supports U-law, A-law, 8-bit linear, 16-bit linear and 32-bit linear.  User can extends the capability by providing decoding block in the decodeAudioData function.

Main Module

The main module parses command argument and performs specified function.

Program Documentation

The installation is very simple.  Follow this link for installation and operation.

Acknowledgment

I would like to thank Jonathan Lennox for his help and advice.  I would also like to thank Prof. Henning Schulzrinne for giving me this opportunity, for his guidance, and for his kind consideration for my medical condition during this project.

References

1
William H. Press, et. al., Numerical Recipe In C -- the Art of Scientific Computing, Cambridge University Press, 1988.
2
Audio Format FAQ, PART 1
3
Audio Format FAQ, PART 2

Last updated: 1998-05-13 by Hao Huang