NAudio error: “NoDriver calling acmFormatSuggest”

こ雲淡風輕ζ 提交于 2019-11-30 08:36:05

问题


I've got a project that uses NAudio to convert from mp3 to wav. (using the WaveFormatConversionStream.CreatePcmStream() method)

It worked fine on my development machine but now I'm trying it on a fresh new server and its throwing this error:

NAudio.MmException: NoDriver calling acmFormatSuggest
at NAudio.MmException.Try(MmResult result, String function)
at NAudio.Wave.Compression.AcmStream.SuggestPcmFormat(WaveFormat compressedFormat)
at NAudio.Wave.WaveFormatConversionStream.CreatePcmStream(WaveStream sourceStream)

I assume there is some dependency that NAudio needs here that isn't on the new server. What is it and where should I install it from?

Server is a freshly-hatched Amazon EC2 Windows 2008 32-bit instance with 'web server' and 'app server' roles installed.


回答1:


Running Windows 2008 R2, using Naudio to detect the length of Wav and Mp3 files, i ran into the same problem.

I solved this by following this: https://technet.microsoft.com/en-us/library/cc772567.aspx

Essentially, install the "Desktop Experience" feature.

The above will require a restart of the server.

Once the above was installed, i needed to enable nothing further, the problem was resolved.




回答2:


WaveFormatConversionStream makes use of the ACM codecs installed on your machine. It starts by asking if there is any ACM codec installed that can convert from the source to the target format. It would seem that you are missing an MP3 codec on the target machine.

NAudio does offer a different way to decode MP3s, using the DMO MP3 Decoder (DirectX Media Object), which may also be on your target machine. To use this you need to get the latest NAudio source from Codeplex and in the MP3FileReader (which now does the conversion to PCM for you), you take the following line:

decompressor = new AcmMp3FrameDecompressor(this.Mp3WaveFormat); 

and replace it with

decompressor = new DmoMp3FrameDecompressor(this.Mp3WaveFormat); 



回答3:


Thanks to @Shiroy, I found the amazing NLayer (https://github.com/naudio/NLayer) library By @MarkHeath. If you install it with NLayer.NAudioSupport, you can compress with one additional line of code (and no installed codecs required).



来源:https://stackoverflow.com/questions/5652388/naudio-error-nodriver-calling-acmformatsuggest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!