Aliasing: What It Is & How To Conquer It

hardware, software, tips and tricks
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
User avatar
alphacat
Posts: 6016
Joined: Mon Feb 13, 2006 7:52 pm

Aliasing: What It Is & How To Conquer It

Post by alphacat » Tue May 10, 2011 8:56 pm

Many of us work with gear that's not the greatest - which is fine, 'cuz you make do with what's around - but are unaware of one of the most common problems that such setups can produce (and a reason why "professionals" choose platforms like PT that do their best to eliminate it entirely)...

I'm talking about ALIASING.

...

What is Aliasing?

A nice, concise definition from 1996:
earlevel.com wrote:
What is aliasing?

It’s easiest to describe aliasing in terms of a visual sampling system we all know and love—movies. If you’ve ever watched a western and seen the wheel of a rolling wagon appear to be going backwards, you’ve witnessed aliasing. The movie’s frame rate isn’t adequate to describe the rotational frequency of the wheel, and our eyes are deceived by the misinformation!

The Nyquist Theorem tells us that we can successfully sample and play back frequency components up to one-half the sampling frequency. Aliasing is the term used to describe what happens when we try to record and play back frequencies higher than one-half the sampling rate.

Consider a digital audio system with a sample rate of 48 KHz, recording a steadily rising sine wave tone. At lower frequency, the tone is sampled with many points per cycle. As the tone rises in frequency, the cycles get shorter and fewer and fewer points are available to describe it. At a frequency of 24 KHz, only two sample points are available per cycle, and we are at the limit of what Nyquist says we can do. Still, those two points are adequate, in a theoretical world, to recreate the tone after conversion back to analog and low-pass filtering.

But, if the tone continues to rise, the number of samples per cycle is not adequate to describe the waveform, and the inadequate description is equivalent to one describing a lower frequency tone—this is aliasing.

In fact, the tone seems to reflect around the 24 KHz point. A 25 KHz tone becomes indistinguishable from a 23 KHz tone. A 30 KHz tone becomes an 18 KHz tone.

In music, with its many frequencies and harmonics, aliased components mix with the real frequencies to yield a particularly obnoxious form of distortion. And there’s no way to undo the damage. That’s why we take steps to avoid aliasing from the beginning.
Make sense?

Here's another, more in-depth explanation:
The Audio Fool blog wrote:
Sampling a continuous waveform into discrete digital samples results in lost information. Discrete samples can only tell what the wave is doing at periodic instants in time, and not what's happening between them. The continuous sampled wave could be doing anything between samples. We simply don't know.

The problem here is that when we want to get back the data that we threw away and turn samples back into a continuous wave, we must interpolate between samples to find the lost information. Unfortunately, there are an infinite number of signals that could have produced the samples that we want. Fortunately, if we accept a small restriction on our continuous waveform, we can get back to one unique signal.

I think an example is in order. Consider the 7kHz sine wave below, shown over a 1ms interval.

Image
If we sample this sine wave with a sampling rate of 10kHz, we get 11 samples in this interval (counting the endpoints), as shown below.

Image
But when we play back these samples, you won't get 7kHz out of the speaker. What you hear is the 3kHz wave described by the red curve below.

Image
So what happened? Notice that both curves produce exactly the same samples, when sampled at 10kHz. At this sample rate, there is no way to tell the difference between 3kHz, 7kHz, or even the 13kHz wave below.

Image

This effect is known as aliasing, and these frequencies are aliases of each other. In fact, for any frequency f and sample rate S, all frequencies of the form (N*S ± f) for some integer N are aliases.

There is hope, though. For given f and S, there is one unique frequency of the type (N*S ± f) that is between 0 and S/2. Looking at the samples in the example above, the 3kHz wave is between zero and half the sampling rate. No other frequency between 0 and 5kHz can be produced from those samples, and the wave is unique. The frequency S/2, called the Nyquist frequency, is the upper limit of alias-free signal frequency.

All of the information lost from sampling a continuous waveform has a frequency higher than S/2. Therefore, the process of sampling is lossless, as long as all of the frequencies you're interested in are below half the sample rate.

But wait, you may ask. What if you're interested in preserving higher frequencies? Just increase the sample rate to more than twice the highest frequency you're interested in. The human ear can hear frequencies of up to about 20kHz, and it's no coincidence that CD Audio samples at 44.1kHz, providing bit-perfect representation of any frequency humans can hear.

