音频转换 C#

发布于 2024-08-02 19:15:18 字数 321 浏览 1 评论 0 原文

将各种音频格式转换为 PCM 的最佳方法是什么?

例如:mp3、evrc、ogg vox。

有没有一个库可以让我相对轻松地实现这一点?

编辑:

我想我最初的问题并不是我真正需要的。我发现的大多数库都是文件转换器。我需要的是一个块转换器,我在其中传递 1Kb 的 vox 数据块,然后它返回转换后的 PCM 块。当然,我必须告诉转换器它是什么类型的数据以及各种编解码器信息。

我想要的解决方案是将 VOIP 格式保存为通用的 wav 格式,并实时播放该一致的文件。我认为应该有一种简单的方法来做到这一点,因为所有音频最终都会在输出之前转换为 PCM。

What is the best way to convert various audio formats to PCM?

For example: mp3, evrc, ogg vox.

Is there a library out there that will allow me to implement this relatively easily?

EDIT:

I guess my initial question wasn't really what I needed. Most of the libs I have found are file converters. What I need is a block converter, where I pass in a 1Kb block of vox data and it returns its converted PCM block. Of course I’ll have to tell the converter what type of data it is and various pieces of codec information.

The solution I am going for is to save and VOIP formats into a common wav format and to play that conformed file in real time. I thought there should be an easy way to do this because all audio is eventually turned into PCM before it is outputted anyways.

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

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

发布评论

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

评论(5

失去的东西太少 2024-08-09 19:15:18

您可以使用 NAudio 将压缩音频块传递到计算机上安装的任何 ACM 编解码器中。不过,您确实需要知道如何创建适当的 WAVEFORMAT 结构来正确描述压缩音频类型。

You can use NAudio to pass blocks of compressed audio into any ACM codecs you have installed on your machine. You do need to know how to create the appropriate WAVEFORMAT structure to describe the compressed audio type correctly though.

江城子 2024-08-09 19:15:18

查看适用于 .NET 的 AVBlocks SDK。它支持多种音频格式和音频转换,例如多通道音频到立体声音频、重采样和比特率转换。

Check out AVBlocks SDK for .NET. It supports several audio formats, and audio transforms like Multi-channel audio to Stereo audio, resampling and bitrate conversion.

十二 2024-08-09 19:15:18

尝试修改代码 http://alvas.net/alvas.audio,tips.aspx#tip91

    static void AnyToWav(string fileName)
    {
        DsReader dr = new DsReader(fileName);
        IntPtr formatPcm = dr.ReadFormat();
        byte[] dataPcm = dr.ReadData();
        dr.Close();
        WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"), AudioCompressionManager.FormatBytes(formatPcm));
        ww.WriteData(formatPcm);
        ww.Close();
    }

Try modified code from http://alvas.net/alvas.audio,tips.aspx#tip91

    static void AnyToWav(string fileName)
    {
        DsReader dr = new DsReader(fileName);
        IntPtr formatPcm = dr.ReadFormat();
        byte[] dataPcm = dr.ReadData();
        dr.Close();
        WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"), AudioCompressionManager.FormatBytes(formatPcm));
        ww.WriteData(formatPcm);
        ww.Close();
    }
柏拉图鍀咏恒 2024-08-09 19:15:18

不知道有什么库可以完成这一切,但我们使用 madxlib 进行 mp3->wav 。

它是免费的,但我建议支付 10 美元购买 sdk,因为它附带文档和示例。

Don't know any lib that does it all but we do mp3->wav using madxlib.

It's free but I suggest paying the $10 for the sdk as it comes with documentation and examples.

爱已欠费 2024-08-09 19:15:18

youtube 上有 ac# 教程可能对您有帮助。它展示了如何使用名为 alvas.audio 的特定音频库,该库确实对音频做了一些巧妙的事情。我发现该视频非常有教育意义。音频库完全用 C# 编写。观看视频了解更多详情:http://www.youtube.com/watch?v=2DIQECXFPeU

There is a c# tutorial on youtube that might be helpful to you. It shows how to use a specific audio library called alvas.audio that really does some neat things with audio. I found the video to be very educational. The audio library is completely written in c#. Watch the video for more details: http://www.youtube.com/watch?v=2DIQECXFPeU

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