Chirp analysis - loudifier/chirplab GitHub Wiki
Chirp Analysis
Most of the audio processing in Chirplab is based around generation, capture, and analysis of exponentially-swept sine sweeps, often referred to as a "chirp", or "logchirp" becuase they have a linear frequency vs time graph when plotted on a logarithmic frequency scale.
Many audio metrics can be derived from different stimuli, like stepped frequency sweeps, MLS noise, linear chirps, or even arbitrary signals. Single sine tones, and by extension stepped frequency sweeeps, are the gold standard for high-precision measurement of frequency response and distortion, but acquiring a single frequency point of data is relatively slow and measuring a full frequency range with a high frequency resolution is prohibitively time consuming. Continuous sine sweeps allow you to measure a full frequency range with arbitrary resolution, but cannot be simply filtered or FFT'd to quantify the system's linear response, distortion, and noise.
In 2000, the audio industry saw a step change in testing capabilities with the publication of Angelo Farina's 2000 AES paper Simultaneous Measurement of Impulse Response and Distortion With a Swept-Sine Technique, which showed that a logchirp has unique properties that can be exploited to take measurements similar to a stepped frequency sweep in a fraction of the time. Since then you will sometimes see a logchirp referred to as a "Farina chirp" and its analysis referred to as the "Farina method". You should read the paper yourself, but this page serves as a simplified explanation of the Farina method.
So what makes a logchirp special? First, consider a linearly-swept sine sweep.
It has the advantage over a stepped frequency sweep of having a continuous frequency resolution, which allows you to measure a transfer function much faster. It also has a high crest factor spread over the length of the chirp and a well-controlled spectrum, which overcomes many of the limitations of measuring an impulse response directly with an actual impulse signal.
Probably the best feature of a linear chirp is that it has a white spectrum (equal power in equal bandwidth), so the frequency response of a system measured with a linear chirp is just the FFT spectrum of the response signal (after accounting for FFT scaling).
Unfortunately, a linear chirp spends little time at lower frequencies, resulting in poor SNR where noise tends to be worst. Extending the chirp to improve SNR at low frequencies results in unneccssarily long dwell time at high frequencies. (This can still be an issue with logchirps. There are some approaches to use different sweep rates for low and high frequencies, but that is currently out of scope for Chirplab)
One interesting feature that you might notice when looking at the spectrogram of a linear chirp response from a speaker is that there are shadow chirps expanding out from the origin of the chirp signal (or 0Hz if the chirp starts at a higher frequency). These shadows are harmonic distortion in the system under test and appear at frequency multiples of the fundamental frequency of the chirp.
Now, consider an exponentially-swept sine sweep, or logchirp.
The signal spends much more time at low frequencies, which improves SNR, and has a pink spectrum (equal power in proportional bandwidths), which more closely matches music, speech, and the overall average spectrum of typical audio content.
The pink spectrum means we can no longer measure frequency response directly, but this is easily corrected by dividing the spectrum of the response by the spectrum of the stimulus to produce the complex transfer function of the system. Taking the inverse FFT of the transfer function produces the impulse response of the system.
You can derive many useful metrics from the impulse response of a linear system, but impulse responses will usually be affected by the nonlinear response (distortion) of a system as well, which reduces the accuracy of the derived metrics. Using a logchirp to measure the impulse response allows you to separate the linear response of the system from the nonlinear response, which improves the accuracy of the metrics derived from the impulse response, and also allows you to quantify the nonlinear portion of the response.
The spectrogram of a logchirp response provides an intuitive view of how the linear and nonlinear components of the response can be separated.
The same harmonic distortion shadow chirps from the linear chirp response show up here at frequency multiples of the fundamental frequency of the chirp, skewed according to the exponentially-rising chirp frequency. But something very interesting happens when you plot the spectrogram on a logarithmic frequency scale.
Notice that the fundamental chirp and the shadow harmonic chirps now appear as straight lines. Compared to the linear chirp spectrogram, where the fundamental and harmonic chirps all radiate out from a single point in time, the harmonics of the logchirp are parallel to the fundamental, equivalent to chirps that start earlier than the fundamental chirp. The apparent starting time of these harmonic chirps can be derived from the fundamental chirp sweep rate and, when an impulse response is derived from a logchirp measurement, harmonic impulses appear in the impulse response preceding the fundamental impulse response corresponding to the apparent starting time of the harmonic chirps.
The overall result of deriving a system's impulse response from a logchirp is that the fundamental response and harmonic distortion can be easily windowed out in the time domain representation of the transfer function, transformed back into the frequency domain, and quantified separate from each other. This process approaches the accuracy of a single tone test, but is orders of magnitude faster and has continuous frequency resolution.
The technique of windowing out the impulse response can be extended to also reduce the impact of noise contaminating the measurement. The noise floor of the system is spread evenly over the length of the impulse response. Because the energy of the impulse response is confined to a known range, the noise outside of that range can be discarded, improving the accuracy of the measurements. Increasing the chirp time, and thus the total impulse response length, spreads the noise contribution to the impulse response over a longer range, reducing the effective noise level even further.
How the fundamental impulse response, harmonic impulse responses, and noise are windowed and quantified are detailed further in the Frequency Response and Harmonic Distortion measurement pages.