Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Naudio NoDriver error in .NET

Tags:

c#

.net

mp3

naudio

I get the exception "NoDriver calling acmFormatSuggest" when executing this function:

private static WaveChannel32 OpenMp3Stream(string fileName)
    {
        WaveChannel32 inputStream;
        WaveStream mp3Reader = new Mp3FileReader(fileName);
        WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(mp3Reader);
        WaveStream blockAlignedStream = new BlockAlignReductionStream(pcmStream);
        inputStream = new WaveChannel32(blockAlignedStream);
        return inputStream;
    }

On this line:

WaveStream pcmStream = WaveFormatConversionStream.CreatePcmStream(mp3Reader);

I've tried to change the platform of NAudio.dll (from x86 to x64 and vice-versa), but that didn't help.

Is there another way to play an MP3 file from MemoryStream or how do I fix this error?

like image 824
Leonid Avatar asked Dec 28 '25 22:12

Leonid


1 Answers

This code relies on an ACM codec that can decode MP3 being present on your system. What OS are you using? Also ACM codecs are typically 32 bit, so running in x64 would mean there are no codecs available.

NAudio does also offer the possibility of using the DMO MP3 decoder as an alternative, which isn't available in XP, but seems to be present on most newer versions of Windows.

Finally, I would recommend using the very latest NAudio source code, in which the MP3FileReader has the PCM conversion built in, meaning you can just call Read and get PCM out.

like image 156
Mark Heath Avatar answered Dec 30 '25 14:12

Mark Heath