Export MP3 in float

This read-only archive contains discussions from the Adding Feature forum.
New feature request may be posted to the Adding Feature forum.
Technical support is available via the Help forum.
Luke M
Posts: 16
Joined: Wed May 27, 2015 6:26 pm
Operating System: Please select

Export MP3 in float

Post by Luke M » Wed May 27, 2015 6:53 pm

I realize it doesn't make a big difference, but why not export MP3 in float instead of 16-bit? In most cases this will avoid a needless conversion to 16-bit and back to float (LAME uses float internally).

Perhaps very old versions of LAME didn't have float APIs? Worst case, somebody has to download a more recent version, which they should do anyway.

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Export MP3 in float

Post by kozikowski » Wed May 27, 2015 7:29 pm

I'm betting the legacy 1995 format of MPEG-1, Layer 3 didn't have float. So to make a default exported MP3 play on the maximum number of players, 16 bit is the shining path.

Everything inside Audacity is 32-floating anyway, so unless you shot it that way and turn all the dithering off, you're going to go through conversions.

Koz

kozikowski
Forum Staff
Posts: 69357
Joined: Thu Aug 02, 2007 5:57 pm
Operating System: macOS 10.13 High Sierra

Re: Export MP3 in float

Post by kozikowski » Wed May 27, 2015 7:31 pm

Similarly, Broadcast WAV has many more tricks than regular, Microsoft WAV, so we should all use that instead.
Koz

steve
Site Admin
Posts: 81609
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: Export MP3 in float

Post by steve » Wed May 27, 2015 7:54 pm

MP3 does not have "bit depth" in the same way that uncompressed PCM audio does.
As far as I'm aware, the "numbers" in an MP3 file are floating point numbers, but these do not correspond directly to sample values. The bit depth of the decoded MP3 file depends on the decoder. Almost all MP3 decoders decode to 16 bit (just a couple that decode to 24 bit and there is hot debate as to whether 24 bit decoding has any practical benefits).
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Robert J. H.
Posts: 3633
Joined: Thu May 31, 2012 8:33 am
Operating System: Windows 10

Re: Export MP3 in float

Post by Robert J. H. » Thu May 28, 2015 1:17 am

steve wrote:MP3 does not have "bit depth" in the same way that uncompressed PCM audio does.
As far as I'm aware, the "numbers" in an MP3 file are floating point numbers, but these do not correspond directly to sample values. The bit depth of the decoded MP3 file depends on the decoder. Almost all MP3 decoders decode to 16 bit (just a couple that decode to 24 bit and there is hot debate as to whether 24 bit decoding has any practical benefits).
Actually, they decode to 29 bit, or to be more precise, to 14.5 bit.

Luke M
Posts: 16
Joined: Wed May 27, 2015 6:26 pm
Operating System: Please select

Re: Export MP3 in float

Post by Luke M » Thu May 28, 2015 8:54 pm

This has nothing to do with the MP3 format, it's about the LAME API and how Audacity uses it.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Export MP3 in float

Post by Gale Andrews » Fri May 29, 2015 4:36 pm

Luke M wrote:I realize it doesn't make a big difference, but why not export MP3 in float instead of 16-bit?
Just to touch bases, where are you getting the information that the Audacity exported MP3 has 16-bit values?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Luke M
Posts: 16
Joined: Wed May 27, 2015 6:26 pm
Operating System: Please select

Re: Export MP3 in float

Post by Luke M » Fri May 29, 2015 7:53 pm

Gale Andrews wrote:
Luke M wrote:I realize it doesn't make a big difference, but why not export MP3 in float instead of 16-bit?
Just to touch bases, where are you getting the information that the Audacity exported MP3 has 16-bit values?
https://code.google.com/p/audacity/sour ... ortMP3.cpp

(You can see it's calling lame_encode_buffer_interleaved, which takes 16-bit PCM. The float version would be lame_encode_buffer_interleaved_ieee_float).

Let me know if this is the wrong place to browse the Audacity source code.

Again, not a serious problem...just something that isn't ideal.

Gale Andrews
Quality Assurance
Posts: 41761
Joined: Fri Jul 27, 2007 12:02 am
Operating System: Windows 10

Re: Export MP3 in float

Post by Gale Andrews » Sat May 30, 2015 11:51 am

Luke M wrote:
Gale Andrews wrote:
Luke M wrote:I realize it doesn't make a big difference, but why not export MP3 in float instead of 16-bit?
Just to touch bases, where are you getting the information that the Audacity exported MP3 has 16-bit values?
https://code.google.com/p/audacity/sour ... ortMP3.cpp

(You can see it's calling lame_encode_buffer_interleaved, which takes 16-bit PCM. The float version would be lame_encode_buffer_interleaved_ieee_float).

Let me know if this is the wrong place to browse the Audacity source code.
The code has not changed with reference to your point, but we've moved to Git so the correct location is now https://github.com/audacity/audacity/bl ... ortMP3.cpp.

Can you point for comparison to an MP3 encoder that uses float versions of lame_encode_buffer?


Gale
________________________________________FOR INSTANT HELP: (Click on Link below)
* * * * * Tips * * * * * Tutorials * * * * * Quick Start Guide * * * * * Audacity Manual

Luke M
Posts: 16
Joined: Wed May 27, 2015 6:26 pm
Operating System: Please select

Re: Export MP3 in float

Post by Luke M » Sat May 30, 2015 11:06 pm

Gale Andrews wrote:
Luke M wrote:
Gale Andrews wrote:
Luke M wrote:I realize it doesn't make a big difference, but why not export MP3 in float instead of 16-bit?
Just to touch bases, where are you getting the information that the Audacity exported MP3 has 16-bit values?
https://code.google.com/p/audacity/sour ... ortMP3.cpp

(You can see it's calling lame_encode_buffer_interleaved, which takes 16-bit PCM. The float version would be lame_encode_buffer_interleaved_ieee_float).

Let me know if this is the wrong place to browse the Audacity source code.
The code has not changed with reference to your point, but we've moved to Git so the correct location is now https://github.com/audacity/audacity/bl ... ortMP3.cpp.
Thanks.
Gale Andrews wrote:Can you point for comparison to an MP3 encoder that uses float versions of lame_encode_buffer?
Good question. I *assumed* that the standard LAME front end did, but no! It doesn't. So I don't know, maybe it would be a world first.

Locked