Feb. 1 2020
If you work with digital audio you may at some point have come across the term 'aliasing', perhaps in the context of getting rid of it - a process called Anti-Aliasing. But what is it, and why does it need to be gotten rid of?
Let's keep this as simple as possible. I will give a brief barebones explanation of what aliasing is, but will mostly focus on why and when it can happen in day-to-day studio applications.
Digital audio is stored by taking a series of samples of an analog signal. This happens extremely quickly; the common sample-rate of 44.1 kHz means 44,100 samples are taken every second. The sample-rate sets the highest frequency that can be stored - it's a bit more complicated than that (check out this Wikipedia article for more detail) but for the sake of discussion we'll leave it at that.
Aliasing occurs when a signal contains frequencies higher than what the sample-rate can store, and those high frequencies get 'folded' back into the range the sample-rate is capable of storing. This means some high frequencies are lost, and new lower frequencies are generated. The high frequencies lost aren't a big deal because they're more than likely higher than what humans can hear, but the lower frequencies created are not. They might be right in the audible range, causing distortion in your music.
So if high frequencies that we can't even hear cause such problems, why not just filter them out? Well, that's exactly what Anti-Aliasing is: a steep low-pass filter to remove the high frequencies that would otherwise cause aliasing.
Any quality modern analog-to-digital converter will apply an anti-aliasing filter to the signal before it is sampled, so as far as recording goes there's not much to worry about. But what about when working inside your DAW? The most common way you're probably introducing more aliasing is through distortion.
There's plenty of reasons you might intentionally distort your music. Things like amp simulations, compressors, limiters, saturators - these are all tools we regularly use to mix that also cause distortion - which is to say they generate harmonics. Those harmonics can sound great, and might even be why we're distorting things in the first place, but some of those harmonics might be high enough in frequency to cause aliasing.
HEARING IS BELIEVING
Below is an example of a 1 kHz sine wave, then the same wave that has been clipped and anti-aliased. You can clearly see and hear the harmonics that were generated by the clipping distortion. Then finally the clipped version without anti-aliasing, again you can see and hear the additional distortion being folded back into the signal.
(click thumbnail to enlarge and hear audio)
Now you might be thinking the third one doesn't really sound that much worse than the already-distorted example in #2. Sure it's a little more squelchy and harsh, but this is an extreme example isn't it? Well, yes, but then again music doesn't consist of standalone steady tones. It's complex, full of dynamic movement, so let's add a bit of movement into the mix.
Below is the same test, but using a signal that sweeps from roughly 1 kHz up to 20 kHz and back down.
Yuck. And this is still a very simple signal compared to the complex waveform of a musical composition, so now it's pretty clear that aliasing has the potential to be a real problem, turning the clear, airy highs of your music into a garbled mess.
So how do we prevent it? Simply not using anything that generates harmonics is obviously not an option, and putting a low-pass filter after everything that generates harmonics doesn't cut it either - the aliasing will already be in the signal before it hits your filter.
What we need is something called oversampling. The basic idea is to convert up to a higher sample-rate, allowing those high-frequency harmonics to be sampled correctly so that they can be filtered out before converting back down to your original sample rate.
There's two main ways of achieving this:
By bumping your whole session up to a high sample-rate like 96kHz or 192kHz your DAW can properly handle harmonics at much higher frequencies. Aliasing can still occur, but is likely to be at frequencies too high to hear.
This is not without its downsides, however, and they're substantial. If you're not working with audio that was recorded at 96kHz to begin with, all of the audio in your session will have to go through Sample-Rate Conversion (SRC). For one, that's a lot of computing horsepower being used up to eliminate aliasing on perhaps only a handful of tracks in your session. Real-time SRC in most DAWs also don't have a great track record for being transparent, and can end up sounding significantly different (check out src.infinitewave.ca to see how your DAW stacks up against the rest).
This is my preferred method of dealing with aliasing.
You may have noticed that most modern limiters include some form of oversampling control with selectable amounts (2x, 4x, 8x, etc.) depending on what your machine can handle. The plugin will upsample its input, process at the high rate, filter out the harmonics that could cause aliasing, and downsample back to the session sample-rate.
Because the oversampling is happening only where needed instead of globally it's much more efficient, and can be done at much higher rates if necessary.
The downside here is not all plugins offer this option, although some may make use of oversampling behind the scenes. This can easily be tested with tones and sweeps like the examples above.
With all that in mind, I'll throw in the caveat that not every single instance of distortion is necessarily going to be an aliasing risk, so even if your favourite distortion plugin does not oversample it doesn't mean you should never use it.
For example, some gentle gentle saturation on a bass is unlikely to generate ultra-high frequency harmonics at a loud enough amplitude to be much of a problem in the context of a mix. However, a clipper-style limiter used on a full mix that includes high frequencies already is almost certainly going to cause aliasing.
So, if the plugins you already use offer oversampling then it's probably a good idea to turn it on to be safe. If not, consider the context you're using it in but don't let it distract you too much from the most important thing: making music!
If there's a topic you'd like to know more about, send in your article suggestions!