用于上采样的 PCM 算法
我有 8k16 位 pcm 音频,我想将其上采样到 16k16 位。我必须手动执行此操作。
有人可以告诉我线性插值的算法吗?我应该在每两个字节之间插入吗?
另外,当我上采样时,我必须对 wav 标头进行更改 - 我应该更改什么?
I have 8k16bit pcm audio and I want to upsample it to 16k16bit. I have to do this manually.
Can someone tell me the algorithm for linear interpolation? Should I interpolate between each two bytes?
Also when I upsample i have to make changes for the wav header - what should I change?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
正如其他人提到的,线性插值并不能提供最好的音质,但它简单且便宜。
对于您创建的每个新样本,只需将其与下一个样本进行平均,例如,
您绝对应该搜索可以帮助您处理 WAV 文件的库。尽管它是一种简单的格式,但如果有可用的代码可以满足您的需要,您就不必自己执行此操作。顺便问一下,你为什么要这样做?也许您可以使用 sox 或类似的工具来完成此操作。
As others have mentioned, linear interpolation doesn't give the best sound quality, but it's simple and cheap.
For each new sample you create, just average it with the next one, e.g.
You should definitely search for a library that helps you with working with WAV files. Even though it's a simple format, you shouldn't have to do that yourself if there's code available that will do what you need. By the way, why are you doing this in the first place? Perhaps you could just use sox or a similar tool to do this.
当然:
线性插值虽然总比没有好,但误差很大。如果你有足够的CPU时间,最好将零填充和窗口设置为零。
不确定java。
sure:
linear interpolation, while better than nothing, has a high amount of error. it's better to zero fill and window if you have the cpu time.
not sure for java.
这是在 java 中使用 WAV 文件的一个很好的链接:
http://www.labbookpages.co .uk/audio/javaWavFiles.html
Here's a good link to working with WAV files in java:
http://www.labbookpages.co.uk/audio/javaWavFiles.html
不确定标题,但我会研究三次样条插值。您可以查看此网站。它有一种非常巧妙的方法来执行三次插值。我不确定如何修改标头,但我很确定 Stack Overflow 上已经有您可以搜索的答案。
Not sure about the header, but I would look into cubic spline interpolation. You could look at this website. It's got a very neat way of performing cubic interpolation. I'm not sure how to modify the header, but I'm pretty sure there have been answers to that on Stack Overflow that you could search for.