如何解码. net / monog中的wav、mp3和/或ogg ?

时间:2021-01-13 19:41:19

I am looking for a cross-platform (.Net and Mono on Windows, MacOSX, and Linux) way to decode wav, mp3, or ogg files such that I can then play the decoded streams through DirectSound or OpenAL as desired.

我想找一个跨平台的。Net和Mono在Windows、MacOSX和Linux上)解码wav、mp3或ogg文件的方式,这样我就可以通过DirectSound或OpenAL按需要播放解码后的流。

A solution that can decode either mp3 or ogg would be sufficient -- decoding both is not necessary. If it (or another solution) can decode wav as well, that would be ideal, but isn't strictly necessary since I could potentially convert my wav files to mp3 or ogg.

一个能够解码mp3或ogg的解决方案是足够的——解码两者都是不必要的。如果它(或其他解决方案)也能解码wav,那将是理想的,但并不是必须的,因为我有可能将我的wav文件转换成mp3或ogg。

A solution that can only decode wav files is only a partial solution, but I'll take what I can get. ;-)

一个只能解码wav文件的解决方案只是一个局部的解决方案,但是我将取我能得到的。:-)

Here's what I've already looked at:

以下是我已经看过的:

  • DirectSound and Alut both support WAV decoding, but Alut has been deprecated.
  • DirectSound和Alut都支持WAV解码,但不赞成使用Alut。
  • ffmpeg will decode just about anything, but it doesn't seem to have a common stable release across platforms?
  • ffmpeg会对任何东西进行解码,但它似乎并没有在平台上有一个共同的稳定版本?
  • I have not tried csvorbis yet, but it's very old and I'm not sure what its current status is.
  • 我还没有尝试过csvorbis,但是它已经很老了,我不确定它现在的状态是什么。

You are more than welcome to try to pursuade me that one of these above solutions is actually the best option.

非常欢迎您尝试说服我以上的解决方案之一实际上是最好的选择。

Thanks.

谢谢。

7 个解决方案

#1


1  

For simple support for WAV files you can look at mono's implementation in mcs/class/System/System.Media/AudioData.cs (http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System/System.Media/).

对于WAV文件的简单支持,您可以在mcs/class/System/System. media /AudioData中查看mono的实现。cs(http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System/System.Media/)。

For decoding ogg audio files you can look at the csvorbis module in mono's sn server: http://anonsvn.mono-project.com/viewvc/trunk/csvorbis/

要解码ogg音频文件,可以查看mono的sn服务器中的csvorbis模块:http://anonsvn.mono . project.com/viewvc/trunk/csvorbis/

#2


4  

You haven't mentioned the sort of licensing you're looking for. I've had excellent results with FMOD, which is available for free for non-commercial projects. It plays a diverse variety of formats, including ogg and mp3, and has an extensive API for controlling how to play them. It's cross-platform, like you require.

你没有提到你想要的那种许可。我在FMOD取得了很好的效果,它可以免费用于非商业项目。它播放多种格式,包括ogg和mp3,并且有一个广泛的API来控制如何播放它们。它是跨平台的,正如你所需要的。

FMOD targets games to a large extent; I wouldn't be surprised if it already comes with excellent 3D features (though I don't know for sure).

FMOD在很大程度上以游戏为目标;如果它已经拥有出色的3D功能(尽管我不确定),我不会感到惊讶。

As you can tell I'm quite a fan, which is mostly because it was surprisingly painless to get a blank C# project to play an OGG file for the first time.

正如您所知道的,我是一个非常喜欢的人,这主要是因为第一次使用一个空白的c#项目来运行OGG文件是非常容易的。

#3


1  

You should be able to play back .wav files directly with System.Media.SoundPlayer. Not sure if that helps your use case.

您应该能够使用System.Media.SoundPlayer直接回放.wav文件。不确定这是否有助于您的用例。

#4


0  

I worked with ffmpeg and so far I like it. Yea there are few issues across releases, but it is the most efficient of all.

我和ffmpeg一起工作,到目前为止我很喜欢它。是的,发行版之间很少有问题,但是它是最有效的。

