The reason the fast Fourier transform (FFT) gets so much attention in audio is that it allows us to look under the hood of a complex waveform and discover what frequencies are present. The converse is also true: by combining sine waves of various frequencies and phases, we can create any waveform we like. This is how additive synthesizers and Hammond organs work, for example.
Square waves consist of a fundamental frequency f combined with odd harmonics 3f, 5f, 7f, and so on, decreasing in amplitude as they go. Figure 1 shows a 1 kHz sine wave combined with the first two odd harmonics at 3 kHz and 5 kHz to form the beginnings of a square wave.
To have perfectly vertical edges and perfectly flat tops, a square wave must contain frequencies to infinity. Maybe in the next firmware update.
Real-world square waves are band-limited by the audio system and thus can look a little wobbly. This is often misinterpreted as ringing imparted by a filter, but it’s actually just the result of the system having a non-infinite high-frequency response. (This concept is known to mathematicians as the Gibbs phenomenon.)
Since every frequency present plays some role in defining the overall shape of the composite signal, we can’t change one without changing the whole. It can be challenging to realize that we’re talking about the same concept from two perspectives: adding, removing, or altering any of the component frequencies results in a different composite waveform, and any time we change the shape of a waveform, we’re also modifying the sine wave components in some way – either by changing which component frequencies are present, or changing their amplitude or phase.
Let’s take this out of the realm of theory and look at a practical situation: what happens when we clip a signal?
The following was inspired by a much more in-depth exploration by console designer Douglas Self in his book Audio Power Amplifier Design. In studying Self’s work, I found the concept interesting enough to do some experiments of my own. For me, getting hands-on with a given subject matter brings a deeper level of understanding than I could achieve by just reading about it.
The audio files used here were generated using freeware audio editor Audacity. I enabled the “connect the dots” view option so the waveform on the screen visually resembles what would appear at the output of a digital-to-analog converter (DAC), but remember that in the digital realm, amplitude data only exists at the sample points, indicated by circles, and not in between.