Not a recognised MP3 block

Apr 8, 2010 at 9:11 AM

Hi everybody,

I'm currently trying to read a mp3 from a Memory Stream using NAudio, but I'm steel getting the same error "Not a recognised MP3 block".

For information the MemoryStream is written with a buffer of byte, and this buffer is built using .net Remoting ( the mp3 is on a server ); The method 

remoteOperation.getMusic() is perfectly working, and return bytes of the mp3 file.

I've tried to read with 4 different MP3 files, and same result, but when i tried to read a WAV file using a stream and SoundPlayer it's works.

 

This is my code :

 

byte[] bufferReception = remoteOperation.getMusic(lbMusicList.SelectedItem.ToString());

Stream ms = new MemoryStream();
 ms.Write(bufferReception, 0, bufferReception.Length);
 ms.Position = 0;

 WaveStream ws = new BlockAlignReductionStream( WaveFormatConversionStream.CreatePcmStream(new Mp3FileReader(ms))); // this instruction show error

 WaveOut sortie = new WaveOut(); sortie.Init(ws);
 sortie.Play(); 


I'm sorry for my bad English, i'm french...

In advance, thank you.

 

 

Apr 8, 2010 at 2:24 PM

A little answer, the code was true but the 4 MP3 files was wrong, it's perfectly working.

Coordinator
Apr 8, 2010 at 2:26 PM

glad you have it working now

Mark