C# 音频库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/466458/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# Audio Library
提问by Nick
I am looking to develop an audio player in C#, but was wondering what libraries are available for playback. I am looking for a free library that allows for an extensive list of audio formats to be played (for example mp3, wma, wav, ogg, etc.) Thats pretty much the basic functionality I would need. But if I could get picky, a library that can convert audio files between the formats would be handy. Doing a google search I came across the alvas.audio library, but it wasn't free. The VLC library would be nice too, but I couldn't get it to work, and I'd prefer to just package my application with a dll instead of having my users have the VLC software installed on their machine as well.
我想用 C# 开发音频播放器,但想知道哪些库可用于播放。我正在寻找一个免费的库,它允许播放大量音频格式(例如 mp3、wma、wav、ogg 等)。这几乎是我需要的基本功能。但是如果我可以挑剔的话,一个可以在格式之间转换音频文件的库会很方便。进行谷歌搜索时,我发现了 alvas.audio 库,但它不是免费的。VLC 库也很好,但我无法让它工作,而且我更愿意将我的应用程序与 dll 打包在一起,而不是让我的用户也在他们的机器上安装 VLC 软件。
Thanks for any tips or advice on this.
感谢您对此的任何提示或建议。
采纳答案by Joel Coehoorn
Bass Audio Libraryis one option.
低音音频库是一种选择。
回答by casperOne
You will want to take a look at DirectShow. DirectShow is an unmanaged library which depends on the codecs installed on the user's system for which you can create render graphs. DirectShow is free and usually installed on most Windows machines.
你会想看看 DirectShow。DirectShow 是一个非托管库,它依赖于安装在用户系统上的编解码器,您可以为其创建渲染图。DirectShow 是免费的,通常安装在大多数 Windows 机器上。
There is a managed wrapper for DirectShow titled DirectShow.NET, which you can find here:
DirectShow 有一个名为 DirectShow.NET 的托管包装器,您可以在此处找到:
回答by Mark Heath
NAudiois an open source .NET audio library that can play back WAV, MP3, WMA, AAC and AIFF files, making use of ACM or Media Foundation codecs installed on your computer for decompression purposes. For ogg support, there is an add-on nuget packageyou can use.
NAudio是一个开源 .NET 音频库,可以播放 WAV、MP3、WMA、AAC 和 AIFF 文件,利用安装在计算机上的 ACM 或 Media Foundation 编解码器进行解压缩。对于 ogg 支持,您可以使用一个附加的 nuget 包。
(Edit:updated with details of supported audio file types in NAudio 1.7. Also, full disclosure: I am the author of this library)
(编辑:更新了 NAudio 1.7 中支持的音频文件类型的详细信息。另外,完全披露:我是这个库的作者)
回答by Alex
This library doesn't seem to be developed any further, I purchased a lifetime team license and haven't been able to get in touch with the developer since November 2011, no answer after many emails, and no new versions despite the promise to create new versions quarterly. Also didn't get any kind of message from the developer that he is abandoning the project.
这个库似乎没有进一步开发,我购买了终身团队许可证,自 2011 年 11 月以来一直无法与开发人员取得联系,许多电子邮件后没有答复,尽管承诺创建,但没有新版本每季度推出新版本。也没有从开发人员那里得到任何关于他放弃该项目的消息。
回答by M. Dudley
回答by ashes999
As of 2012, OpenALseems to be a viable library -- and something of a standard. It works on a range of OSes (from XP to Windows 8), and integrates with (is already integrated with) MonoGame.
到 2012 年,OpenAL似乎是一个可行的库——而且是某种标准。它适用于一系列操作系统(从 XP 到 Windows 8),并与 MonoGame 集成(已集成)。
Since the Creative Labs link (above) is down, you can try one of these instead:
由于 Creative Labs 链接(上图)已关闭,您可以尝试以下方法之一: