高效音频采样率转换器 Efficient Audio Sample Rate Converter
- 这是一个基于相似三角形性质的近似采样率转换算法,可以将任意采样率的音频转换成其他任意的采样率,能用在精度不高,但需要处理速度快的场合。
- 此算法处理的结果在低频范围内的频率分布基本和Cool Edit软件处理的效果一致,但高频部分可能有损失。
- 由于只用直线估计实际采样点之间的采样值,没有滤波过程,此算法的时间复杂度只有O(n)。
- 在我的PC上运用此算法,3分钟的音频文件从44.1K转到48K只需处理1秒左右;而同一环境下,Cool Edit需要处理近半分钟。
- wav文件读写的类来源于这里
- This is an approximate sample rate conversion algorithm based on the properties of similar triangles. It can convert audio with any sample rate to any other desired sample rate and is suitable for situations where precision is not critical but high processing speed is required.
- The results of this algorithm in the low-frequency range exhibit a frequency distribution similar to that achieved by Cool Edit software. However, there may be some loss in the high-frequency components.
- Due to the use of linear estimation between actual sample points without a filtering process, the time complexity of this algorithm is only O(n).
- When applied on my PC, this algorithm can process a 3-minute audio file, converting it from 44.1K to 48K, in approximately 1 second, whereas Cool Edit, under the same conditions, takes nearly half a minute.
- The classes for reading and writing WAV files are sourced from here