MP3Sharp 1.0.4

Decode MP3 files to PCM bitstreams entirely in .NET managed code.

There is a newer version of this package available.
See the version list below for details.
Install-Package MP3Sharp -Version 1.0.4
dotnet add package MP3Sharp --version 1.0.4
<PackageReference Include="MP3Sharp" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MP3Sharp --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MP3Sharp

Decode MP3 files to PCM bitstreams entirely in .NET managed code:
<img align="center" src ="https://raw.githubusercontent.com/ZaneDubya/MP3Sharp/master/Images/MP3SharpHeader.png" />

SETUP

To use MP3Sharp, you will need: an audio device that accepts PCM data, an array of bytes to act as the PCM data buffer (default size is 4096 bytes), and a MP3 file. That's it!

The default interface to MP3Sharp is the MP3Stream class. An instance of MP3Stream takes a filepath to a MP3 file as a parameter and outputs PCM data:

// open the mp3 file.
MP3Stream stream = new MP3Stream(@"sample.mp3");
// Create the buffer.
byte[] buffer = new byte[4096];
// read the entire mp3 file.
int bytesReturned = 1;
int totalBytesRead = 0;
while (bytesReturned > 0)
{
    bytesReturned = stream.Read(buffer, 0, buffer.Length);
    totalBytesRead += bytesReturned;
}
// close the stream after we're done with it.
stream.Close();

So simple!

LICENSE

MP3Sharp is licensed under the LGPL Version 3.

CREDITS

MP3Sharp is a port of JavaLayer, a MP3 decoder written by JavaZoom and released under the LGPL. JavaLayer was initially ported to C# by Robert Burke, in what he modestly describes as a 'half day project'. tekHedd added some significant speed optimizations. I've spent a few weeks of evenings cleaning up the code and reducing redundancies throughout. The sample MP3 file used in this project is by BenSound, and is included under the terms of the Creative Commons - Attribution - No Derivative Works license.

FUTURE IMPROVEMENT

  • Many of the variables throughout the ported code are poorly named. I've done my best to clean them up, but don't know enough about the MP3 specification to suggest better names for most of them.
  • There is a large amount of dead code and variables that are assigned but never used, and thus significant area for improvement of decoding (using these variables properly) or optimization (removing them altogether).

MP3Sharp

Decode MP3 files to PCM bitstreams entirely in .NET managed code:
<img align="center" src ="https://raw.githubusercontent.com/ZaneDubya/MP3Sharp/master/Images/MP3SharpHeader.png" />

SETUP

To use MP3Sharp, you will need: an audio device that accepts PCM data, an array of bytes to act as the PCM data buffer (default size is 4096 bytes), and a MP3 file. That's it!

The default interface to MP3Sharp is the MP3Stream class. An instance of MP3Stream takes a filepath to a MP3 file as a parameter and outputs PCM data:

// open the mp3 file.
MP3Stream stream = new MP3Stream(@"sample.mp3");
// Create the buffer.
byte[] buffer = new byte[4096];
// read the entire mp3 file.
int bytesReturned = 1;
int totalBytesRead = 0;
while (bytesReturned > 0)
{
    bytesReturned = stream.Read(buffer, 0, buffer.Length);
    totalBytesRead += bytesReturned;
}
// close the stream after we're done with it.
stream.Close();

So simple!

LICENSE

MP3Sharp is licensed under the LGPL Version 3.

CREDITS

MP3Sharp is a port of JavaLayer, a MP3 decoder written by JavaZoom and released under the LGPL. JavaLayer was initially ported to C# by Robert Burke, in what he modestly describes as a 'half day project'. tekHedd added some significant speed optimizations. I've spent a few weeks of evenings cleaning up the code and reducing redundancies throughout. The sample MP3 file used in this project is by BenSound, and is included under the terms of the Creative Commons - Attribution - No Derivative Works license.

FUTURE IMPROVEMENT

  • Many of the variables throughout the ported code are poorly named. I've done my best to clean them up, but don't know enough about the MP3 specification to suggest better names for most of them.
  • There is a large amount of dead code and variables that are assigned but never used, and thus significant area for improvement of decoding (using these variables properly) or optimization (removing them altogether).

Release Notes

Merged upstream fix to index out of bounds error.

  • .NETStandard 2.0

    • No dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.5 237 8/16/2019
1.0.4 12,710 1/4/2018
1.0.3 710 8/14/2017
1.0.3-preview1 309 6/20/2017
1.0.2 367 6/7/2017
1.0.0 347 6/7/2017