An MP3 decoder written in VB

I cannot keep track of the number of times I needed an easy way to decode an MP3 file from a .NET program.
Sure there are many libraries available and sure there are many ways you can do it but I just wish I could do it natively (with managed code) and have complete control over the decoding process.

Well, I guess that’s why I created the CMP3Decoder class, a .NET VB wrapper that encapsulates a native MP3 decoder, also written in VB, and provides an abstraction layer to facilitate the decoding process.

This is a very old project since the first version was written for VB6 and although it worked, the code was so damn slow that it was unusable for a real-time MP3 player.
The MP3 decoding stuff is a port from Krister Lagerström‘s C version of the decoder and it was initially ported to VB6 by Murphy McCauley from http://www.constantthought.com/

MP3Player.NET

An MP3 decoding class for .NET

When Visual Studio 2003 was released I started porting (that is, re-creating by hand) most of my VB6 projects to VB.NET and this was one of them.
As the language matured I started to optimize the code up to the point where the decoder is now able to run without any considerable impact on the CPU. In simpler words, it runs pretty fast.

The quality of the decoded audio is not very good but for basic purposes it does its job and its a nice proof of concept project.

Update (9/2/2012): The library has been updated so that it no longer depends on DirectX’s SDK, instead it relies on the amazing SlimDX library.

Feel free to grab the source code for this project from this link:
[download id=”3″ format=”1″]