# Fast Fourier Transformation FFT - Basics

The "Fast Fourier Transform" (FFT) is an important measurement method in the science of audio and acoustics measurement. It converts a signal into individual spectral components and thereby provides frequency information about the signal. FFTs are used for fault analysis, quality control, and condition monitoring of machines or systems. This article explains how an FFT works, the relevant parameters and their effects on the measurement result.

Strictly speaking, the FFT is an optimized algorithm for the implementation of the "Discrete Fourier Transformation" (DFT). A signal is sampled over a period of time and divided into its frequency components. These components are single sinusoidal oscillations at distinct frequencies each with their own amplitude and phase. This transformation is illustrated in the following diagram. Over the time period measured, the signal contains 3 distinct dominant frequencies. View of a signal in the time and frequency domain

## Step by step

In the first step, a section of the signal is scanned and stored in the memory for further processing. Two parameters are relevant:

1. The sampling rate or sampling frequency fs of the measuring system (e.g. 48 kHz). This is the average number of samples obtained in one second (samples per second).
2. The selected number of samples; the blocklength BL. This is always an integer power to the base 2 in the FFT (e.g., 2^10 = 1024 samples)

From the two basic parameters fs and BL, further parameters of the measurement can be determined.

Bandwidth fn (= Nyquist frequency). This value indicates the theoretical maximum frequency that can be determined by the FFT.

fn = fs / 2

For example at a sampling rate of 48 kHz, frequency components up to 24 kHz can be theoretically determined. In the case of an analog system, the practically achievable value is usually somewhat below this, due to analog filters - e.g. at 20 kHz.

Measurement duration D. The measurement duration is given by the sampling rate fs and the blocklength BL.

D = BL / fs.

At fs = 48 kHz and BL = 1024, this yields 1024/48000 Hz = 21.33 ms

Frequency resolution df. The frequency resolution indicates the frequency spacing between two measurement results.

df = fs / BL

At fs = 48 kHz and BL = 1024, this gives a df of 48000 Hz / 1024 = 46.88 Hz.

In practice, the sampling frequency fs is usually a variable given by the system. However, by selecting the blocklength BL, the measurement duration and frequency resolution can be defined. The following applies:

• A small blocklength results in fast measurement repetitions with a coarse frequency resolution.
• A large blocklength results in slower measuring repetitions with fine frequency resolution. Representation of the FFT of a signal with small and large blocklength

## To Infinity…

In the Fourier transformation, the assumption is that the sampled signal segment is repeated periodically for an infinite period of time. This brings two conclusions:

1. The FFT is only suitable for periodic signals.
2. The sampled signal segment must contain a whole number of periods.

It can be seen that condition 2. would apply only to very few signals. The sampling of a signal whose frequencies are not an integer multiple of df would begin and end within a block of 2^n samples with different values. This results in a jump in the time signal, and a "smeared" FFT spectrum. (aka Leakage) Un-windowed time signal with smeared spectrum

## Windowing

In order to prevent this smearing, in practice "windowing" is applied to the signal sample. Using a weighting function, the signal sample is more or less gently turned on and off. The result is that the sampled and subsequent "windowed" signal begins and ends at amplitude zero. The sample can now be repeated periodically without a hard transition. Windowed time signal with spectrum

### A practical example

A classic example of the signal theory is the spectral composition of a square-wave signal. This consists of the sum of all weighted odd multiples of the fundamental frequency. This video shows the creation of a 500 Hz square wave as a time signal and spectrum.

## How to measure?

The portable audio and acoustic analyzer XL2 is ideally suited for fast and simple FFT analysis up to 20 kHz. For multi-channel and more detailed analysis or calculations, a more powerful system with large bandwidth and fast signal processors such as the FLEXUS FX100 Audio Analyzer is required. In conjunction with the FX-Control PC software, the FFT can be easily and quickly adapted and visualized according to the requirements of the measurement. The larger internal memory of the FLEXUS FX100 allows significantly longer blocklengths to be processed, resulting in a much finer frequency resolution.

## FFT Further Considerations

