This project has moved and is read-only. For the latest updates, please go here.

Why No MP3 License?

Feb 4, 2013 at 12:06 AM

First of all, thank you for this incredible library. My game would literally be lost without it, it'd likely end up relying on something like XACT instead.

I noticed on the forum that when the MP3 license is mentioned you've said that one isn't required. Why is that? I was under the impression that any use of the MP3 format required a license?

Your elaboration would be greatly appreciated as I'd rather not have to go to the lengths of adding Ogg Vorbis support.

Thanks muchly,

Punchbag Entertainment
Feb 4, 2013 at 10:58 AM
Windows comes with an MP3 decoder, which you are licensed to use already.

Feb 4, 2013 at 12:51 PM
Hi Mark,

That's great, thank you for coming back to me.

Kind Regards,

Feb 4, 2013 at 4:51 PM

A couple of points to consider, as well:

1) Ogg Vorbis support with NAudio is simple: NVorbis (specifically NVorbis.NAudioSupport). Also on NuGet. The usage is generally similar to Mp3FileReader.

2) If you are in the U.S., and this is a commercial project, MP3 might come with baggage you don't want. Specifically, you might need a license to distribute the encoded files - OR - might need to use a licensed encoder to get the distribution license. IANAL, so please check with an attorney if you want to make sure.

Performance differences between NVorbis and NAudio MP3 are hard to say offhand... NVorbis isn't native code, so it has some CLR overhead to deal with. NAudio MP3 is partially native code (all the expensive parts), but pays the P/Invoke "tax" for the privilege. NVorbis uses larger buffers, but NAudio MP3 has to use multiple buffers. Benchmarks will be your friend here.

If you choose to use Vorbis, I recommend using the latest version of the aoTuv encoder.

Good luck with your project!
Feb 4, 2013 at 9:43 PM
Hi ioctlLR,

Thanks for your advice! I have actually integrated NVorbis already (I melded the support it provides into AudioFileReader for consistency). Thanks for the encoder link, that'll no doubt come in very handy.

I've found that OggVorbis files are substantially slower to initialise, at least using NVorbis, and that they sometimes suffer a quality issue when I fade the volume in/out. I can work around the slower initialisation using an audio thread and pre-loading the files, but I don't suppose you have any advise regarding the volume quality issue? Currently as you can imagine from what I've described so far, I have the NVorbis VorbisStreamReader working the same way as an Mp3FileReader within the AudioFileReader class.

Kind Regards,

Feb 4, 2013 at 11:09 PM

Cool. That sounds like a nice little addition to NAudio.

The startup performance is a bit of a concern... Let's move this over to the NVorbis project so we don't pollute Mark's inbox with unrelated discussion... :)

Do you mind creating a bug report?
Feb 4, 2013 at 11:52 PM
Hi ioctlLR,

I have a feeling it was down to the file I was playing rather than anything else, since my own files are both decent quality and loading quickly :) I will skip over to NVorbis if I have any other issues though, at the moment I'm just working on getting my code to respect NVorbis better and to avoid spamming sfx, etc.

Cheers for your replies

May 20, 2014 at 7:24 PM
Hi Mark,
i m using Naudio to convert a Wav file to Mp3 with the following code. My concern is do i need a license for mp3 ?
using (var retMs = new MemoryStream())
        using (var ms = new MemoryStream(wavFile))
        using (var rdr = new WaveFileReader(ms))
            using (var conversionStream = WaveFormatConversionStream.CreatePcmStream(rdr))
                using (var wtr = new LameMP3FileWriter(retMs, conversionStream.WaveFormat, LAMEPreset.STANDARD))
                    return retMs.ToArray();
May 21, 2014 at 11:03 AM
Technically, yes, you are supposed to pay for a license if you sell commercial software that can create MP3s. One way some companies work around this is by asking users to download LAME themseleves
May 21, 2014 at 1:32 PM
Hi Mark,
thanks for your answer. Actually dont really sell anything, i m working on a company website which need to hear their customer service recordings. The recording are save in wav gsm 6.10 format. Clients will log in and hear those recordings. As wav file especially gsm 6.10 doesn't work with all browser, i want to convert the recordings in mp3 and then use JPlayer to play them. Therefore i was wondering if there is any legal concerns.

May 21, 2014 at 1:37 PM
IANAL, but here's my take on the license:

If you are writing it for your employer to use and no one outside your employer will access it, you do not need a license. Otherwise, you probably do.