At the core of any synth is it’s oscillator – the device that produces the raw waveforms that form the building blocks of synthesis. In the analogue world, these are typically voltage controlled and built via electronic components such as op-amps and diodes. In the digital world, such as in a plug-in, there are many ways to build an oscillator and one of the most popular methods is via an algorithmic technique (i.e. a mathematical equation). The most important and deployed approach in digital synthesizer design within the modern landscape is the use of quasi band-limited oscillators to reduce aliasing. Quasi what? To answer that question we first need to consider aliasing in terms of synthesis….
You are most likely familiar with aliasing from your experience of the world of digital audio theory. We typically tend to set our DAW to operate with a sampling frequency (i.e. 44.1kHz or 48kHz) that conforms to the Nyquist-Shannon sampling theorem. This theorem states that we need to sample a signal at twice its highest frequency to be able to uniquely reconstruct it. This frequency is called the Nyquist frequency. When recording an acoustic signal into our DAW via an audio interface, the A/D converter in the interface has a brick-wall lowpass filter which is set to our Nyquist frequency. The filters job is to only allow content lower than the Nyquist frequency in, therefore providing us with a signal that has been appropriately band-limited (i.e. at 22,050 Hz or 24,000 Hz). So, in the digital audio world, aliasing happens if you do not properly band-limit the input signal. Alias signals ‘foldover’ at the Nyquist frequency and are reflected back down along the frequency spectrum (see figure 1). They are most noticeable as distortion in our audio signal and not a lot can be done to remove them.
Figure 1: Frequency domain representation of aliasing
Here the dotted red line shows foldover, the mirror-like reflection of aliased signal components, at a Nyquist frequency of 24kHz
Within our digital synthesizer, we simply replace the input signal that exists when we are recording an acoustic signal with the output of our oscillator algorithm. The output of the oscillator algorithm IS our input signal – but it has not been sent through the brick-wall lowpass filter in our A/D converter. So technically, when using algorithmic techniques to create a digital oscillator within a computer, it is possible to create a signal that extends well beyond the Nyquist frequency and contains aliased components. We perceive this aliasing as subtle distortion.
Time & Frequency
As we can see in figure 1, aliased components foldover around the Nyquist frequency and are visible in the frequency domain on a spectrogram. It is easy to see and hear this via a simple Max patch as shown in figure 2. On the left hand side is the Max Saw~ object (a band-limited oscillator), whilst on the right hand side we have the Max Phasor~ object which provides an ‘ ideal mathematical ramp without filtering out frequency information above Nyquist’ (i.e. a non band-limited saw oscillator). On the left side we can see a clean signal in the spectrogram, whilst on the right side we can see aliased components folding over around the Nyquist frequency and being reflected back down the frequency spectrum.
Figure 2: Using Max to show a frequency domain representation of aliasing
On the left we can see that the band-limited Saw~ object produces a nice clean signal on the spectrogram whilst on the right we can see that the non band-limited Phasor~ produces alias components that foldover around the Nyquist frequency and are reflected back down the frequency spectrum
The easiest wave to see aliasing in the frequency domain is via 3D spectrogram plots. These give us a very clear indication of the amount of aliasing and how it is represented as distortion spread across the frequency spectrum, down from the Nyquist frequency. In fact, using these type of plots the amount of foldover and distortion in the signal is really surprising. To show this off, the authour developed a band-limited and non band-limited oscillator algorithm in C++ and generated plots. Figure 3 shows a 3D spectrogram plot of a non band-limited square wave and figure 4 shows a 3D spectrogram plot of a band-limited square wave. As aliasing is often much more noticeable at higher frequencies, these plots are of the oscillator running at C6 (MIDI note number 96), which has a fundamental frequency of approx~ 2093Hz.
Figure 3: 3D spectrogram representation of aliased oscillator Non band-limited square wave plot at approx~ 2kHz. Notice the high levels of aliasing appearing as ripples down the frequency spectrum
Figure 4: 3D spectrogram representation of non aliased oscillator Band-limited square wave plot at approx~ 2kHz. Notice the reduced levels of aliasing
‘OK, that all makes sense, but what about the time domain?’ I hear you ask. As it happens, in the time domain, aliased components are visualized a bit differently. In the time domain aliased components are seen as discontinuities in the edges of the synthesized waveforms. That is, at the fast changing edges of waveforms. For example, during the cycle of a waveform there are moments when the waveform changes amplitude over time. These moments give the characteristic shape to our waveform (i.e. square). In the digital world, if we were to plot out a series of instantaneous values for frequency and amplitude for many samples over time we would see our waveshape. The higher the frequency or pitch of the oscillator the more rapid the edges of waveforms change, and hence the more discontinuities in the edges of the synthesized waveforms. Figure 5 shows a time domain oscilloscope plot of a non band-limited square wave. Notice the amount of discontinuity at the edges of the waveshape. This is the time domain representation of aliasing – visible at the fast changing edges of waveforms. A non band-limited oscillator is often known as a ‘naive’ oscillator. Figure 6 shows a time domain oscilloscope plot of a band-limited square wave. Notice the reduced amount of discontinuity at the edges of the waveshape.
Figure 5: Time domain oscilloscope plot of a naive, non band-limited square wave Notice the amount of discontinuity at the edges of the waveshape
Figure 6: Time domain oscilloscope plot of a band-limited square wave Notice the reduced amount of discontinuity at the edges of the waveshape
There are a number of ways around this problem. The most obvious may be to use different techniques to generate our oscillator in the first place that bypass the problem. This is a common solution and several options exist. A frequency limited Fourier series representation can be used to generate an aliasing free signal, or additive synthesis techniques could be used. However, these may both be computationally expensive. Another technique is that a wave is precalculated using a mathematical equation, and stored in memory (i.e. a table). We then use a look-up table technique to read the values from the table to generate our oscillator. This is a technique known as a wavetable (or look-up table) oscillator. However, clever tricks are needed here to ensure the wavetable oscillator is band-limited and free from other types of distortion (i.e. quantization & interpolation distortion). So what’s the solution? Well, one of the most popular techniques is really a compromise – we allow a little bit of aliasing as long as the aliased components are far away from the fundamental frequency and low in amplitude. For example, if we trigger our band-limited oscillator with a fundamental frequency of approx~ 2kHz (which is C6 on a MIDI keyboard), we may expect to see aliased components stretching down to somewhere in the region of -60dB at approx~ 10kHz. Remember, the dynamic range of the human ear is considered to be 130dB and arguably aliased components at -60dB would be difficult, if not impossible, to hear. Don’t believe me? Take this test to find out.
As these modern techniques don’t really remove aliasing, they suppress it enough so we cant hear it, they are known as quasi band-limited techniques. So this links nicely back to our opening paragraph – the most important and deployed approach in digital synthesizer design within the modern landscape is the use of quasi band-limited oscillators to reduce aliasing. ‘Ok – got it, but how does it work?’ I hear you say. In our next blog post, entitled ‘All About Digital Oscillators Part 2 – BLITS & BLEPS’ we will explore how these techniques work. So for now, happy wiggling.