HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: Borneq on 2014-12-30 07:22:35

Title: Lack of sampling rate
Post by: Borneq on 2014-12-30 07:22:35
Supported sampling rates are 8000, 12000, 16000, 24000 and 48000.
I have wav file with 44100 or 22050 sampling rate. How compress it? If I compress 22050/s to 24000/s I get Opus file with faster audio and higher frequency or codec will resample between 22050 points per second?
Is possible to add 44100 and 22050 sampling rates?
Title: Lack of sampling rate
Post by: Joungmin Lee on 2014-12-30 08:00:17
https://wiki.xiph.org/OpusFAQ#How_do_I_use_...rted_by_Opus.3F (https://wiki.xiph.org/OpusFAQ#How_do_I_use_44.1_kHz_or_some_other_sampling_rate_not_directly_supported_by_Opus.3F)


Quote
Tools which read or write Opus should interoperate with other sampling rates by transparently performing sample rate conversion behind the scenes whenever necessary. In particular, software developers should not use Opus Custom for 44.1 kHz support, except in the very specific circumstances outlined above.

Note that it's generally preferable for a decoder to output at 48kHz even when you know the original input was 44.1kHz, not only because you can skip resampling but also because many inexpensive audio interfaces have poor quality output for 44.1k.

The opus-tools package source code contains a small, high quality, high performance, BSD licensed resampler which can be used where resampling is required.

Title: Lack of sampling rate
Post by: LithosZA on 2014-12-30 15:10:03
As far as I know opusenc included in opus-tools will already resample the input for you.
Title: Lack of sampling rate
Post by: lithopsian on 2014-12-30 15:44:59
As far as I know opusenc included in opus-tools will already resample the input for you.

As Jean-Marc pointed out to me recently, opusenc will automatically resample for you but the underlying library will not.  opusenc uses the speex resampler provided in opus-tools, and if you're writing your own encoder you probably will want to do that too.