Sample rate downsampling/upsampling explanation.

Effects, Recipes, Interfacing with other software, etc.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
flynwill
Posts: 840
Joined: Fri Jan 17, 2014 2:58 pm
Operating System: Linux Debian

Re: Sample rate downsampling/upsampling explanation.

Post by flynwill » Mon Oct 06, 2014 2:13 pm

What I said was that Audicity in it "best quality" mode seems to start filtering at 90% of the Nyquest rate. One can easily argue that this is 99% or even 100% "correct". If you consider the typical down-conversion is from some higher rate like 48 kHz or 96kHz to 44.1kHz. The Nyquist rate of the output is 22.05 kHz, 90% of that is 20kHz, the generally agreed upper limit of human hearing.

If you read the rest of his paper (which I admit might be a bit tough if you don't have an engineering background) he describes implementing the filtering using a FIR filter who's coefficients are a windowed sync function. I suspect (but don't know) that Audacity's "high quality" conversion does use such a filter as that is one of the more common methods. The question is how big to make the "window", a "perfect" conversion requires an infinitely large window.

This "window" is the number of input samples you have to examine to compute a new output sample. It grows rapidly as you try to make that 90% closer to 100%, and the conversion gets ever slower to compute. As with most things in engineering what is "perfect" and what is "practical" are not the same and "practical" wins the day.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate downsampling/upsampling explanation.

Post by steve » Mon Oct 06, 2014 3:29 pm

flynwill wrote:I suspect (but don't know) that Audacity's "high quality" conversion does use such a filter as that is one of the more common methods.
As I previously posted, if anyone really wants to know the technical details of how Audacity does resampling, they need to look to libsoxr, not to Audacity. It is libsoxr that handles resampling and has little to do with the Audacity code.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

DVDdoug
Forum Crew
Posts: 9419
Joined: Fri Sep 10, 2010 11:30 pm
Operating System: Windows 10

Re: Sample rate downsampling/upsampling explanation.

Post by DVDdoug » Sun Oct 12, 2014 8:04 pm

and it looks like there is a way to perfectly convert between sampling rates.
There is no mathematically perfect resampling algorithm. For example, if you re-sample from 48kHz to 96kHz and back again (or vice-versa), the sample values (bits & bytes) will be different.

But any competent DSP programmer can make an audibly perfect resampler. ...As long as we stay above 16-bit 44.1kHz... Of course if you downsample a CD to 8kHz, you are going to loose some high frequency information.

I've never heard any difference when upsampling or downsampling between 44.1kHz (CD) and 48kHz (DVD) no matter what software I happen to be using.

steve
Site Admin
Posts: 81627
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Sample rate downsampling/upsampling explanation.

Post by steve » Sun Oct 12, 2014 8:23 pm

DVDdoug wrote:I've never heard any difference when upsampling or downsampling between 44.1kHz (CD) and 48kHz (DVD) no matter what software I happen to be using.
Generally I'd agree, but if you are applying heavy processing after resampling, then the difference may become clearly audible.

As a (totally artificial) example: Generate a 5 kHz sine tone at 44100 Hz sample rate, then resample to 48000 Hz, then apply a notch filter with the centre frequency set to 5000 Hz (q = 1). The result should of course be silence, but if you use Audacity's lowest quality resampling, harmonics are clearly (though fairly quietly) audible.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Post Reply