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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With