Oversampling explained
Forum rules
By using this "Production" sub-forum, you acknowledge that you have read, understood and agreed with our terms of use for this site. Click HERE to read them. If you do not agree to our terms of use, you must exit this site immediately. We do not accept any responsibility for the content, submissions, information or links contained herein. Users posting content here, do so completely at their own risk.
Quick Link to Feedback Forum
By using this "Production" sub-forum, you acknowledge that you have read, understood and agreed with our terms of use for this site. Click HERE to read them. If you do not agree to our terms of use, you must exit this site immediately. We do not accept any responsibility for the content, submissions, information or links contained herein. Users posting content here, do so completely at their own risk.
Quick Link to Feedback Forum
-
didi
- Posts: 3788
- Joined: Thu Sep 01, 2011 7:52 pm
- Location: http://www.youtube.com/watch?v=m_dvT8dttyQ
- Contact:
Oversampling explained
This was quite useful for me, so I thought I'd share:
You need to get your head around the concept of aliasing.
Nyquist theory states that the highest frequency a digital sampling system can represent will always be half the samplerate, so this upper limit is known as the Nyquist frequency. The problem is, if you try to represent signals higher than nyquist they don't just disappear: they actually end up reflected back down below nyquist where they become a particular type of distortion known as aliasing.
Aliasing is the reason why your AD converters need filters: everything above nyquist must be removed before conversion, as there is no way to separate aliasing from the wanted signal after it has occurred.
Aliasing can also occur when processing digital signals however: any process that adds extra harmonics risks inadvertantly adding components above nyquist.
As an example, lets take a sine wave at 6KHz, and lets simplify the maths by setting a samplerate of exactly 40KHz, so nyquist is exactly 20KHz. I'm going to saturate the sine wave with a distortion effect to generate extra harmonics, which should appear at the following frequencies:
2nd 3rd 4th 5th 6th
12K 18K 24K 30K 36K
However, components above nyquist would be reflected back down as aliasing, so we would actually get the following (aliasing in red)
2nd 3rd 4th 5th 6th
12K 18K 16K 10K 4K
If we oversample by 2x nyquist will now be 40KHz, so we can go much further:
2nd 3rd 4th 5th 6th 7th 8th 9th 10th
12K 18K 24K 30K 36K 38K 32K 26K 20K
Notice that not only do we get another octave of headroom before aliasing occurs, we also get another octave above that where the resulting aliasing components are higher than the target nyquist, and will then be filtered out when downsampling back to 40KHz. ie: the orange aliasing components at 38K, 32K, and 26K will not be audible, so unlike the 1x version which aliases audibly at the 4th harmonic, the 2x version can go up to the 10th harmonic before aliasing becomes a problem.
The amount of oversampling you need therefore depends on two things: how much harmonic distortion is generated by the process, and the higest frequencies present in the signal you are processing.
Compressors will add subtle harmonics, especially with fast attack or release times, but if you are processing a bass guitar (for example) the harmonics generated will probably not go high enough to cause aliasing. But if you are compressing a drum overhead with lots of HF cymbal crashes you may find you need 2x or 4x oversampling to avoid a brittle harsh quality creeping in from the aliasing distortion.
If you are distorting the drum overheads however, perhaps with a saturation effect, or with a compressor or EQ that models analogue non-linearities, you may well need 8x oversampling or higher. (The latest version of The Glue provides an offline rendering mode with 256x oversampling! There is no way the compression would ever require this much oversampling, but the "Peak Clip" option uses clipping rather than limiting, ie: distortion.)
Obviously, the down side to oversampling is extra cpu load, and extra latency: not only do you have to process twice as many samples per second (or 4 times, or 8 times or whatever) you also need up and down sampling filters. If these filters are simplified too far they can significantly colour the sound, or smear the phase at the high end, but 'perfect' linear phase fiiltering is costly in terms of cpu, and will add a significant amount of latency. Some plugs therefore allow you to specify that they run at samplerate during realtime playback, but oversample when rendering (Auto mode in the Voxengo plugs). The Glue even allows you to specify different oversampling amounts for playback and rendering, eg: 2x for playback but 8 (or 256!) x for rendering.
I'm a little wary of that to be honest: when I render I like to get exactly what I was hearing when I mixed, and I don't like to assume that the host will always realise that the latency has changed. (Reaper seems to cope ok to be honest, but why introduce an extra variable?)
http://recording.org/daw-pro-audio/4808 ... ained.html
You need to get your head around the concept of aliasing.
Nyquist theory states that the highest frequency a digital sampling system can represent will always be half the samplerate, so this upper limit is known as the Nyquist frequency. The problem is, if you try to represent signals higher than nyquist they don't just disappear: they actually end up reflected back down below nyquist where they become a particular type of distortion known as aliasing.
Aliasing is the reason why your AD converters need filters: everything above nyquist must be removed before conversion, as there is no way to separate aliasing from the wanted signal after it has occurred.
Aliasing can also occur when processing digital signals however: any process that adds extra harmonics risks inadvertantly adding components above nyquist.
As an example, lets take a sine wave at 6KHz, and lets simplify the maths by setting a samplerate of exactly 40KHz, so nyquist is exactly 20KHz. I'm going to saturate the sine wave with a distortion effect to generate extra harmonics, which should appear at the following frequencies:
2nd 3rd 4th 5th 6th
12K 18K 24K 30K 36K
However, components above nyquist would be reflected back down as aliasing, so we would actually get the following (aliasing in red)
2nd 3rd 4th 5th 6th
12K 18K 16K 10K 4K
If we oversample by 2x nyquist will now be 40KHz, so we can go much further:
2nd 3rd 4th 5th 6th 7th 8th 9th 10th
12K 18K 24K 30K 36K 38K 32K 26K 20K
Notice that not only do we get another octave of headroom before aliasing occurs, we also get another octave above that where the resulting aliasing components are higher than the target nyquist, and will then be filtered out when downsampling back to 40KHz. ie: the orange aliasing components at 38K, 32K, and 26K will not be audible, so unlike the 1x version which aliases audibly at the 4th harmonic, the 2x version can go up to the 10th harmonic before aliasing becomes a problem.
The amount of oversampling you need therefore depends on two things: how much harmonic distortion is generated by the process, and the higest frequencies present in the signal you are processing.
Compressors will add subtle harmonics, especially with fast attack or release times, but if you are processing a bass guitar (for example) the harmonics generated will probably not go high enough to cause aliasing. But if you are compressing a drum overhead with lots of HF cymbal crashes you may find you need 2x or 4x oversampling to avoid a brittle harsh quality creeping in from the aliasing distortion.
If you are distorting the drum overheads however, perhaps with a saturation effect, or with a compressor or EQ that models analogue non-linearities, you may well need 8x oversampling or higher. (The latest version of The Glue provides an offline rendering mode with 256x oversampling! There is no way the compression would ever require this much oversampling, but the "Peak Clip" option uses clipping rather than limiting, ie: distortion.)
Obviously, the down side to oversampling is extra cpu load, and extra latency: not only do you have to process twice as many samples per second (or 4 times, or 8 times or whatever) you also need up and down sampling filters. If these filters are simplified too far they can significantly colour the sound, or smear the phase at the high end, but 'perfect' linear phase fiiltering is costly in terms of cpu, and will add a significant amount of latency. Some plugs therefore allow you to specify that they run at samplerate during realtime playback, but oversample when rendering (Auto mode in the Voxengo plugs). The Glue even allows you to specify different oversampling amounts for playback and rendering, eg: 2x for playback but 8 (or 256!) x for rendering.
I'm a little wary of that to be honest: when I render I like to get exactly what I was hearing when I mixed, and I don't like to assume that the host will always realise that the latency has changed. (Reaper seems to cope ok to be honest, but why introduce an extra variable?)
http://recording.org/daw-pro-audio/4808 ... ained.html
-
VirtualMark
- Posts: 1821
- Joined: Tue Aug 03, 2010 12:15 am
- Location: UK
Re: Oversampling explained
Wow, you're really overcomplicated things, and you're only source seems to be someone else's forum post. I don't know why you're saying you get 36khz reflected down to 4khz - i'm sure plugin manufacturers don't make their stuff work like this.
Oversampling lets you run a plugin internally at a higher sample rate than your project is set to, that's about all we need to know.
Oversampling lets you run a plugin internally at a higher sample rate than your project is set to, that's about all we need to know.
-
IELMusic94
- Posts: 22
- Joined: Sat Jun 09, 2012 1:45 am
- Location: Saint John, Canada
Re: Oversampling explained
I disagree, I think it was nice of the OP to share this, I personally, found it to be quite interesting. Nothing wrong with knowing all the theory behind a process we all use; knowledge is power!
Re: Oversampling explained
OP's right, actually. Plugin developers have little to nothing to do with this...except they can try their best to prevent or minimize the effect. It's a direct audio thing. Look up how that stuff works, it's really interesting.VirtualMark wrote:I don't know why you're saying you get 36khz reflected down to 4khz - i'm sure plugin manufacturers don't make their stuff work like this.
-
didi
- Posts: 3788
- Joined: Thu Sep 01, 2011 7:52 pm
- Location: http://www.youtube.com/watch?v=m_dvT8dttyQ
- Contact:
Re: Oversampling explained
I wasn't claiming that it was my work. I came across it, and it was useful to me, so I decided to share it. From what I understood, if the signal contains frequencies 16khz higher than the nyquist, there will be a type of distortion called aliasing, which reflects frequencies back resulting in distortion 16khz below the nyquist.VirtualMark wrote:Wow, you're really overcomplicated things, and you're only source seems to be someone else's forum post. I don't know why you're saying you get 36khz reflected down to 4khz - i'm sure plugin manufacturers don't make their stuff work like this.
Oversampling lets you run a plugin internally at a higher sample rate than your project is set to, that's about all we need to know.
- itzDetrimental
- Posts: 79
- Joined: Fri Apr 13, 2012 3:11 am
Re: Oversampling explained
Pretty interesting read man, preciate it. 
-
VirtualMark
- Posts: 1821
- Joined: Tue Aug 03, 2010 12:15 am
- Location: UK
Re: Oversampling explained
Perhaps i explained myself wrong. I'm fully aware how nyquist works, and the reflections you get when you exceed nyquist. My point is that its not usually a concern when you use a quality plugin. Manufacturers go out of their way to improve sound quality, you'll find that they band limit distortions so that they don't even produce frequencies past nyquist(they're greatly reduced), or they oversample internally at some point in the signal chain. Usually when a plugin has an 'hq' button, its using oversampling amongst other things.
The main thing that should influence your decision is whether or not using oversampling sounds better. As musicians we have enough to concern ourselves with by making good music, getting into maths or trying to work out what decision a plugin manufacturer has used is counter productive - "can i use that distortion or will it peak at 4khz because of nyquist reflections" - shouldn't be something you ever need to ask. Let the programmers worry about that, just use plugins that sound good.
The main thing that should influence your decision is whether or not using oversampling sounds better. As musicians we have enough to concern ourselves with by making good music, getting into maths or trying to work out what decision a plugin manufacturer has used is counter productive - "can i use that distortion or will it peak at 4khz because of nyquist reflections" - shouldn't be something you ever need to ask. Let the programmers worry about that, just use plugins that sound good.
Who is online
Users browsing this forum: No registered users and 0 guests