There is one more problem when sampling. Sampling just your frequencies of interest isn't always enough. High frequencies don't just go away when you sample. This out-of-band noise (Noise because it's not part of the signal we want to preserve) in your continuous signal will still be sampled, only now it will alias down below S/2 and contaminate the digital signal you want to keep.

For this reason, any time you sample a continuous signal, you must first band-limit the signal with a low-pass filter to block (attenuate) all frequencies above the Nyquist frequency, so that there is no out-of-band noise at the sampling stage. More on what that means in another post.

User avatar
FSTZ
Posts: 7706
Joined: Wed Oct 11, 2006 3:07 am
Location: Cookingham

Re: Aliasing: What It Is & How To Conquer It

Post by FSTZ » Tue May 10, 2011 9:12 pm

quality post

:4:

User avatar
alphacat
Posts: 6016
Joined: Mon Feb 13, 2006 7:52 pm

Re: Aliasing: What It Is & How To Conquer It

Post by alphacat » Tue May 10, 2011 9:15 pm

Thanks bruv. I'll be posting a followup shortly concerning how to deal with it: stay tuned!

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Tue May 10, 2011 9:27 pm

Yeah, I'd love a list of plugs that effectively manage aliasing. I usually hit up gear slutz for this kind of thing when I'm researching a plugin.

Tricky tricky thing is aliasing is not a complete bugaboo. Some plugs that don't technically handle their aliasing well, apparently sound pretty good still. One piece of hardware that I have that aliases like a mofo is the microkorg, and I kind of like the sound, hehe.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

hifi
Posts: 3328
Joined: Sun Apr 04, 2010 6:54 am

Re: Aliasing: What It Is & How To Conquer It

Post by hifi » Tue May 10, 2011 9:28 pm

thought this was about some team of producers or how to change our names.

this is very informative though thanks

DJ Crackle
Posts: 650
Joined: Sat Jul 24, 2010 12:54 am
Contact:

Re: Aliasing: What It Is & How To Conquer It

Post by DJ Crackle » Tue May 10, 2011 9:42 pm

Hypefiend wrote:thought this was about some team of producers or how to change our names.
lol

paradigm_x
Posts: 2164
Joined: Tue Apr 04, 2006 7:43 am

Re: Aliasing: What It Is & How To Conquer It

Post by paradigm_x » Tue May 10, 2011 10:29 pm

one reason to work at 88/96khz...

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Tue May 10, 2011 10:43 pm

Bro, I'd really like to work at 96, but I'm maxing out my quad 4 all the time at 44.1khz. I'm waiting for these new 3d transistors to hit the market before I build a new pc. It looks like these things are going to be the sickness. I'll be up at 96khz then, fo sho.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

User avatar
paravrais
Posts: 2869
Joined: Tue Jan 06, 2009 11:31 pm
Location: Cambridge, UK
Contact:

Re: Aliasing: What It Is & How To Conquer It

Post by paravrais » Tue May 10, 2011 10:45 pm

paradigm x wrote:one reason to work at 88/96khz...
Surely not, because you will still have to render it down to audio CD standard if your going to sell/give away the tune??

User avatar
Ldizzy
Posts: 1651
Joined: Wed Feb 03, 2010 9:47 am

Re: Aliasing: What It Is & How To Conquer It

Post by Ldizzy » Wed May 11, 2011 3:54 am

paradigm x wrote:one reason to work at 88/96khz...
but ull have to downsample...

i was really anxious about the question and im slowly starting to make an opinion...

its still a debate amongst engineers according to ahem bob katz.
Sharmaji wrote:2011: the year of the calloused-from-overuse facepalm

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Wed May 11, 2011 4:47 am

P and LD, many plugins sound better at the higher sample rates.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

User avatar
Ldizzy
Posts: 1651
Joined: Wed Feb 03, 2010 9:47 am

Re: Aliasing: What It Is & How To Conquer It

Post by Ldizzy » Wed May 11, 2011 5:12 am

lately ive been reading that even if 44.1 is more then twice the human upper boundary (around 20 khz as yall know already) ... higher inaudible frequencies might influence the audible ones, by their presence/absence...

still need to find other convincing info on this
Sharmaji wrote:2011: the year of the calloused-from-overuse facepalm

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Wed May 11, 2011 5:28 am

-q- Truthfully, I didn't read all that up there, as I think I have a grip on what is going on here. But I assume the quotes explained it pretty well. It's not about what the human ear can hear, per se, it is about where the math is happening, which ultimately ends up influencing frequency ranges that the ear can hear.

I've never worked on anything over 48k so I can't really say, but I've heard from a lot of people with better ears than mine that swear vst(i)'s sound better at higher sample rates. I'm taking their word for it, for the time being. My audio desires far exceed my processing capabilities right now, so I'll have to wait to hear for myself.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

paradigm_x
Posts: 2164
Joined: Tue Apr 04, 2006 7:43 am

Re: Aliasing: What It Is & How To Conquer It

Post by paradigm_x » Wed May 11, 2011 8:37 am

Well, an oscillator can in theory create frequencies much higher then the nyquist, and hence create aliasing. A square wave for example is a bunch of inter-related harmonics, in theory going up to infinity Hz (Over 9000!)

So you have to create a LP filter as discussed above.

But assuming the upper limit of human hearing is around 20kHz, at 44khz, you only have 2khz to 'fit' the LP filter in, and hence the filter needs to be very steep, and has a lot of undesirable side effects.

At 88Khz, the nyquist limit is at 44khz, and hence most aliasing will be completely inaudible :)

