Here's a C#
port of
JavaLayer,
an MP3 decoder for Java written by the
JavaZoom team. Hopefully it will be useful to other people who
want to decode Mp3s in .NET managed code. I've tested it with a
variety of MP3s and - props to the JavaZoom team! - it seems to do the trick.
Update 25 Feb 04: This page was getting a bunch of traffic, so
I took another bit of time to change the interface to the Mp3Sharp
assembly to a
single class, Mp3Sharp.Mp3Stream, which derives from
System.IO.Stream, and provides the decoded data as a 16-bit stereo,
PCM-encoded bytestream. I also wrote a sample, using
Managed
DirectSound 9.0b, that shows how to play a streaming MP3 file. Hopefully
that will be helpful for people getting started.
I used Beta2 of the
Java Language Conversion Assistant as a starting point for this
project, and spent the rest of the day cleaning up after it. There
were some bizarre bit-shifting bugs introduced by the JLCA that I
corrected. I also removed the dependency on serialized files.
Honestly, this was a
half-day project that's taken on a life of its own, so please forgive the state of the code.
But I welcome
comments, requests,
suggestions and contributions.
Download Mp3Sharp: C# Port of JavaLayer
Note: Mp3Sharp is released under the LGPL. Go nuts.