C# 音频 - 如何时间拉伸(不同的速度,相同的音高)

发布于 2024-08-22 14:55:54 字数 498 浏览 12 评论 0原文

我正在尝试用 C# (VS2008) 制作一个 winform 应用程序,它可以加载 mp3(其他格式也不错,但至少是 mp3),并且能够在不影响音调的情况下调整播放速度(节奏)。我真的不需要任何其他音频效果。我尝试使用 DirectShow,但它似乎不提供时间拉伸功能。我能够合并 irrklang 但似乎也没有时间拉伸功能。现在我转向 SoundTouch。这当然有能力,但我很不清楚如何在 C# 中实现。

经过几天的努力,我所完成的工作就是在 SoundTouch DLL 上使用 DLLImport,并且能够成功检索版本号。此时,我什至不确定是否可以使用 SoundTouch 完成我想要做的事情。任何人都可以提供一些关于如何实现 SoundTouch 或具有我正在寻找的功能的不同库的指导吗?谢谢。

I'm trying to make a winform app in C# (VS2008) that can load an mp3 (other formats would be nice, but mp3 at a minimum) and be able to adjust the playback speed (tempo) without affecting pitch. I really don't need any other audio effects. I tried using DirectShow but that doesn't seem to offer time stretch capabilities. I was able to incorporate irrklang but that does not seem to have the time stretch capability either. So now I've moved on to SoundTouch. That certainly has the capabilities but I'm very unclear on how to implement in C#.

After a few days of this, about all I've accomplished is using DLLImport on the SoundTouch DLL and am able to successfully retrieve a version number. At this point, I'm not even sure if I can do what I'm trying to do with SoundTouch. Can anyone offer some guidance either on how to implement SoundTouch or a different library with the capabilities that I'm looking for? Thank you.

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

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

发布评论

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

评论(4

栀子花开つ 2024-08-29 14:55:54

如果有人仍然感兴趣,我已经为 SoundTouch 库编写了 .Net 包装类。
http://code.google.com/p/soundtouchnet/

If anyone is still interested, I have written .Net wrapper class for SoundTouch library.
http://code.google.com/p/soundtouchnet/

顾忌 2024-08-29 14:55:54

答案是 SoundTouch 可以做您想做的事。

看一下示例程序SoundStretch。它提供了使用 SoundTouch 库更改速度(不更改音调)以及更改音调(不更改速度)和播放速率(同时更改音调和速度)的示例。我会查看源代码并使用您需要的内容。

我看到的唯一问题是您使用的是 mp3 格式,而它使用的是 WAV 格式,因此您需要先转换文件。我真的不认为您会找到一个程序可以直接在任何类型的压缩文件上执行您想要的操作,因为用于执行此类操作的方法的性质。如果您想进一步了解整个过程,它会使用相位声码器

The answer is that SoundTouch can do what you want to do.

Take a look at the example program SoundStretch. It gives examples of using the SoundTouch library to change the tempo(without changing the pitch) as well as changing the pitch (without changing tempo) and playback rate(change both pitch and tempo). I would look through the source code and use what you need.

The only problem that I see is that you are using an mp3 format and this uses a WAV format so you will need to convert the file first. I really don't think that you'll find a program that does what you want directly on any sort of compressed file because of the nature of the method used to do this sort of thing. It uses a phase vocoder if you want to look into the whole process a bit more.

裂开嘴轻声笑有多痛 2024-08-29 14:55:54

在 C# 中使用 SoundTouch 的另一种方法是将 BASS 声音库 (http://un4seen.com) 与 BASS 结合使用。 NET 包装器和 BASS_FX 插件。 BASS_FX 使用 SoundTouch 进​​行时间拉伸。

Another way of using SoundTouch in C# is to use the BASS sound library (http://un4seen.com) with the BASS.NET wrapper and the BASS_FX plugin. BASS_FX uses SoundTouch to do TimeStretching.

甜是你 2024-08-29 14:55:54

以下是从 C# 调用的一种可能方法。您需要用 C++ 编写一个 COM 包装器来包装 SoundTouch DLL。准备好 COM 包装器后,您可以将其导入 .NET (C#) 项目并通过 COM 包装器调用底层 SoundTouch DLL。希望这有帮助。

Here is one possible approach to invoke from C#. You need to write a COM wrapper in C++ to wrap around the SoundTouch DLL. Once you have the COM wrapper ready, you can import it into your .NET (C#) project and invoke the underlying SoundTouch DLL through the COM Wrapper. Hope this helps.

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