Page 1 of 1

Resampling and aliasing

Posted: Wed Mar 01, 2006 1:19 am
by Birdsong
Hi all,

Not sure what I'm doing wrong, but when I'm resampling audio files from 48kHz to 44.1kHz I get aliasing. I assumed that the soundcard shouldn't be involved in this process (I know mine is crap and will alias anything above about 22kHz). In any case, I tried to apply a lowpass filter (20kHz) beforehand and then resampled, but it still aliases the notes and to the same degree as without the filter...
How can aliasing happen if it's a digital-digital thing and does anyone know how to resample without aliasing?



Posted: Wed Mar 01, 2006 3:04 pm
by DougDbug
Hmmmm.... I've forgotten about aliasing... And, I haven't noticed any problems with the DVD-audio I've converted to CD. Maybe your ears are more critical than mine.

I am sure of one thing - You are right. Your soundcard has nothing to do with this. It's all mathematical operations on digital data. As long as your computer doesn't make math errors, :lol: the particular computer has nothing to do with the results.

I'll bet Chris has more insight on this...

I know that you can prevent alaising by filtering the analog signal, but I'm not sure if this works with digital filtering of a digital signal... There are some weird things going on with the high frequencies when you're in the ballpark of 2 or 3 samples per cycle! I suspect that digital filtering gets weird at these "low" sample rates. :?

Did you use the Resample command, or Save-As? Maybe the resample function uses some "tricks" to aviod the problem. The help file says resample uses interpolation. Interpolation might prevent aliasing if it's used on down-sampling as well as up-sampling.

Posted: Wed Mar 01, 2006 4:40 pm
by Birdsong
I can't hear the difference either, but you can see it easily on the spectrogram. After resampling - and yes, I used the resample option rather than saving it as.. - it introduced extra frequencies inbetween my harmonics as well as below my fundamental frequency.
I'm trying to measure individual notes of this birdsong, so unfortunately aliasing will give me different results... :( Hmmm.

Yeah, I knew about the analog filter as well, so maybe interpolation should've prevented aliasing when resampling digital but it didn't..??

It's just weird. I recorded the calls at 48kHz, 16 bit on DAT tapes, then used a digital in on a computer with a fancy soundcard, so that was all good, and there was no aliasing until I took all the data to my wee laptop and resampled it in Goldwave...

So maybe my computer isn't very good at maths - would that be influenced by how much processing power I have??

Thanks for you reply :)

Posted: Wed Mar 01, 2006 4:58 pm
by GoldWave Inc.
The resampling algorithm in GoldWave is designed more for speed than for completely avoiding aliasing. In most cases you won't hear any difference, but for things like birdsong with very distict frequencies, artifacts will be visible on the visuals. If you know the bandwidth of the birdsong, you can apply a bandpass filter after resampling to remove some of the artifacts.


Posted: Wed Mar 01, 2006 9:18 pm
by Birdsong
Thanks for that, Chris. I imagine the bandpass filter might be too messy for my songs - sometimes the aliased signals are in the same range as another, not aliased note...

Hmmmm, so that means I can't really use my favourite Goldwave for what I'm doing...

Does anyone else know software that can downsample without aliasing??
Ideally I want to keep it on a PC, otherwise the Mac might have compatibility problems with my very long sound file names...

Thanks a lot for your help guys!

Posted: Wed Mar 01, 2006 9:55 pm
by DougDbug
So maybe my computer isn't very good at maths - would that be influenced by how much processing power I have??
NO. Your computer is just as good at math as anybody else's Windows computer.

Sorry for the confusion.
I was trying to make the point with a little humor... That's why I stuck-in the little happy-face - :lol:

Basically, any Windows computer is going to give you the exact same results. Just as you would get the same results if you moved a spreadsheet from one computer to another.

Any differences between processors (Say AMD vs Intel, or PII vs PIV) are usually taken care-of by the compiler. (In case you don't know, a compiler is a tool used by programmers to turn high-level programming languages into machine code.) A programmer could take some extra steps to... say get more accuracy from a 64-bit CPU. But, that would be unusual.

With digital audio files, speed is only a convenience issue. A more powerful computer will simply perform the calculations faster.

Speed can make a quality difference if you are doing real-time multi-track recording, or if you are processing (adding reverb, EQ, etc.) in real-time.

Posted: Thu Mar 02, 2006 5:07 pm
by Blandine Catastrophe
When I need to resample with the best quality, I change the playback rate of the file in Goldwave, and Save.
I open in Audacity and use the command "save as" after have verified that the project is at the good speed (44100 is needed in DePopper until next version and aliasing can be an annoyance in their actual alorhythm). Audacity does it if Real Player is installed on my computer.

Posted: Tue Mar 14, 2006 6:43 pm
by Blandine Catastrophe
Something new I found today to drastically reduce aliasing, who works even better than the Real Player plugin used in Audacity...

I have recorded a 45 rpm at 33 rpm sampled at 44100 Hz, then changed the playback rate to 59535 kHz. I resampled at 178605 Hz (3×59535) and resampled it again at 44100 Hz to get the right speed on the right sample rate (I use depopper to denoise vynilics, it still needs 44100 Hz). The aliasing is alomst eliminated by this method.

It consists exactly in an intermediate conversion at the maximum possible rate which is a multiple of the start or arrival rate. Here the maximum multiple of the start rate was 3×59535=178605, and the maximum multiple of the final rate was 44100×4=176400. 178605 is higher, it is then the best intermediate.

Edit: The first multiplier must be even. 22050Hz×8=176400Hz : this lead me to aliasing also. But 59535Hz×3=178605Hz seems to work properly.

Resampling and aliasing

Posted: Fri Oct 27, 2006 6:38 am
by cdeamaze
If you resampling from 48K to 44.1K, then anything above 22.05K will be aliased (to a lower frequency below 22.05K see below on how to calculate). This is the famous theorem due to Nyquist called Nyquist criterion.

I don't know which frequency your birds sing. Let's say it is @23K. Then your minimum sampling frequency should be 46K. If you sample it at 44.1K , you will have an aliasing problem. The aliased freq is fs-f=44.1-23=21.1 k. Does it sound correct to you? I certainly can not hear that frequency! :D The only solution is to resample at higher frequency(or upsample). Remember your sampling freq must be higher than Nyquist frquency=46K! Soundcard, processor, lowpass filter will have no effect.

Resampling and aliasing

Posted: Sat Oct 28, 2006 6:15 pm
by cdeamaze
The manual mention antialiasing filter may help. It says

Anti-aliasing filters remove all tones that cannot be sampled correctly. They prevent high pitched tones from being aliased to low pitch. Many sound cards include anti-aliasing filters in hardware.

First, you need to buy expensive sound card if you don't have one which includes that feature . Second, they remove tones that are not sampled correctly. It's true you don't have aliasing now. But what about those pitches that are are lost? You still have distortion in your music! Thus to me anti-aliasing filters are trying to avoid the problem but not actually solve the problem. Resampling at higher rate attacks the problem directly and solves the problem if you resample at high enough rate.