Retrieving FFT Data in AP2700 and ATS-2 Control Software

Created on 2009-05-11 21:39:00

AP audio analyzers have an incredibly wide variety of audiomeasurements built in. Sometimes, however, you may need or want to do a custommeasurement that is not included in the AP control software. Many times, custommeasurements involve measuring a spectrum with the FFT Analyzer and thenperforming calculations on the resulting FFT spectrum. For example, you mightwant to manipulate specific harmonics of a sine wave, sum the noise within acertain frequency band, or convert the FFT spectrum to a power spectral densityor amplitude spectral density. The applications of FFT-based data are virtuallylimitless. However, for accuracy, it is important to ensure that you areworking with the true FFT data, and not screen-optimized data.

The AP2700 and ATS control programs are set up for optimumviewing of FFT spectrum graphs where you are primarily interested in the leveland frequency of component signals. In particular in many cases the number ofFFT bins exceeds the number of pixels available on the computer monitor. Therefore,by default, the system is not configured to display all the FFT bins. Insteadwhen there is more than one FFT bin per graph point, the system plots thehighest value bin of all the bins represented by that graph point.  To retrieve all the FFT bins you must set upthe Sweep Panel so that each bin of the FFT is displayed on the graph (orlisted in the Data Editor panel). This requires knowledge of the sample rate inHz and the FFT length.

For a given FFT length (N) and sample rate (SR), the DSPreturns N/2 + 1 bins from zero Hz up to and including SR/2 (the Nyquistfrequency). Therefore, the bin width in Hz is equal to SR / N.

For example, consider the default settings when the FFTanalyzer is set up to measure the spectrum of an analog signal. By default, theinput is HiRes A/D @65536 and the FFT length is 8192 (8k). In this case thesample rate is 65,536 Hz, and the number of FFT bins is 4097 (one half thelength of the FFT transform buffer plus one bin for the DC component). Theresulting FFT bin width is therefore 65536 / 8192 = 8 Hz. By default (Figure1a), Source 1 in the sweep panel is set to Fft.Freq. with a Start value of 20.0Hz, a Stop value of 20.0 kHz, 511 sweep steps, and logarithmic spacing. Thesedefault sweep settings will produce a nice looking graph, but if the resultingspectrum is used for FFT calculation purposes, errors are inevitable.


Fig 1 a) Sweep panel defaults; b) Sweep panel settings for all bins (8k FFT & SR = 65536)

To ensure that all FFT bins are returned for an 8k FFTlength at SR = 65536 Hz, the Sweep Panel should be set up as shown in Figure1b. With the sweep panel properly configured, once the sweep is completed, theFFT spectrum data can be retrieved using the AP Basic commands AP.Data.XferToArray() (AP2700) or ATS.Data.Transfer() (ATS).

Below is an AP Basic macro named “Get all FFT Bins” thatillustrates setting up the sweep panel to return all FFT bins. The AP2700 versionhas file extension .apb and the ATS version has file extension .atsb. The macroincludes a function that gets the Sample Rate and FFT length, and in additionto setting up the sweep panel it retrieves the FFT level spectrum in units ofVolts.



AP2700 and ATS Get all FFT Bins Macro (2.07 KB)

Illustrates setting up the sweep panel to return all FFT bins. For 2700 Series and ATS-2. The macro includes a function that gets the Sample Rate and FFT length, and in addition to setting up the sweep panel, it retrieves the FFT level spectrum in units of Volts.