当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Upsampling PCM audio: from 6 kHz to 8kHz

问题描述:

What would a straight-forward way to convert an audio payload (PCM 16bit) from 6 kHz to 8kHz? I understand that this is an interpolation problem.

I fear that a linear interpolation would introduce too much noise. If so, what would be a better interpolation? I was looking at Lanczos resampling but I've seen it used in image scaling only and not sure it's worth it for audio.

I'm using Java. I've found the JSSRC library butI would have prefer something more lightweight. Beside, I'm not sure this is really necessary for low-frequency audio (which happens to be decoded from ADPCM).

BTW, I'm not interested in creating a WAV having a 6 kHz frequency header, I really want to resample.

网友答案:

Linear interpolation is actually pretty good. It's worth giving a try. If you are working in Java with the PCM (obtained from an AudioInputStream, then converting incoming bytes to PCM), then saving, Java will take care of the wav format header details. Did you see this tutorial? Using Files and Format Converters

In the first code example, take special notice of the point where the comment appears: "// Here, do something useful ..."

I think that because you are going to a higher sampling rate, the interpolation process can work. If you were going to a lower rate, there would be complications due to frequencies over 3 Hz (Nyquist for 6 Hz sampling rate) causing aliasing.

分享给朋友:
您可能感兴趣的文章:
随机阅读: