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

AcmNotPossible

Jun 16, 2011 at 10:18 PM
Edited Jun 16, 2011 at 11:21 PM

I'm working on an MP3 streaming project to stream audio from Subsonic (www.subsonic.org). The following URL is the stream URL for a specific song:

[removed]

 

After playing with the code I wrote for several days I decided to downoad the NAudioDemo and try to stream the MP3 with the Demo application. In both the NAudioDemo AND my application I am getting the following error.

 

NAudio.MmException: AcmNotPossible calling acmStreamConvert

 

Here is the code I wrote to test in my own application:

 

_memoryStream = new MemoryStream();
            
using (Stream stream = SubsonicRequest.GetSongStream(song))
{
    byte[] buffer = new byte[32768];
    int read;
    while ((read = stream.Read(buffer, 0, buffer.Length)) > 0)
    {
        _memoryStream.Write(buffer, 0, read);
    }
}
_memoryStream.Position = 0;

_waveStream = new BlockAlignReductionStream(
    WaveFormatConversionStream.CreatePcmStream(
        new Mp3FileReader(_memoryStream)));

_waveOut = new WaveOut(WaveCallbackInfo.FunctionCallback());
_waveOut.Init(_waveStream);
_waveOut.Play();

 

 

I have googled for days and I can't find anything that will give me an accurate answer. Thanks in advance for any help.

Jun 16, 2011 at 10:25 PM

Are you using the latest NAudio? In that case you just need to set _waveStream = Mp3FileReader(_memoryStream);

Mark

Jun 16, 2011 at 10:27 PM

I tried that also. I got the same error message.

Jun 16, 2011 at 10:28 PM
Edited Jun 16, 2011 at 10:28 PM

StackTrace:

at NAudio.Wave.Compression.AcmStreamHeader.Convert(Int32 bytesToConvertref Int32 sourceBytesConverted)
at NAudio.Wave.Compression.AcmStream.Convert(Int32 bytesToConvertref Int32 sourceBytesConverted)
at NAudio.Wave.AcmMp3FrameDecompressor.DecompressFrame(Mp3Frame frameByte[] destInt32 destOffset)
at NAudio.Wave.Mp3FileReader.Read(Byte[] sampleBufferInt32 offsetInt32 numBytes)
at NAudio.Wave.WaveOutBuffer.OnDone()
at NAudio.Wave.WaveOut.Play()

Jun 16, 2011 at 10:34 PM

OK, that's quite an unusual MP3 file - it is encoded at 24kHz. I'll download the file, and see if I can come up with a way to decompress it with the Windows ACM codec.

Mark

Jun 16, 2011 at 10:35 PM
Edited Jun 16, 2011 at 10:41 PM

Okay thank you very much.

Jun 16, 2011 at 11:01 PM

OK I've found the problem - it's not MP3, it's MP4. NAudio can't decode MP4 at the moment (something I want to add for NAudio 1.6)

Mark

Jun 16, 2011 at 11:12 PM

That's weird because Subsonic is supposed to transcode this into MP3...I guess it's an issue with my Subsonic server. Thanks for the info and sorry about that.

Jun 16, 2011 at 11:14 PM

no problem. liked the song by the way ;)

Jun 16, 2011 at 11:20 PM

Yeah, just tried with another music file and it worked...sorry about that. My own stupid fault lol.

 

Thanks for your help.

Jun 16, 2011 at 11:22 PM
markheath wrote:

no problem. liked the song by the way ;)

Thanks lol.