AP audio analyzers have an incredibly wide variety of audio measurements built in. Sometimes, however, you may need or want to do a custom measurement that is not included in the AP control software. Many times, custom measurements involve measuring a spectrum with the FFT Analyzer and then performing calculations on the resulting FFT spectrum. For example, you might want to manipulate specific harmonics of a sine wave, sum the noise within a certain frequency band, or convert the FFT spectrum to a power spectral density or amplitude spectral density. The applications of FFT-based data are virtually limitless. However, for accuracy, it is important to ensure that you are working with the true FFT data, and not screen-optimized data.
The AP2700 and ATS control programs are set up for optimum viewing of FFT spectrum graphs where you are primarily interested in the level and frequency of component signals. In particular in many cases the number of FFT 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. Instead when there is more than one FFT bin per graph point, the system plots the highest value bin of all the bins represented by that graph point. To retrieve all the FFT bins you must set up the Sweep Panel so that each bin of the FFT is displayed on the graph (or listed in the Data Editor panel). This requires knowledge of the sample rate in Hz and the FFT length.
For a given FFT length (N) and sample rate (SR), the DSP returns N/2 + 1 bins from zero Hz up to and including SR/2 (the Nyquist frequency). Therefore, the bin width in Hz is equal to SR / N.
For example, consider the default settings when the FFT analyzer is set up to measure the spectrum of an analog signal. By default, the input is HiRes A/D @65536 and the FFT length is 8192 (8k). In this case the sample rate is 65,536 Hz, and the number of FFT bins is 4097 (one half the length of the FFT transform buffer plus one bin for the DC component). The resulting FFT bin width is therefore 65536 / 8192 = 8 Hz. By default (Figure 1a), Source 1 in the sweep panel is set to Fft.Freq. with a Start value of 20.0 Hz, a Stop value of 20.0 kHz, 511 sweep steps, and logarithmic spacing. These default sweep settings will produce a nice looking graph, but if the resulting spectrum is used for FFT calculation purposes, errors are inevitable.
To ensure that all FFT bins are returned for an 8k FFT length at SR = 65536 Hz, the Sweep Panel should be set up as shown in Figure 1b. With the sweep panel properly configured, once the sweep is completed, the FFT 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” that illustrates setting up the sweep panel to return all FFT bins. The AP2700 version has file extension .apb and the ATS version has file extension .atsb. 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.
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.