Stuck with a SynthEdit project?

Tag: Aliasing

Oversampling in SynthEdit

Oversampling Control Module:

This module provides control of the Oversampling rate for your Synthesizer or effects VST.
Note: This module only works when inside a container.
The oversampling rate is set by connecting a list entry control to the module.
This controls the sample rate at which the Container processes audio.
This figure is expressed as a factor relative to 44.1kHz (which is a typical sampling/processing rate). For example if you select 2x oversampling, the Container will process at a minimum of 88.2kHz.

The plugs on the oversampling module

Plugs.
<-> Oversampling: (Integer) Controls the sample rate at which the Container processes audio. This figure is expressed as a factor relative to 44.1 kHz (which is a typical standard rate). For example if you select 2x oversampling, the Container will process at (at least) 88.2  kHz.
The options are: x2, x4, x8, x16, and x32
Note: If your soundcard is already running at 88.2 kHz or higher, 2x oversampling won’t have any effect because SynthEdit takes this to mean that you are already processing at twice the ‘standard‘ rate. If the Soundcard is set to run at 88.2 kHz SynthEdit will only apply additional oversampling if you select 4x, 8x or a higher oversampling rate…
<-> List Items: (Text) Supplies the list of rates to choose from.
<-> Oversampling Filter: (Integer) Receives your choice of filtering.
<-> List Items 2: (Text) Supplies the list of filters to choose from: 3, 5, 7, 9, FIR Low, FIR Med, FIR High, FIR Ultra.

Oversampling Filter options:
3, 5, 7, 9, FIR Low, FIR Med, FIR High, FIR Ultra.

About the Oversampling Filter:- This option Controls the type of filter used to down-sample the audio as it exits the oversampling container.
A value of 5, 7 or 9 will select an IIR filter with the corresponding number of poles (more is better). These types of filters have low latency, and low CPU but introduce phase-shift into the signal.
A value of FIR-low, FIR-Medium, FIR-High, or FIR-Ultra will select a FIR filter. These filters are very clean and high-quality but do introduce some latency. FIR-Ultra is the best quality.
 Oversampling Filters: ( [3,5,7,9] Elliptic IIR Filter, [13-low, 14-med, 15-hi, 16-ultra] FIR Adaptive Quality, [20+] FIR actual taps)
Important Notes about Oversampling:
Note: Oversampling filter increases the CPU load by the same factor as the oversampling multiplier, this means x8 oversampling means the workload for the CPU is increased eightfold.
Note: Changing the oversampling rate causes a short interruption to audio processing while the oversampling filters are inserted into the signal flow.
Note: DO NOT connect a Patch Memory module to the Oversampling Module it will cause some very unpredictable and undesirable results..

About FIR Filters.

In signal processing, a finite impulse response (FIR) filter is a ‘filter whose impulse response (or response to any finite length input) is of finite duration, because it settles to zero in finite time’.
This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely to an impulse (usually decaying).
The impulse response (that is, the output in response to a Kronecker delta input) of an Nth-order discrete-time FIR filter lasts exactly N + 1 samples (from first non-zero element through last non-zero element) before it then settles to zero. FIR filters can be discrete-time or continuous-time, and digital or analogue.

Example: 
A whole plugin is running at 44.100Hz, but you want to decrease aliasing created by distortion. So you containerize just the distortion module and add an Oversampling Control to that same container. Now, only the distortion part will be processed at double standard rate (88.200Hz, which will create less aliasing) and then filtered back to the original SR for further signal processing.
Note: There should be only one Oversampling Control per container, and it works “remotely” without any audio patch cables connected to it. It has two properties that you can access by selecting the Oversampling Control’s parent container and checking the Properties Panel

About Oversampling:

In signal processing, oversampling is the process of sampling a signal at a sampling frequency significantly higher than the Nyquist rate. In theory, a bandwidth-limited signal can be perfectly reconstructed if sampled at the Nyquist rate or above it.
The Nyquist rate is defined as ‘twice the bandwidth of the signal’.
Oversampling is capable of improving audio resolution and signal-to-noise ratios, and can assist in avoiding aliasing and phase distortion by reducing anti-aliasing filter performance requirements.
A signal is said to be oversampled by a factor of N if it is sampled at N times the Nyquist rate.
For example, we have a system with a Nyquist limit of 44kHz, but it’s actually sampled at 88kHz, then it would be oversampled by a factor of 2 so if the sample rate is taken up to 132kHz then we are oversampling by a factor of 3.

