Oversampling in Digital Audio: What Is It and When Should You Use It?
Article Content
The complexities of sampling theory are a mystery to many producers. Most have a basic grasp of what a sampling rate is but may not be able to explain some of the fundamental concepts and how they relate to the sound output by a system or process. Also, there are some excellent plugins that give the user access to the internal rate of oversampling that is used, and it would be useful to understand what sort of results you might expect when selecting the rate.
In this article, I’ll start by briefly defining some basic terminology and processes which will be review for many, but necessary to set the stage for the demonstration that follows.
Terminology
Sampling Rate – this is the number of times per second an incoming signal is measured. Typical rates include 44.1 kHz (44,100) for audio CD and 48 kHz for audio for video productions. High-resolution audio can go upwards of 96 kHz or 192 kHz.
(source)
Nyquist Frequency – this is defined as the highest frequency that can accurately be reproduced by a digital system. It is equal to 1/2 of the sampling rate. For example, a 48 kHz sampling rate can theoretically accurately reproduce frequencies up to 24 kHz.
(Reid)
Aliasing and Foldback – is a process that produces non-harmonic frequencies that are not part of the input signal. These frequencies are artifacts of the sampling and digitization process itself. They are folded back into the audio range and create ringing and other unwanted noise.
Anti-Alias Low Pass Filtering – this process attempts to filter out the frequencies that exceed the Nyquist frequency from the input signal. These frequencies would otherwise be folded back into the audio range. The effectiveness is contingent upon the current sampling rate. Higher oversampling rates ease the burden of the filter design which would otherwise require very steep slopes to be effective in reducing aliasing.
Steven McManus suggests a visual parallel to audio frequency aliasing:
“An example of the effect of aliasing can be seen on moving wagon wheels in a movie that appear to reverse direction. The sampling rate of the film is lower than the rate at which individual spokes pass the top of the wheel. When the image is reconstructed, the spoke frequency has folded over and the wheel appears to move at a different rate. This phenomenon is known as aliasing.” (Ballou, p. 811)
Oversampling Rate – this is a resampling rate based on the original sampling rate. For example, if the original sample rate is 48 kHz, an oversampling rate of 2x infers a resampling or upsampling rate of 96 kHz.
Upsampling – the process of resampling a signal at a higher rate than the incoming signal.
Downsampling – the process of reducing the sampling rate of a process back to the original rate of the system.
Bit Depth – the number of binary bits used to describe a particular sample. Typical bit depths include 16-bit (audio CD), 24-bit and 32-bit for higher resolution audio. The higher the bit depth the wider the dynamic range and the lower the noise floor will be. The number of possible values in a 16-bit system is 2^16 = 65,536. The number of possible values in a 24-bit system is 2^24 = 16,777,216. This means the samples measured will be far more accurate in a 24-bit system resulting in less quantization error and a higher signal to noise ratio: 96 dB for a 16-bit system versus 144 dB for a 24-bit system.
Harmonic Distortion – this occurs when frequencies that are harmonically related (integer multiples) to the incoming fundamental frequencies are generated using processes like overdriving, clipping, limiting, or saturation. The timbral effects produced are usually a pleasing and desirable coloration of the input signal.
Demonstration of a Clipped Sine Wave and the Effects of Oversampling
The StandardCLIP plugin is a sweet little processor developed by SIR Audio Tools. It is designed to clip an incoming signal at a defined amplitude level (seen in the image below as the “Clip” slider). When used subtly it does a wondrous job of adding a few dBs of gain to a signal without the coloration of a limiter or compressor. When used more aggressively, you can also change the timbre for more creative effects. Related to the subject at hand, observe the “Oversampling” parameter in the center of the GUI which can implement anything from the system sampling rate (1x) to a whopping 256x that rate. The developer’s site has a short demonstration of the effects of this control, but I wanted to duplicate their test and go a little further. So with the help of a little patch written in Max/MSP I did just that.
Below is a video of some experiments that include running a sine wave sweep (60 Hz to 15 kHz) and fixed sine wave frequencies through the StandardCLIP plugin using various oversampling rates. Note that when a sine wave is clipped, a series of harmonics is produced. As those harmonics rise above the Nyquist frequency, as determined by 1/2 the sampling rate of the system, frequencies begin to be folded back into the audible range creating nonharmonic frequency components or artifacts that are not part of the intended signal. This is a process called aliasing. You can see these additional frequencies gather around the main harmonic spikes and shift throughout the spectrum as the sine wave sweeps upward.
Choosing an oversampling rate 2x or more instructs the algorithm to upsample the incoming signal thereby temporarily raising the Nyquist frequency so there are fewer artifacts and reduced aliasing. Higher levels of oversampling results in less aliasing occurring in the audible range.
Note that the 128x and 256x settings do not produce acceptable results in realtime and bring my computer system to its knees. So I muted the glitchy audio that it tries to produce in realtime — just consider the graphic readout as you compare settings. These higher rates would need to be processed offline.
When to Use Oversampling and at What Rate?
The obvious question is, if higher oversampling is better, why not crank it up and leave it there? The equally obvious answer is increased CPU usage. Oversampling rates as high as 128x and 256x will likely not work in realtime on your computer and will slow your system to a crawl. Consider that a 256x oversampling rate means that if your system is running at 48 kHz, the plugin is sampling the incoming signal 12,288,000 (48,000 x 256) per second, (!) and then downsampling back to 48 kHz in the same process. That’s a huge task for your average CPU.
Another consideration is creative choice, and this where I tell you to forget about all the numbers and trust your ears. It’s been suggested that aliasing adds a desirable effect and coloration in certain circumstances. But of course, “desirability” is highly subjective. There is certainly the idea of diminishing returns as demonstrated. At a certain level of oversampling, you may be unnecessarily taxing your system for no audible benefit. Oversampling at 256x just because you can is not a valid reason to do so. The visualizations below represent a 975Hz sine wave clipped by -12 dB at various oversampling rates. Note that above 8x oversampling the difference becomes negligible, at least at this particular frequency.
In some plugins oversampling is done internally and dynamically to optimize the process. In a recent Facebook post, the developers at Brainworx state:
“All analog modeled plugins “made by BX” apply oversampling internally whenever it is necessary, in a really clever way. We are typically not simply oversampling the whole plugin, as this would increase the CPU/DSP load unnecessarily in most cases […] We don’t offer these upsampling modes to be selectable or switchable by the user, because we believe they are highly optimized for each circuit and application the way we have integrated our upsampling.” (Source)
Other plugins do offer user selectable oversampling modes, such as FabFilter’s Pro-L 2, Pro-C 2, and Pro-MB as well as Oeksound’s remarkable FFT-based gems Soothe 2 and SPIFF. And if you haven’t tried StandardCLIP by SIR Audio Tools used in the demo above I highly recommend you give it a try. At $25 it’s a no-brainer.
Below are some great sources of information on this subject and other digital audio processes for the adventurous and/or curious.
References
Ballou, Glen. Handbook for Sound Engineers. Focal Press, 2008.
Cipriani, Alessandro, and Maurizio Giri. Electronic Music and Sound Design: Theory and Practice with Max and MSP – Volume 2. ConTempoNet, 2017.
“Digital Audio Basics: Sample Rate and Bit Depth.” iZotope, 17 Feb. 2021, www.izotope.com/en/learn/digital-audio-basics-sample-rate-and-bit-depth.html.
Reid, Gordon. The Digital Myth, 1 Mar. 2021, www.soundonsound.com/techniques/digital-myth.
Roads, Curtis. The Computer Music Tutorial. MIT Press, 2012.
Check out my other articles, reviews and interviews
Follow me on Twitter / Instagram / YouTube