HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: dalcinrafa on 2021-07-03 16:28:14

Title: Opus lowpass filter
Post by: dalcinrafa on 2021-07-03 16:28:14
Hey there! So, I have a little question. If opus has a lowpass filter above 20khz, why is its sampling rate 48khz? Wouldn't even 44,1khz be a bit overkill? Could somebody explain it to me? Thanks!
Title: Re: Opus lowpass filter
Post by: [JAZ] on 2021-07-03 20:43:18
The sampling rate is a hard limit on the maximum bandwidth that the signal can have, but there are other factors that are influenced by the sampling rate.

In the case of Opus, I believe that 48Khz was used in order to better work with the CELP part of the codec (the speech part).
Also, the higher sampling rate allows for better preecho handling.
Title: Re: Opus lowpass filter
Post by: AhoyMatey on 2021-07-06 18:10:15
Most audio hardware works at 48 kHz anyway, so the audio pipeline often converts to 48 kHz regardless. Preemptively resampling your whole lossy collection to 48 kHz with a reliable resampler might be even a good thing. As jmvalin (Opus dev) humorously puts it:

Some comparisons of resamplers http://src.infinitewave.ca/
I've seen that page before and I found out RIGHT THERE that Speex resampled isn't as perfect as SoX. Attached screenshot as proof.

If you look at the legend, you'll see that the absolutely horrible artefacts caused by the Speex resampler have an amplitude of around -140 dB. Rather than involve TOS 8, I will just make the following recommendation: If you can hear the artefacts caused by the Speex resampler, then you really should not be using a lossy codec. I will actually add that you *also* shouldn't be using 16-bit audio (hence CDs) because the -96 dB noise floor it causes is about 40 dB worse than the awful resampling artefacts you're pointing out.

Quote
So why not include resampler which is both accurate and fast? Why include something slower and not perfect?

The Speex resampler is fast enough for the job -- we don't run it at the highest quality because that's overkill (see above). The main reason we use it is not because it's better than all the others (it's likely not), but because it's good enough and it's self-contained so it doesn't add an external dependency. OTOH, using Sox would require making opusenc GPL-licensed, which some people would not like.


SimplePortal 1.0.0 RC1 © 2008-2021