5.1 output using WAV file

Apr 12, 2011 at 12:17 AM


When I attempt to play a 6-channel WAV file in the demo, I get a "NoDriver calling acmFormatSuggest" error.  I traced it back to the AcmStream.SuggestPcmFormat call, and here's the difference between the suggestedFormat and compressedFormat:

- compressedFormat {24 bit PCM: 48kHz 6 channels} NAudio.Wave.WaveFormat {NAudio.Wave.WaveFormatExtraData}

+ [NAudio.Wave.WaveFormatExtraData] {24 bit PCM: 48kHz 6 channels} NAudio.Wave.WaveFormatExtraData

 averageBytesPerSecond 864000 int

 AverageBytesPerSecond 864000 int

BitsPerSample 24 int

bitsPerSample 24 short

BlockAlign 18 int

blockAlign 18 short

Channels 6 int

channels 6 short

Encoding Extensible NAudio.Wave.WaveFormatEncoding

ExtraSize 22 int

extraSize 22 short

sampleRate 48000 int

SampleRate 48000 int

waveFormatTag Extensible NAudio.Wave.WaveFormatEncoding

- suggestedFormat {16 bit PCM: 48kHz 6 channels} NAudio.Wave.WaveFormat

averageBytesPerSecond 576000 int

AverageBytesPerSecond 576000 int

BitsPerSample 16 int

bitsPerSample 16 short

BlockAlign 12 int

blockAlign 12 short

Channels 6 int

channels 6 short

Encoding Pcm NAudio.Wave.WaveFormatEncoding

ExtraSize 0 int

extraSize 0 short

sampleRate 48000 int

SampleRate 48000 int

waveFormatTag Pcm NAudio.Wave.WaveFormatEncoding


This call would suggest that it will always be 16-bit.  I'll try passing in either a constant 24, or compressedFormat.BitsPerSample.

WaveFormat suggestedFormat = new WaveFormat(compressedFormat.SampleRate, 16, compressedFormat.Channels);


Any thoughts?  I'm able to play the file with appropriate sound coming through all 6 channels in WMP.  Thanks in advance.

Apr 12, 2011 at 9:46 AM

NAudio doesn't have built-in support for 24 bit playback, or multi-channel playback, so it is no surprise that this doesn't play (it's because WaveChannel32 expects 16 bit input so it is trying to use ACM to convert 24 to 16). However, you could try a much simpler playback path, passing the output from the WavFileReader directly into WaveOut and see if WaveOut lets you play 24 bit 5.1 channel audio directly.


Apr 12, 2011 at 4:57 PM

No luck, made a really simple app and got back a InvalidParameter exception from waveOutOpen, with HResult of  -2146233088.  Is there any way around this, or will I need to look at using a different library?  Your library is the best I've found in C#.  Thanks for the help.

Apr 13, 2011 at 9:56 AM

it must be possible, although the WaveOut drivers might not support it (it may be the 24 bit that WaveOut is objecting to rather than the 5.1 - might be worth investigating if you can make the appropriate test file). Have you tried DirectSound or Wasapi?


Apr 13, 2011 at 9:57 AM

I should add, can you upload a small sample file somewhere, that I can use to do a bit of testing myself?

Apr 14, 2011 at 1:02 AM

Hey Mark,

Thanks for the help so far.  My work has been put on hold for the moment, so won't be able to test DirectSound or Wasapi anytime soon.  I'll try to upload the sample file.