lordmulder / LameXP

Audio Encoder Front-End
http://lordmulder.github.io/LameXP
Other
184 stars 18 forks source link

wrong sample rate #82

Closed simon1tan closed 4 years ago

simon1tan commented 4 years ago

4.17 Build 2188 When I convert wav to mp3, CBR 96k Joint Stereo 44.1k, it produces 32k sample rate instead. Mediainfo on the wav: Format : PCM Format settings : Little / Signed Codec ID : 1 Duration : 23 s 336 ms Bit rate mode : Constant Bit rate : 1 411.2 kb/s Channel(s) : 2 channels Sampling rate : 44.1 kHz Bit depth : 16 bits Stream size : 3.93 MiB (100%)

Ended up using another tool to do the job.

lordmulder commented 4 years ago

Hello.

It is the normal behavior of the LAME mp3 encoder (not my idea) to down-sample to a lower sampling rate at those very low bitrates, unless you force the original samplerate via --resample 44100 😏

Some theory: According to the Nyquist–Shannon sampling theorem, the highest audio frequency that can be retained in a sampled audio signal is exactly 1/2 of the sampling rate! So, with sampling rate of 44.1 KHz we can retain audio frequencies of up to 22.05 KHz (about the limit of human hearing), whereas with a sampling rate of 32.0 KHz we can retain audio frequencies of up to 16.0 KHz. So, down-sampling from 44.1 KHz to 32.0 KHz effectively is a low-pass filter, i.e. it discards the highest frequencies.

Why would we want to do this? At bitrates as low as 96 kbps, sound quality is not going the be "great" anyway – no matter what! So, discarding the highest frequencies (by down-sampling) and using those bits that we have for the remaining frequencies actually turns out to be the lesser of two evils! 🤓

It is better to remove the highest frequencies than getting more annoying compression artifacts.

Of course, you can try to force a sampling rate of 44.1 KHz at the very low bitrates and see (or better: hear) yourself. But, in general, I would trust the LAME developers and two decades of encoder tuning.

Regards MuldeR


See also: https://forum.doom9.org/archive/index.php/t-24900.html