开发者

How to normalise audio after resampling

I'm thinking of using libsamplerate to resample audio files which seems fairly simple.

In the FAQ it states that after resampling that the audio sh开发者_开发问答ould be normalised which I'm not sure how to do.

It states that the audio samples should be in the range (-1.0, 1.0). Is it just a case of:

  1. Finding the sample which lies the furthest from this range
  2. Calculating the coefficient that will result in it's value being -1.0 or 1.0
  3. Applying that coefficient to every sample in the audio file?


Basically yes, you have to find the sample of largest absolute value, and just divide all samples by this value, which ensures all samples will lie in the (-1.0,1.0) range. Of course it requires you have access to the whole audio data in advance (you cannot normalize a stream, since you do not know what samples you will be getting, e.g 3 seconds into the future).

Keep in mind though that this operation will probably result in a change of perceived loudness ('volume'). If you want the overall loudness to be preserved after resampling, you have to measure it before and after resampling, and apply a proper coefficient.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