C# 中的 PCM 数据音高变化

发布于 2024-07-26 02:17:23 字数 111 浏览 4 评论 0原文

我有一个程序,可以从 Web 服务器下载 PCM 数据,稍后使用该数据通过标准 PCM 播放器进行播放。 我希望能够允许用户在播放 PCM 数据时更改其音调。

有谁知道如何做到这一点?

I have a program that downloads PCM data from a Web Server, which it uses later to play through a standard PCM player. I want to be able to allow users to change the pitch of the PCM data while its being played.

Does anyone know how to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫﹏色ふ单纯 2024-08-02 02:17:23

最简单的解决方案是以比录制时更高的采样率播放声音 - 以 44 kHz 播放 22 kHz 文件将使音调加倍。 您可以通过丢弃声音中的一些样本(质量差)或重新采样声音(如果使用正弦插值等良好算法,则质量好)来实现相同的效果。

但有一个依赖性 - 通过以不同的采样率播放来改变音调不仅会改变音调,还会改变声音的长度。 可以独立改变持续时间和音高,但这并不容易,并且需要大量的信号处理才能获得良好的质量。 通常使用快速傅立叶变换在频域中完成。

The simplest solution is to play back the sound at a higher sampling rate than it was recorded - playing a 22 kHz file at 44 kHz will double the pitch. You can achieve the same by just throwing away some samples from the sound (bad quality) or resampling the sound (good quality if a good algorithm like sinc interpolation is used).

But there is a dependency - changing the pitch by playing back at different sampling rates will not only change the pitch, but the length of the sound, too. It is possible to change the duration and pitch independently, but that is not that easy and involves a fair amount of singnal processing to achieve good quality. It is usually done in the frequency domain using Fast Fourier Transformations.

囍笑 2024-08-02 02:17:23

我不知道任何 C# 数字信号处理库,但这似乎是 .net 中音调转换的完整源示例。:
http://sites.google.com/site/mikescoderama/pitch-shifting

I don't know any digital signal processing library for C#, but this seems to be a complete source sample for pitch shifting in .net.:
http://sites.google.com/site/mikescoderama/pitch-shifting

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文