Audio Programming: Aliasing

Gerald Clark
2 min readJan 12, 2024

Today I want to talk about one of the fundamental aspects of digital signal processing (DSP). Aliasing!

So in my last article, found here: Audio Programming: Sample Rate and Bit Depth | by Gerald Clark | Jan, 2024 | Medium, I talked about sample rate, bit depth, and the Nyquist theory. In short, the Nyquist theory says that the maximum representable frequency is half of your sample rate. So if I’m in 44.1, the Nyquist Frequency would be 22,050hz. Anything above that would be considered aliasing.

So below I’ll try to show what exactly happens when a signal aliases.

So lets just pretend this is a signal of my voice.

The red dots on the wave form represent the points at which the signal was sampled. In this scenario lets pretend our sample rate is too low and we’re unable to capture all of the signal’s frequency components.

This doesn’t give us very many points that we can base our signal off of. So what would happen is that since our signal can’t be represented accurately it would be shown as this new sine wave I’ve drawn on top of it (poorly).

So what is happening is that the new wave is at a totally different frequency than we intended to have. So this is what happens when we go above our Nyquist frequency.

So lets say we have a sine wave playing and it goes from 20hz all the way up to 44,100hz. As it passes the Nyquist frequency, the wave actually starts descending in pitch. Once you reach 44,100hz, the frequency you’re hearing is 20hz.

So if we somehow had our sine wave’s frequency move beyond 44,100hz it would actually start to go up again in pitch.

This can lead to a number of problems, such as loss of information, distortion of the signal, and difficulty in interpreting the signal.

--

--

Gerald Clark

Father Game Developer Music Composer Sound Designer