Sample Rate Conversion

Sample Rate Conversion

Introduction


See the Wikipedia article Resampling (audio) for a generic definition of sample rate conversion, also known as "resampling." The remainder of this article describes resampling within Android. See Sample Rate Conversion for related terminology.

Sample rate conversion is the process of changing a stream of discrete samples at one sample rate to another stream at another sample rate. A sample rate converter, or resampler, is a module that implements sample rate conversion. With respect to the resampler, the original stream is called the source signal, and the resampled stream is the sink signal.

Resamplers are used in several places in Android. For example, an MP3 file may be encoded at 44.1 kHz sample rate and needs to be played back on an Android device supporting 48 kHz audio internally. In that case, a resampler would be used to upsample the MP3 output audio from 44.1 kHz source sample rate to a 48 kHz sink sample rate used within the Android device.

The characteristics of a resampler can be expressed using metrics, including:

  • degree of preservation of the overall amplitude of the signal
  • degree of preservation of the frequency bandwidth of the signal, subject to limitations of the sink sample rate
  • overall latency through the resampler
  • consistent phase and group delay with respect to frequency
  • computational complexity, expressed in CPU cycles or power draw
  • permitted ratios of source and sink sample rates
  • ability to dynamically change sample rate ratios
  • which digital audio sample formats are supported

The ideal resampler would exactly preserve the source signal's amplitude and frequency bandwidth (subject to limitations of the sink sample rate), have minimal and consistent delay, have minimal computational complexity, permit arbitrary and dynamic conversion ratios, and support all common digital audio sample formats. In practice, ideal resamplers do not exist, and actual resamplers are a compromise among these characteristics. For example, the goals of ideal quality conflict with short delay and low complexity.

Android includes a variety of audio resamplers, so that appropriate compromises can be made depending on the application use case and load. Section Resampler implementations below lists the available resamplers, summarizes their characteristics, and identifies where they should typically be used.

Resampler implementations


Available resampler implementations change frequently, and may be customized by OEMs. As of Android 4.4, the default resamplers in descending order of signal distortion, and ascending order of computational complexity include:

  • linear
  • cubic
  • sinc with original coefficients
  • sinc with revised coefficients

In general, the sinc resamplers are more appropriate for higher-quality music playback, and the other resamplers should be reserved for cases where quality is less important (an example might be "key clicks" or similar).

The specific resampler implementation selected depends on the use case, load, and the value of system property af.resampler.quality. For details, consult the audio resampler source code in AudioFlinger.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值