#5


0  

To partially answer my own question, it turns out that it's pretty easy to write your own WAV loader. I used this article that describes the wav file format:

为了部分回答我自己的问题,事实证明,编写自己的WAV加载程序非常容易。我使用了这篇描述wav文件格式的文章:

http://www.sonicspot.com/guide/wavefiles.html

http://www.sonicspot.com/guide/wavefiles.html

#6


0  

as always, fmod is your answer... please feel free to get solution to all your problems on http://www.fmod.org/index.php/download#FMODExProgrammersAPI

一如既往,fmod是你的答案……请在http://www.fmod.org/index.php/download#FMODExProgrammersAPI上找到解决所有问题的方法

#7


-1  

https://sites.google.com/site/cobnut3d/

https://sites.google.com/site/cobnut3d/

SlimDX.DirectSound - is an example of code to C #.

SlimDX。DirectSound—是c#代码的示例。

#1


1  

For simple support for WAV files you can look at mono's implementation in mcs/class/System/System.Media/AudioData.cs (http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System/System.Media/).

对于WAV文件的简单支持,您可以在mcs/class/System/System. media /AudioData中查看mono的实现。cs(http://anonsvn.mono-project.com/viewvc/trunk/mcs/class/System/System.Media/)。

For decoding ogg audio files you can look at the csvorbis module in mono's sn server: http://anonsvn.mono-project.com/viewvc/trunk/csvorbis/

要解码ogg音频文件,可以查看mono的sn服务器中的csvorbis模块:http://anonsvn.mono . project.com/viewvc/trunk/csvorbis/

#2


4  

You haven't mentioned the sort of licensing you're looking for. I've had excellent results with FMOD, which is available for free for non-commercial projects. It plays a diverse variety of formats, including ogg and mp3, and has an extensive API for controlling how to play them. It's cross-platform, like you require.

你没有提到你想要的那种许可。我在FMOD取得了很好的效果,它可以免费用于非商业项目。它播放多种格式,包括ogg和mp3,并且有一个广泛的API来控制如何播放它们。它是跨平台的,正如你所需要的。

FMOD targets games to a large extent; I wouldn't be surprised if it already comes with excellent 3D features (though I don't know for sure).

FMOD在很大程度上以游戏为目标;如果它已经拥有出色的3D功能(尽管我不确定),我不会感到惊讶。

As you can tell I'm quite a fan, which is mostly because it was surprisingly painless to get a blank C# project to play an OGG file for the first time.

正如您所知道的,我是一个非常喜欢的人,这主要是因为第一次使用一个空白的c#项目来运行OGG文件是非常容易的。

#3


1  

You should be able to play back .wav files directly with System.Media.SoundPlayer. Not sure if that helps your use case.

您应该能够使用System.Media.SoundPlayer直接回放.wav文件。不确定这是否有助于您的用例。

#4


0  

I worked with ffmpeg and so far I like it. Yea there are few issues across releases, but it is the most efficient of all.

我和ffmpeg一起工作,到目前为止我很喜欢它。是的,发行版之间很少有问题,但是它是最有效的。

#5


0  

To partially answer my own question, it turns out that it's pretty easy to write your own WAV loader. I used this article that describes the wav file format:

为了部分回答我自己的问题,事实证明,编写自己的WAV加载程序非常容易。我使用了这篇描述wav文件格式的文章:

http://www.sonicspot.com/guide/wavefiles.html

http://www.sonicspot.com/guide/wavefiles.html

#6


0  

as always, fmod is your answer... please feel free to get solution to all your problems on http://www.fmod.org/index.php/download#FMODExProgrammersAPI

一如既往,fmod是你的答案……请在http://www.fmod.org/index.php/download#FMODExProgrammersAPI上找到解决所有问题的方法

#7


-1  

https://sites.google.com/site/cobnut3d/

https://sites.google.com/site/cobnut3d/

SlimDX.DirectSound - is an example of code to C #.

SlimDX。DirectSound—是c#代码的示例。