上采样算法PCM

编程入门 行业动态 更新时间:2024-10-09 02:29:35
本文介绍了上采样算法PCM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有8k16bit PCM音频,我想上采样它16k16bit。我必须手动完成。

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?

此外,当我上采样我必须做出对WAV头的变化 - 我应该怎么改

Also when I upsample i have to make changes for the wav header - what should I change?

推荐答案

正如其他人所说,线性插值不给最好的音质,但它的简单和便宜。

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.

short[] source = ...; short[] result = new short[source.length * 2]; for(int i = 0; i < source.length; ++i) { result[i * 2] = source[i]; result[i * 2 + 1] = (source[i] + source[i + 1]) / 2; }

您一定要寻找一个库,可以帮助您与WAV文件的工作。尽管这是一个简单的格式,你不应该这样做,你自己是否有可用code,会做你的需要。顺便说一句,你为什么要摆在首位这样做呢?也许你可以只使用SOX或类似的工具来做到这一点。

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.

更多推荐

上采样算法PCM

本文发布于:2023-11-30 12:45:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650017.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:算法   PCM

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!