NAudio error: "NoDriver calling acmFormatSuggest"
Asked Answered
D

3

7

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.

Derange answered 13/4, 2011 at 16:20 Comment(0)
E
7

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.

Express answered 25/2, 2016 at 21:31 Comment(3)
Thinking back, that might be how I eventually solved this too.Derange
This solution is great when you own the server, when you don't (as is the case for Azure Websites), you can't install this. Try using NLayer nlayer.codeplex.comHighoctane
Works on Windows Server 2012 as well. The "Desktop Experience" feature is a litle bit more hidden there, use this to find it: yellowduckguy.wordpress.com/2012/12/21/…Edessa
M
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); 
Mirabella answered 14/4, 2011 at 6:10 Comment(6)
This didn't work for me. That code apparently tries to load a DMO that is ALSO not installed on Windows 2008 Server. Allegedly this DMO is in the Windows SDK, but I installed that and it's still not there.Burnaby
I am also still not get the .wav file. I am just convert my mp3 to wav file.Lesterlesya
you need to install the desktop experience component of Windows Server.Mirabella
You can't install the Desktop Experience Pack on Windows Azure Websites. I tried NLayer as well, but it converts the WAV file to a 32bit float file, which makes it harder to read.Highoctane
@Highoctane You can go back to 16 bit with WaveFloatTo16ProviderMirabella
Can you please help with the code? See my related question at: #39399168Highoctane
S
0

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).

Segalman answered 12/8, 2017 at 14:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.