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

AcmNotPossible calling acmStreamOpen

Dec 23, 2012 at 6:55 AM
Edited Dec 23, 2012 at 7:14 AM

Hello community,

With the following piece of code:

         LoopStream inputStream;
            if (fileName.EndsWith(".mp3" ))
                var mp3Reader = new Mp3FileReader(fileName);
                inputStream = new LoopStream(mp3Reader);

 A friend of mine is receiving the error " AcmNotPossible calling acmStreamOpen"

 The stack trace looks something like this:

   at NAudio.Wave.AcmMp3FrameDecompressor..ctor(WaveFormat sourceFormat)   at NAudio.Wave.Mp3FileReader.CreateAcmFrameDecompressor(WaveFormat mp3Format)   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream, FrameDecompressorBuilder frameDecompressorBuilder)   at NAudio.Wave.Mp3FileReader..ctor(Stream inputStream)   at NAudio.Wave.Mp3FileReader..ctor(String mp3FileName)   at Dream.World.AssetManager.CreateInputStream(String fileName)

Does anyone have any ideas? 

Dec 23, 2012 at 7:44 AM

It means you don't have an ACM codec installed that can decompress MP3. What operating system are you running on?

Dec 23, 2012 at 3:17 PM

Hi, I also seem to run into this problem running the NAudio Demo on Windows 8 when I set the target framework to be 4.0 or 4.5. If I set the target framework to be 3.5, it works fine. I did not have this problem under Windows 7 even with .Net 4.0.

I haven't found a way around this and am quite stuck right now. Hope this helps!

Dec 23, 2012 at 3:24 PM

in the NAudio demo app, can you go to the ACM codec tab and see what codecs you have installed. Also are you running 32 bit or 64 bit (the executable, not your OS)

Dec 23, 2012 at 4:08 PM

It crashes when I try to access it. I run in 32 bit.

Dec 23, 2012 at 4:18 PM

that is very strange. I am using WIndows 8, and I have no problem running NAudio demo in any version of .NET (I've tried 4.0 and 4.5). What line does it crash on? Is there a stack trace?


Dec 23, 2012 at 4:25 PM
Edited Dec 23, 2012 at 4:27 PM

No I don't have a stack trace as the program just crashes. I debugged to see where the problem seemed to be and it seems to occur in the WaveFormatCustomMarshaler when this is called :



Dec 23, 2012 at 4:51 PM
Edited Dec 23, 2012 at 4:52 PM

Enabling unmanaged code debugging gives me this : 

Unhandled exception at 0x57fc2170 in NAudioDemo.exe: 0xC0000005: Access violation.

 	[Frames below may be incorrect and/or missing, no symbols loaded for msaud32_divx.acm]	
 	[External Code]	
>	NAudio.dll!NAudio.Wave.Compression.AcmDriver.EnumerateAcmDrivers() Line 133 + 0x2e bytes	C#
 	NAudioDemo.exe!NAudioDemo.AcmPanel.AcmForm_Load(object sender = {NAudioDemo.AcmPanel}, System.EventArgs e = {System.EventArgs}) Line 23 + 0x6 bytes	C#
 	[External Code]	
 	NAudioDemo.exe!NAudioDemo.MainForm.buttonLoadDemo_Click(object sender = {SelectedItem = Cannot evaluate expression because a native frame is on top of the call stack.}, System.EventArgs e = {X = 90 Y = 48 Button = Left}) Line 39 + 0x21 bytes	C#
 	NAudioDemo.exe!NAudioDemo.MainForm.listBoxDemos_DoubleClick(object sender = {SelectedItem = Cannot evaluate expression because a native frame is on top of the call stack.}, System.EventArgs e = {X = 90 Y = 48 Button = Left}) Line 55 + 0xe bytes	C#
 	[External Code]	
 	NAudioDemo.exe!NAudioDemo.Program.Main() Line 26 + 0x8 bytes	C#
Dec 23, 2012 at 5:12 PM

interesting, looks like you have a divx ACM codec that might be causing the problem. Perhaps its largest WaveFormat size is bigger than the maximum I had allocated (with WaveFormatExtraData). Having said that I can't see how that would cause an access violation.

Are you able to debug against the actual NAudio source code? You could put breakpoints on WaveFormat.MarshalFromPtr and WaveFormat.MarshalToPtr. You could also see if WaveFormatCustomMarshaller.GetNativeDataSize is being called. Perhaps that is a problem.

Dec 23, 2012 at 6:04 PM

I can confirm that MarshalToPtr is being called, and that GetNativeDataSize never is. Since I also crash with the line :

AcmInterop.acmDriverEnum(new AcmInterop.AcmDriverEnumCallback(DriverEnumCallback), IntPtr.Zero, 0);

I'm not sure the problem is with WaveFormat.

Dec 23, 2012 at 6:11 PM

is DriverEnumCallback getting called? Can you try putting a breakpoint on that?


Dec 23, 2012 at 6:12 PM

Nope, it crashes before that.

Dec 23, 2012 at 7:04 PM

that's very strange. I guess it could be that you have a badly behaving ACM codec, but I would expect at least acmDriverEnum to work. If you go to help | about in Windows Media Player and click tech support information, what ACM codecs does it show?

Dec 23, 2012 at 7:16 PM


Audio Codecs

Type Name Format Binary Version
ACM Microsoft GSM 6.10 Audio CODEC 0031 msgsm32.acm 6.2.9200.16384
ACM Microsoft CCITT G.711 A-Law and u-Law CODEC 0007 msg711.acm 6.2.9200.16384
ACM Fraunhofer IIS MPEG Layer-3 Codec (professional) 0055 l3codecp.acm
ACM Microsoft IMA ADPCM CODEC 0011 imaadp32.acm 6.2.9200.16384
ACM Microsoft ADPCM CODEC 0002 msadp32.acm 6.2.9200.16384
ACM Messenger Audio Codec 028E sirenacm.dll 15.4.3555.308
ACM Microsoft PCM Converter 0001
Dec 23, 2012 at 7:21 PM

interesting, there is no msaud32_divx.acm in that list. Can you try building your app targetting x64 and see what happens?

Dec 23, 2012 at 7:29 PM

It works now. It seems I have some cleaning up to do with the codecs I have installed. Thanks.

Dec 23, 2012 at 9:05 PM

What's the suggested action for the players of my game? Should I follow these steps?

Dec 23, 2012 at 10:57 PM

hi vaughands, what OS are you running on?

Dec 25, 2012 at 3:20 AM

Windows XP

Dec 25, 2012 at 7:47 PM

OK, use the NAudioDemo application to examine what ACM codecs you do have. XP usually comes with an MP3 decoder so I'm surprised you don't see one.


Dec 26, 2012 at 1:52 AM

This PC has one and I can assure you the demo application works to play a audio file. (I just tried). So I'm not sure why MY Mp3FileReader would crash on the same file. :(

Dec 26, 2012 at 8:17 AM

is your OS 64 bit and your app running as a 64 bit process by any chance?

Dec 27, 2012 at 3:08 AM

That's not the case, no. Sorry. It looks like it's failing in the try function.

Dec 27, 2012 at 8:18 AM

Well that is very strange - you are saying that NAudioDemo works, but your app with the exact same code doesn't? Are they both using the same version of NAudio?