This second part of this article deals with specific aspects that are helpful in the practical application of FFT measurements. FFT measurements are used in numerous applications. The results are usually presented as graphs and are easy to interpret. For accurate FFT measurements, there are some things to look out for. This article provides valuable tips.

As explained in the first part, the sampling rate fs of the measuring system and the block length BL are the two central parameters of an FFT. The sampling rate indicates how often the analog signal to be analyzed is scanned. When recording wav files via a commercially-available PC sound card, for example, the audio signal is usually sampled 44,100 times per second.

### Nyquist Theorem

Harry Nyquist was the discoverer of a fundamental rule in the sampling of analog signals: the sampling frequency must be at least double the highest frequency of the signal. If, for example, a signal containing frequencies up to 24 kHz is to be sampled, a sampling rate of at least 48 kHz is required for this purpose. Half the sampling rate, in this example 24 kHz,  is called the "Nyquist frequency".
But what happens if signals above the Nyquist frequency are fed in to the system?

### Aliasing

For the most, a signal is sampled with a more-than-sufficient number of samples. With a 48 kHz sampling rate, for example, the 6 kHz frequency is sampled 8 times per cycle, while the 12 kHz frequency is only sampled 4 times per cycle. At the Nyquist frequency, only 2 samples are available per cycle.
With 2 samples or more it is still possible to reconstruct the signal without loss. If, however, less than 2 samples are available, artifacts which do not occur in the sampled (original) signal are generated.

### Mirror frequencies

In the FFT, these artifacts appear as mirror frequencies. If the Nyquist frequency is exceeded, the signal is reflected at this imaginary limit and falls back into the useful frequency band. The following video shows an FFT system with 44.1 kHz sampling rate. A sweep signal of 15 kHz to 25 kHz is fed in to this system.

These unwanted mirror frequencies are counteracted with an analog low-pass filter (anti-aliasing filter) before the scanning. The filter ensures that frequencies above the Nyquist frequency are suppressed.

### Time window

In the case of periodically-continuous signals, the time windowing serves to smooth the undesired transitional jumps at the end of the scanning (see part 1). This prevents smearing in the spectrum. There are numerous types of windows, some of which differ only slightly. When selecting the time window, the following rule applies: Each window requires a compromise between frequency selectivity and amplitude accuracy. ### Averaging of Spectra

In the analysis of non-periodic signals, e.g. noise or music, it is often advantageous to capture multiple FFT blocks and determine mean values therefrom. There are two possible approaches:

1.  The classical mean: A number of FFTs are measured. Each result is considered in equal parts in the averaged final result. This method is suitable for measurements with a defined duration.
2. The exponential mean: FFTs are continuously measured. Here, too, a fixed number of results of the continuous measurements are considered. However, the weighting is inversely proportional to the 'age' of the result. The oldest of the measurements is taken the least into account, the most recent measurement contributes most effectively to the averaged result. This exponential average is used when the spectrum is continuously monitored over a long period of time. ### Power vs. Peak detector

Modern high-resolution FFT analyzers offer the possibility to decouple the number of measurement results from the FFT block length. This results in an increase in measurement performance time, especially for high-resolution FFTs. Thus, for example, with a 2MB block length it is no longer necessary to measure and represent more than 1 Million points (bins), but only the number necessary for the display, e.g. 1024.
The value chosen for each FFT bin can be defined in two ways:

1. "MaxPeak": Here the maximum value of the FFT results is used. This type is well suited for the visual representation of FFTs
2. "Power": Here the FFT results are summed up and averaged energetically. This is necessary when the FFT is used for calculations.

### Calculations with FFT results

FFTs are mainly used to visualize signals. However, there are also applications where FFT results are used in calculations. For example, very simple levels of defined frequency bands can be calculated by adding them via an RSS (Root Sum Square) algorithm.

Another application is the comparison of spectra. The example below shows an acoustic measurement of a cordless screwdriver. The measured spectrum is subtracted from a defined reference spectrum. This difference is compared against an upper and lower tolerance. The upper spectrum shows a functional cordless screwdriver. In the lower, the acoustic spectrum suggests that the test specimen is defective.  