This project has moved and is read-only. For the latest updates, please go here.

Unable to play wav file

Mar 1, 2013 at 6:03 AM
Edited Mar 1, 2013 at 6:35 AM
Hi,

I have a wav file that was generated using the NAudio demo that records from an ASAPI input.

The file plays back fine in Windows Media Player but when I try to play the file using AudioFileReader I get a "NoDriver calling acmFormatSuggest" exception. The wav format is "extensible" if that is important.

Any ideas. I could send you the (short) wav file if you would like.

Thanks,
Chris
Mar 1, 2013 at 8:10 AM
This is because WASAPI uses an annoying type of WaveFormat format called WaveFormatExtensible. But underneath it is PCM (or maybe IEEE float). So what I do is when I create a WaveFileWriter I just recreate a new WaveFormat object with the right parameters.
Jan 23, 2014 at 8:38 PM
Hi Mark,

Please could you provide some example code cause I can't work out how to get this to work and have a whole load of Extensible Files to play through. My code that fails is:
var reader = new WaveFileReader(VoiceFile);
var downsampledStream = new WaveFormatConversionStream(new WaveFormat(44100, 24, 1), reader);
inputStream(2) = new WaveChannel32(downsampledStream);
Any help or pointers you could give would be a life saver.

Thanks
Ben
Jan 23, 2014 at 8:47 PM
Edited Jan 23, 2014 at 9:57 PM
What error are you getting? I suspect that you are getting an ACM error. It can't be used to convert to 24 bit.
Jan 23, 2014 at 9:55 PM
Edited Jan 23, 2014 at 11:41 PM
"NoDriver calling acmFormatSuggest" means the ACM codec for your file format is missing/incompatible. It's an MP3 file right? If so, either install an ACM mp3 codec or use MediaFoundationReader instead.
Jan 23, 2014 at 10:54 PM
Hi K24A3 - No it's a Wav file but with an Extensible header which seems to be mucking up how the file is recognised.

Mark - I'm getting the error "AcmNotPossible calling acmStreamOpen" when I try to run it through a new waveformat object and the standard "NoDriver calling acmFormatSuggest" when I just call it through the wavefilereader straight.

Thanks both for such quick responses - what parameters should I be using for the new file format? I tried changing to match the original wav file but still no dice. Mark from your above post it sounds like you have resolve this issue. Do you have a code snippet I could see please?
Jan 23, 2014 at 11:40 PM
MediaFoundationReader should be able to play it, have you tried that?
Jan 24, 2014 at 1:01 AM
Hi K24A3 - yes that seems to have worked. Thank you both for you help