Headphone Measurements Explained - Square Wave Response
Read about square waves and the most common thing you'll hear is they are made of a fundamental and an infinite set of odd harmonic tones in a very particular amplitude and phase relationship. That's true, of course, but in the real world and with regard to testing headphones, it may not be the best way to think about them. It's a decent place to start though.
Viewing Square Waves as Made of a Fundamental and Odd Harmonic Series
To show you how square waves are built from a fundamental tone and its odd harmonics, I created a little Excel spreadsheet. In the spreadsheet (you can download the Excel file here). I used some simple math to create a series of columns holding data that represented the appropriate sine waves that I could then add together to form the square wave. The formulas used also had some variables with which I could control the relative amplitude and phase of the odd harmonics.
The top plot to the left shows the fundamental tone and the first four odd harmonics. The next plot shows the result of simply adding together the amplitude of the signals at each point in time. You can see clearly that the result begins to look quite like a square wave. The third plot shows the result using the first 11 odd harmonics, and you can see does a better job of making a facsimile of a perfect square wave. As more and more odd harmonics are used, the square wave gets closer and closer to the ideal. In band width limited systems--like a DAC that might have a limit of 22kHz for 16/44 CD playback--only a limited amount of odd harmonics available, and square wave reproduction will look quite like the third plot.
There are two other things that can misshape the square wave response: phase and relative amplitude errors between the fundamental and harmonics. In the fourth plot, the phase (time relationship) of the odd harmonics is advanced as the frequency gets higher. In audio electronics gear, all frequencies are delayed a little, but high frequencies typically move through the circuits a little more quickly than low frequencies. The words "group delay" are used to identify this phenomenon. Group delay creates phase error in the timing relationship of all the odd harmonics of a square wave. In the fourth plot to the left, I've introduced some phase error, and you can see how it changed the shape of the square wave some and introduced an overshoot on the leading edge.
Errors in the amplitude relationship of all the odd harmonics can occur if the system's frequency response is not flat. In the second to last plot at the left, I've simulated a tipped-up frequency response (less bass, more treble), and in the last plot I've simulated the opposite with more bass and less treble.
This is a valid way to look at square waves for some applications, but it makes some assumptions about the sine waves being continuous forever that make it a little misleading in terms of the type of square wave testing I do on headphones. For example, in the third plot down, you can see little spikes before the transitions. This is called "pre-ringing." How could an analog system know the signal is about to change and create the pre-ring? Answer: it can't. That's one of the reasons why it's better to look at square wave response as a series of step responses.
Step Response and Square Wave Response
Step response is simply measuring how the device under test responds to an instantaneous shift in level. From 0Volts to 1Volt, for example. As long as the frequency of the square wave used is longer than the lowest frequency of interest, a square wave is simply a series of step responses.
Step response is used broadly in audio electronics and electronics in general to indicate a variety of performance characteristics in the time domain, such as rise time, overshoot, settling time, and ringing. But step response also contains phase and frequency response information. For example, it is one of the speaker characteristics John Atkinson measures to look at the phase coherence of a multi-driver speaker. (His very interesting explanation is here.)
You can also think of step response as a measure of frequency response where the leading edge slew rate indicates the high-frequency limit, and the length of time it can keep the step at the new level an indication of its low-frequency limit. At every point between, you can think of the level of the top of the step response as related to the frequency response at the frequency whose quarter wavelength is equal to the elapsed time since the leading edge of the step/square wave.
Another way to look at it is similar to the summation of a series of odd harmonics we talked about above. You can think of a step response as the amplitude response of a continuous series of equal amplitude narrow-band pulses.
This isn't the whole picture, though, as superimposed on the frequency component of the step response are time domain artifacts like ringing and phase information. The bugaboo about measurements is that if you test for information in one domain to make it perfectly clear, the information in the other domains disappear from view. You can't see time information in the frequency response plot, but it's there and you can calculate it. And you can't see frequency response in the impulse response, but again, it's there. The cool thing about step and square wave response is that you get a nice, albeit hazy and sometimes difficult to interpret, mix of both time and frequency information that, for me, feels a bit more naturally accessible and rich.
Now let's look at the special case of 30Hz and 300Hz square wave testing of headphones, and how to interpret the results.