You can then implement a very gentle low pass filter, which has far less audible artefacts, which again are above the upper hearing limit. This should then in theory remove all aliasing.

You then use sample rate conversion, which uses a much better anti-aliaisng filter algorythm, which are generally non-realtime, in that it uses all of its 'CPU power' to reduce the frequency, as opposed to the realtime filters used in VSTs, to convert back down to 44kHz for CD/MP3 etc.

Hope this is helpful.

:)


You can also get oversampling plugins, which take a VST and oversample it. A lot of plugs already use internal oversampling, eg the UAD stuff.

http://sites.google.com/site/chrisrwalton/oversampler
http://www.kvraudio.com/forum/viewtopic.php?t=228881

HTH

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Wed May 11, 2011 9:38 am

Whoa, this is news to me. Tip of the hat to you!

I'm hoping that some audio geek has put a list together of all the plugins that internally oversample, and that alpha will find and post that list, and that someone will come over here and do my dishes and maybe take out my trash.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

paradigm_x
Posts: 2164
Joined: Tue Apr 04, 2006 7:43 am

Re: Aliasing: What It Is & How To Conquer It

Post by paradigm_x » Wed May 11, 2011 9:42 am

Ive used that one with albino3 before. For such a great synth it does have sucky aliasing.

TBH most synths these days are aware of the issues and have fixed them... but useful for free/cheap/old ones. :)

paradigm_x
Posts: 2164
Joined: Tue Apr 04, 2006 7:43 am

Re: Aliasing: What It Is & How To Conquer It

Post by paradigm_x » Wed May 11, 2011 10:13 am

nowaysj wrote:Bro, I'd really like to work at 96, but I'm maxing out my quad 4 all the time at 44.1khz. I'm waiting for these new 3d transistors to hit the market before I build a new pc. It looks like these things are going to be the sickness. I'll be up at 96khz then, fo sho.
Missed this;

You can always work at 44 and bounce out at 96 or 88.

I went thru a phase of doing this, and tbph, could hardly tell the difference. More faff than its worth. But an option and worth trying for your interest.

The best SRCs ive come across BTW are SOX, which is a huge PITA to use (command line, although there is a plugin for foobar) and the free voxengo R8Brain.

This site has some very interesting (if your a geek) graphs showing the side effects/aliasing of SRC processing from various daws etc. Some real heavyweights, eg wavelab 5, are shocking compared to R8Brain.

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Wed May 11, 2011 7:14 pm

paradigm x wrote:This site has some very interesting (if your a geek) graphs showing the side effects/aliasing of SRC processing from various daws etc. Some real heavyweights, eg wavelab 5, are shocking compared to R8Brain.
Dude how about cubase, and live? Durty. Reaper really cleaned up their act.

Logic clearly is using some strange maths, not too clean either.

====

I'm not so interested in upsampling, as I am in just working at a native higher rez, then down sampling when nec.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

User avatar
mks
Posts: 4155
Joined: Tue Apr 04, 2006 3:35 am
Location: Planet Earth

Re: Aliasing: What It Is & How To Conquer It

Post by mks » Wed May 11, 2011 8:04 pm

This is all some fascinating stuff. I have always worked at 24 Bit for awhile, but sample rates always confounded me and consequently I have just worked at 44.1 khz. I tried working 96 khz for a project but I remember the file was so large that I went back to 44.1.

Now that I have built a new production machine with lots of storage I might try working at higher sample rates.

So much music has harmonics in the upper partials, I'm sure it would make a difference. I'm just not sure how much of that you are hearing or if it is making a subtle difference.

User avatar
nowaysj
Posts: 23281
Joined: Fri Sep 18, 2009 4:11 am
Location: Mountain Fortress

Re: Aliasing: What It Is & How To Conquer It

Post by nowaysj » Wed May 11, 2011 8:33 pm

Looking at these graphs, can someone shed some light on quantization noise? I notice that flstudio 8 is relatively clean (and I mean relatively!) in terms of aliasing, but shows some signs of quantization noise. I'm pulling up heady papers, best so far is by Ethan Winer, but I really don't totally trust him.
Join Me
DiegoSapiens wrote:oh fucking hell now i see how on point was nowaysj
Soundcloud

Locked

Who is online

Users browsing this forum: No registered users and 0 guests