I've got this code
static void Main(string[] args)
{
try
{
Mp3FileReader reader = new Mp3FileReader(@"C:\testAudio.mp3");
long count = reader.Length;
if (count <= int.MaxValue)
{
byte[] info = new byte[count];
reader.Read(info, 0, (int)count);
Console.WriteLine("Succesfull read");
}
else
Console.WriteLine("Could not read");
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
that prints out the following exception message
System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at NAudio.Wave.AcmMp3FrameDecompressor.DecompressFrame(Mp3Frame frame, Byte[] dest, Int32 destOffset) in C:\NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50
at NAudio.Wave.Mp3FileReader.Read(Byte[] sampleBuffer, Int32 offset, Int32 numBytes) in C:\NAudio-Source\NAudio\Wave\WaveStreams\Mp3FileReader.cs:line 338
at Tester.Program.Main(String[] args) in C:\Tester\Program.cs:line 30
I've dowloaded NAudio code and I've been debugging it but I can't find the cause of the error, although, as you can see on the stack trace is in *NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50*
¿Am I doing something wrong? By the way, it only happens with a few mp3 files, others are read just fine. I'm attaching one of the files that can't be read
Thanx
Comments: hi, no active development, but the MP3 file you uploaded contains a frame at a different sample rate, which is something NAudio currently cannot handle
static void Main(string[] args)
{
try
{
Mp3FileReader reader = new Mp3FileReader(@"C:\testAudio.mp3");
long count = reader.Length;
if (count <= int.MaxValue)
{
byte[] info = new byte[count];
reader.Read(info, 0, (int)count);
Console.WriteLine("Succesfull read");
}
else
Console.WriteLine("Could not read");
}
catch(Exception ex)
{
Console.WriteLine(ex);
}
}
that prints out the following exception message
System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at NAudio.Wave.AcmMp3FrameDecompressor.DecompressFrame(Mp3Frame frame, Byte[] dest, Int32 destOffset) in C:\NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50
at NAudio.Wave.Mp3FileReader.Read(Byte[] sampleBuffer, Int32 offset, Int32 numBytes) in C:\NAudio-Source\NAudio\Wave\WaveStreams\Mp3FileReader.cs:line 338
at Tester.Program.Main(String[] args) in C:\Tester\Program.cs:line 30
I've dowloaded NAudio code and I've been debugging it but I can't find the cause of the error, although, as you can see on the stack trace is in *NAudio-Source\NAudio\FileFormats\Mp3\Mp3FrameDecompressor.cs:line 50*
¿Am I doing something wrong? By the way, it only happens with a few mp3 files, others are read just fine. I'm attaching one of the files that can't be read
Thanx
Comments: hi, no active development, but the MP3 file you uploaded contains a frame at a different sample rate, which is something NAudio currently cannot handle