Why oversample?
There are four good reasons for performing oversampling:
1) To improve anti-aliasing performance (the higher the sample rate, the lower the level of the aliasing by products)
2) To increase audio resolution
3) To reduce background noise levels
4) It’s much easier to reduce aliasing distortion during sampling than after the sampling process (reducing aliasing after sampling is almost impossible to do without affecting sound quality adversely).
Oversampling and Anti Aliasing.
Oversampling makes it much easier to design and create analogue
anti-aliasing filters. Without oversampling, it is very difficult to create filters with a sharp enough cut-off necessary to maximize the available bandwidth without the audio exceeding the limitations of the Nyquist frequency limit.
By increasing the bandwidth of the sampling system, design considerations for anti-aliasing filters may be made simpler. Once the signal has been sampled, the signal can be digitally filtered and then down-sampled to the required sampling frequency.
In modern digital circuit or DSP technology, any filtering systems associated with the down-sampled audio are easier to put in place than an analogue filter system that would be required by a non-oversampled audio design.

SynthEdit Oversampling in action.
Its as simple as this, just connect these modules up like so inside the container, and welcome to the world of Oversampling. No further connections are needed.

Connecting up the oversamplin module

SynthEdit:- Aliasing and distortion.

Audio Aliasing is an effect which occurs when converting an analogue signal into a digital one with an insufficient sampling frequency.
The result of this effect is that the high-frequency components of that analogue signal will not be correctly interpreted, and the digital signal will not be an accurate copy of the analogue one.
Changing too fast.
Any very sharp transition in an audio signal will also cause aliasing. The rapid change in voltage will be too fast for the sample rate, and so will exceed the nyquist limit. Good examples of this are Pulse, Sawtooth or Ramp waveforms, this is why digital oscillators don’t have the very sharp rise and fall times that are possible with analogue oscillators, and so will often not sound as “bright” as their analoguie counterparts. (except for systems with very high sample rates).


Analogue to Digital conversion.
When analogue signals are digitised and turned into digital signals, the analogue signal is sampled at regularly occurring points in time, or in other words, the instantaneous amplitude of the analogue signal is recorded to create a digital copy of the analogue signal.
This happens very quickly in audio signals, for example, CD audio is sampled at 44.1 kHz (44,100 samples per second).
Aliasing occurs when a signal is sampled at an insufficient rate. Two audio signals can become indistinguishable from each other once they have been sampled and converted– they have become aliases of each other.

The Nyquist sampling theorem states that:
“To avoid aliasing, the sampling frequency must be at least twice that of the highest frequency which is to be represented“. If we use the example of CD audio, a sampling frequency of 44.1 kHz means that the highest frequency which can be represented without aliasing is 22.05 kHz. For CD audio this is sufficient as the upper limit of human hearing is around 15 to 20 kHz depending on the individual.

Aliasing can occur either because the anti-alias filter in the A-D converter (or in a sample-rate converter) doesn’t have a steep enough roll-off, or alternatively because the system has been overloaded. Distortion caused by overloading the input or conversion circuitry is the most common source of aliasing, because overloads result in the generation of multiple high-frequency harmonics within the digital system itself after the anti-aliasing filtering.
Sampling images.
The sampling process is similar to a form of amplitude modulation in which the input signal frequencies are added to, and subtracted from the sample-rate frequency. In radio terms, the sum products are called the upper sideband and the subtracted products are called the lower sideband. In digital circles they are just referred to as the ‘images‘.
Unwanted Effects.
These images play no part in the digital audio process — they are essentially just a side-effect of sampling. However they must be kept well above the wanted audio frequencies so that they can be removed easily without affecting the quality of the required audio signals. This is where all the can trouble begin. The upper image isn’t really a problem – that’s easily filtered out, but if the lower one is too low in frequency, it will mix with the audio we do want and because the frequencies are similar, this will create ‘aliases‘ that cannot be removed.
Unwanted guests you can’t get rid of.
This is what the aliases turn into… that guest at the party who causes bad feelings and will not leave. Once aliasing effects are there there is no way you can filter them out without causing even more audio degradation.

Spectrum of aliasing signal images

Note that, unlike an analogue system, in which the distortion products caused by overloads always follow a normal harmonic series, and can even give quite a pleasant sound, (consider tape saturation on an old reel to reel recorder, or soft clipping in a valve amplifier) overloading, or incorrect clock frequencies in a digital system aliasing result in the harmonic series being “folded back or mirrored” on itself to produce audible signals that are no longer harmonically related to the source (they are referred to as “Inharmonics”).
In this very basic example, we have ended up with aliases at 2kHz and 18kHz that have no obvious musical relationship to the 10kHz source. This is why overloading a digital system sounds so nasty in comparison to overloading an analogue system.