# Measuring Sample Rate Error When the Sample Clock is Not Accessible

Created on 2009-10-27 19:28:00

There are many devices that utilize a non-synchronous communication scheme—one that does not lock to an external reference for its A/D, D/A, or digital circuits. These devices provide their own clock source, and sometimes it is desired to measure its accuracy.

Take, for example, the case of a digital recording device set at a 48k sample rate. Fed a 997 Hz sine wave through its analog inputs, the .wav file it records should have exactly 997 cycles across the 48,000 samples. We can’t check this by playing the file, as that would introduce playback clock errors.

Likewise, a digital recording device playing a file with a perfect 997 Hz sine wave may introduce frequency errors due to deviation of its internal clock. In many cases, the sample rate clock is not externally accessible, so we can not simply connect a frequency meter to get a reading.

Provided with this article are two macro utilities for AP2700 that determine sample rate clock error by measuring the frequency error in a recorded sine wave. The technique makes an FFT and looks at the spectral distribution of the sine wave in bins adjacent to the fundamental. If the energy in the adjacent bins is equal, then the measured frequency is perfectly centered and exactly equal to the intended frequency. Any imbalance in the bin energy represents deviation in the sample rate clock. This method yields a result that is far more accurate than the frequency meter in the 2700 Series instruments. A similar utility is not necessary for the APx Series, as they actually use the FFT method internally and therefore their frequency meter can produce extremely precise results.

The calculation uses the following formula, where j is the array index of the apparent peak of the frequency of interest, and the span j ±4 represents a spread across adjacent lobes of the Equiripple FFT Window being used:

### Utilities

Each of the following utilities is provided in the form of a macro that you can load into the macro editor and run. The utility will configure the 2700 series software and hardware to make the measurement.

A-to-D Sample Rate Error.apb
This utility analyzes a .wav file to determine the accuracy of the A/D converter used to create it. When creating the file with the DUT (device under test), use the 2700 Series instrument’s Analog Generator Sine D/A waveform or another highly accurate signal source. The 2700 D/A generated signal has a clock accuracy of ± 0.0002% (2PPM).

To use the utility, click the browse button to select the mono or stereo .wav file you wish to analyze. This file must contain a waveform at least 32,768 samples in length. Enter the fundamental frequency and then click OK to make the measurement.

The accompanying download includes two example .wav files recorded at 1010 Hz. Setting the fundamental frequency to 997 or 1000 Hz in the macro will display the sampling rate errror in the examples.

D-to-A Sample Rate Error.apb
This utility analyzes an analog input signal to determine the accuracy of the D/A converter used to create it. The converter may be part of a larger device, such as a recorder or sound card.

To use the utility, connect the analog output of the DUT to the Channel A Balanced (XLR) or Unbalanced (BNC) input on the 2700 and select the appropriate Analog Analyzer Channel A Input. Enter the fundamental frequency of the generated waveform and then click OK to start the process.

When the following prompt is displayed, begin sending the signal from the DUT to the 2700 and click Continue Macro to make the measurement.

The waveform length must typically be around 10 seconds to allow the acquisition to complete before terminating. The 2700 A/D converter used for this measurement is accurate to ±0.0002% (2PPM).

*****
br