Skip to main content


Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Opus lowpass filter (Read 1767 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Opus lowpass filter

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!

Re: Opus lowpass filter

Reply #1
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.

Re: Opus lowpass filter

Reply #2
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
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.

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.