One of the most useful test signals in electronics is the humble square wave. The “ideal” square wave is a superposition of an infinite number of sine waves, each contributing its required amplitude and phase. It is due to this very feature that, when passed through an audio system, the square wave can reveal time domain performance issues of the system. This is because all of its sine wave components must be passed by the system without time distortion, or different delays, in order to recombine as a square wave at the output of the system under test.
Practically generated square waves have a limited number of contributing sine waves, but the number is still sufficiently large that for audio frequency range testing, we can fully utilize the “almost perfect” square waves. It is important to realize that the system time delay does not need to be zero. But it must be the same for all frequencies within the audio system passband. Such conditions will be easily met if the system under test has a zero-degree phase response.
Real-Life Loudspeaker Example
The system under test here consists of a filter and a loudspeaker in an enclosure. The two components that will introduce time delay are the filter and the combination of driver and the enclosure itself. To illustrate this, I measured a 12" guitar loudspeaker in a vented box. Its minimum-phase (MP) responses were obtained with the help of an MLS measurement technique (Fig. 1). It is immediately observable that the loudspeaker has a rather irregular frequency response.
Because the loudspeaker is essentially a minimum-phase device, the corresponding phase response is also highly irregular, and definitely not flat. The frequency response of interest is the frequency range where the SPL will be equalized to flat response. In my example, it will be 91Hz–5250Hz. A 300Hz square wave reproduced by this loudspeaker is highly distorted.
The outgoing waveform resembles a triangular-wave with a high level of ringing imposed on it. The ringing is the result of a highly irregular frequency/phase response from 1kHz to 6kHz, with an additional +10dB peak around 3.5kHz. The resulting square wave is shown in Fig. 2.
Unfortunately, this is what most loudspeakers do — irregular frequency response, coupled with accumulated delays in the system, prevent the loudspeaker from correctly recombining all sinusoidal components of the square wave. The result is quite poor reproduction of musical transients. Just as the vertical transitions of the square wave and their flat sections are reproduced as spikes with ringing, musical transitions are also highly distorted.
But musical transients are difficult to capture because they change constantly. More important, we do not really know what the “undistorted” musical transient should look like in time domain (Fig. 3). So, even though nobody listens to square waves, they provide a well-defined test signal that will be very easy to compare with distorted square waves passing through the loudspeaker. The distortions, or deviations, are therefore immediately obvious, and provide clues as to the origins of the distortions. A high level of ringing in the resulting square wave is related to irregular frequency response. This gives the first clue in the quest to improve the shape of the outgoing square wave—flatten the frequency response.
A popular tool used for linearizing a transfer function of an LTI (Linear Time-Invariant) system is a Hilbert-Bode Transform (HBT). Like the Fourier Transform, which allows us to flip between time domain and frequency domains, the HBT allows to move from magnitude response to phase response and vice-versa. I can therefore nominate a frequency range of interest within the loudspeaker’s magnitude response, then attach flat “tails” on the low and high side of this frequency range and apply this artificially created magnitude response to the HBT. As a result, I get corresponding phase response, which, in turn, means that I actually have a full complex transfer function calculated via HBT.
On-Axis Versus Off-Axis Equalization
Typical loudspeakers will exhibit somewhat different frequency response when measured off-axis. Figure 4 illustrates this situation very well. Because the HBT-based equalizer is being designed for on-axis performance, there is a need to consider its impact on off-axis performance of the loudspeaker.
It is observable that the 0 degrees, or on-axis, curve is the flattest within the whole family of responses. This is a very common occurrence and is due to the fact that loudspeakers are typically designed and optimized for the on-axis performance. Therefore, the equalizer design for on-axis performance automatically requires the least amount of equalization to perform. This is actually quite often advantageous for off-axis performance as well.
If we examine the off-axis curves on Fig. 4, we will notice that as the angle increases, the curves have gradually increased peaks and valleys, but the deviations hold their locations on frequency scale. If the same equalizer were applied to each of those curves, only the on-axis curve would be fully equalized.
Other curves would be equalized to a lesser degree, but they would not be over-equalized. For instance, the 5 degree curve has a very similar shape as the 0 degree curve, but the notch at 18kHz is much deeper. If we correct this curve with the same equalizer, then most of the curve would become almost perfectly flat, but the notch at 18kHz would still be evident to some degree.
We can examine the curves for other angles and we would most likely conclude that the equalizer would still help correcting many of the irregularities evident in off-axis curves. The above situation is typical; however, not all loudspeakers are as easy to handle as this one. If the peaks and valleys of the off-axis frequency response are unstable in frequency domain, then the effectiveness of equalizer will be reduced.
Amplitude Equalizer Design
The importance of having the error transfer function is that it can be convolved with the loudspeaker’s transfer function to linearize its frequency response. The linearization will be accomplished if the HBT-calculated transfer function is first inverted. The result of this operation is a mirror-imaged frequency and phase response calculated within the previously nominated frequency range, and flat response everywhere else.
I have now produced an Amplitude Error Function. The bold line (A in Fig. 5) is the SPL of the Amplitude Error Function (notice, it’s inverted already), and line (B) is the phase of the Amplitude Error Function. Please note mathematically correct phase response and its transitions from irregular-to-flat sections. This is the HBT in action.
Also note that the linearization process described so far happens in frequency domain. Therefore, the convolution process that is rather complex in time domain is now reduced to simple multiplication of the loudspeaker’s frequency response with the corresponding Amplitude Error Function.
The result of amplitude linearization is shown in Fig. 6. The resulting SPL (A) is now flat within the frequency range of interest, and the phase response (B) is almost smooth within the same frequency range.
At this point, we should examine whether we are making any real progress in time domain, as we are making in the frequency domain. Lets look at the square wave being passed through the new, amplitude-linearized loudspeaker system (Fig. 7). The news is good — we are making visible progress. The square wave after being passed through the amplitude-linearized loudspeaker system has now lost almost all ringing characteristics. It’s still not a typical flat-top square wave, but we have already removed much of the imperfections.
Inspecting the non-flat shape of the square wave leaving the loudspeaker, we can suspect that, still, not all sinusoidal components of the square wave recombine correctly. Otherwise, the square wave would be flat already. Because we have taken care of maintaining the amplitudes of those sine waves by linearizing the frequency response of the loudspeaker, then the only remaining parameter that is still causing recombination errors must be the phase of the system.
Indeed, the phase response (yellow curve Fig. 6) is smooth, but not flat. If we could somehow “reverse” the phase response, we stand a good chance that combining the reversed phase with the loudspeaker’s own phase delay will yield a flat phase response of the system.
Inverting System Phase
A technique that allows to reverse phase response of an LTI system is based on time-inverting its impulse response. In practical terms, we need to reverse time scale of the impulse response. Typical impulse response described in time domain starts with a high peak, followed by its decaying tail.
Imagine reversing time scale — it would be like the start of the impulse was the tail end of it, and then we arrive at the peak. If we perform this operation as convolution, interestingly, the phase response becomes its own mirror image around zero degrees. And that’s exactly what we are looking for. In addition, if we are using FIR (Finite Impulse Response) techniques to accomplish the convolution, the amplitude response of the process can be decoupled from the inverted phase response and then forced to become flat.
We have now produced a perfect phase-reversal device with flat amplitude response — System Inverse Phase Function (Fig. 8). Remember, flat amplitude response requirement is important here, because at this stage, we do not want any more amplitude corrections. We have done this already in the previous stage, using the Amplitude Error Function.
To summarize, we now have two transfer functions:
– Amplitude Error Function—produced by inverted HBT. This is used to linearize the system’s SPL and remove ripples from phase response within the SPL frequency range of interest.
– System Inverse Phase Function — this is used to nullify the whole system phase response.
Now lets apply these two corrective functions, in order, to the loudspeaker frequency response. In other words, multiply the loudspeakers’ transfer function first, by the Amplitude Error Function, then take the result and multiply it by the System Inverse Phase Function. The function that we obtain in the end is the final transfer function of the fully equalized system. We can now try to pass our test square wave through such system and observe the result.
Conclusions
It is clearly evident that the proposed two-stage equalization technique brings about very good results. The resulting outgoing square wave is almost perfectly recombined from individual sine waves constituting the input square wave. This would be a confirmation that the equalized system now has flat amplitude within the frequency range of interest, and zero phase response. This loudspeaker can now play square waves.
A second, equally important, conclusion comes from analyzing Fig. 6. The Amplitude Error Function makes the magnitude and phase of the loudspeaker smooth, but it does not change macro-characteristics of the phase response, or rather, it does not “unwrap” the phase. The importance of this is that we can equally apply the HBT-based Amplitude Error Function to smooth the magnitude and phase response of non-minimum phase systems, such as a multi-way loudspeaker system, complete with crossover.
Also, the System Inverse Phase Function inverts the phase of the complete system, as it was measured, and regardless of the trajectory of the phase response. Consequently, the whole two-stage equalization technique is fully applicable to multi-way loudspeaker systems.
The third important conclusion is almost automatic. Linear phase response of the complete system (in this case, zero phase response) results in constant group delay — also equal to zero — of the complete electroacoustical system. As I explained at the beginning of this article, I mounted the loudspeaker used for this example in a vented enclosure. Therefore, the measured
phase response already included characteristics (or phase delay) of the vented box. Because the finally obtained phase response was totally flat, it shows that the equalization process automatically eliminated group delay associated with the enclosure.
Finally, I would like to thank John Kreskovsky of Music and Design for the inspiration and exchange of ideas in the development of this procedure. aX
References
1. “Loudspeaker Response Equalization Using Warped Digital Filters”—Matti Karjalainen, Esa Piirila, Antii Jarvinen—NORSIG 96. Available in public domain from www.acoustics.hut.fi/~mak/PUB/Norsig96_EQ.pdf
2. Personal correspondence with John Kreskovsky.
3. SoundEasy V17 computer software.
This article was originally published in audioXpress, June 2010.