Can you hear the difference between a square wave and a sine wave?
Transcript of the video soundtrack...
I am going to demonstrate the difference in sound texture between a square wave and a sine wave, and show how they become subjectively increasingly similar at higher frequencies.
I'll play a signal that alternates between square wave and sine wave, starting at 100 Hz. You will hear the difference clearly.
As you can hear, the square wave has a very much brighter and harsher tone, compared to the sine wave, which is very smooth. The levels have been set to the same RMS values, so that both waveforms should be subjectively equally loud.
Now I will increase the frequency to 1000 Hz, or 1 kHz. As I continue to increase the frequency I will adjust the timebase control of the oscilloscope so that you can see the shapes of the waveforms clearly.
At 1 kHz the square wave and the sine wave still sound very different to each other. I will increase the frequency in 1 kHz steps...
- 2 kHz
- 3 kHz
- 4 kHz
At this point you will probably start to hear both waveforms as being very similar, apart from a small difference in level that I will explain in a moment. Let's move more quickly through the frequency range...
- 6 kHz
- 8 kHz
- 10 kHz
- 12 kHz
At this point, both waveforms sound pretty much identical. The reason for this is that the brightness of the square wave is caused by its harmonics. Where a sine wave only has one frequency component - its fundamental - the square wave has the fundamental and harmonics at whole odd-number multiples of the fundamental frequency. So in a 100 Hz square wave, you hear frequency components of 100 Hz, 300 Hz, 500 Hz, 700 Hz, and so on all the way up the frequency band, as you can see in this spectrogram.
When we get to a fundamental frequency of 4 kHz however, the next frequency component, which we call the second harmonic is at 12 kHz. Many people can't hear frequencies as high as this. At a fundamental frequency of 8 kHz, the second harmonic is at 24 kHz, which hardly anyone is capable of hearing. It is also worth saying that digital audio sampled at 44.1 kHz which is common can't reproduce 24 kHz either. A sampling rate of 96 kHz was used to make the original recordings here to show on the oscilloscope, to allow a margin of safety.
So, as the frequency increases, the harmonics of the square wave become inaudible, leaving only the fundamental, so at a high enough frequency it sounds exactly the same as a sine wave.
Finally, let me explain the slight differences in level. Well, if the harmonic components of the square wave are being lost at very high frequencies, the overall level will therefore be a little lower.
You might also notice some ringing in the square wave signal. This is probably being created by filtering in the digital-to-analog convertor. The ringing frequency is around 46 kHz, so it is well above the audio band. The oscilloscope, by the way, is specified up to 20 MHz, so we can expect it to be completely clean in the audio band.
In summary, at increasing frequencies, a square wave begins to sound more and more like a sine wave.