tags:

views:

236

answers:

3

Since an MP3-File has no fixed bit depth like a PCM-Stream, a decoder (e.g. lame) must determine what bit depth to use when converting an mp3-stream into a PCM-Stream. Does it work by using a default value (propably 16) or is there any other way?

+1  A: 

It varies depending on the particular frame of compressed data. The decoder determines the resulting PCM stream's bit-depth.

Tullo
yes, but every frame may contain another bps-value and therefore may describe another possible bit depth. so the decoder must guess an overall bit depth, right?
schneck
It won't infer or "guess" based on the data, but will use a specific format for all decoding. Whether that is specified as a parameter for decoding, or determined via a default or pulled from the output stream (eg heading to the sound card) depends on the decoder.
Tullo
Incidentally, this is the reason that some media players allow you to specify the output bit-depth.
Tullo
this is what i wanted to know: if there is some general way or not - thanks.
schneck
A: 

I'm not familiar in-depth with MP3 format, but isn't it possible to decode to any bit depth you want? I mean you set the wanted value at the beginning and the decoding takes that into account, so you could decode to any bit depth you need.

rslite
right, i only need to know how e.g. lame does chooses the bit depth while decoding. by a default value or by any calculation.
schneck
A: 

The MP3 format [1], when decoded, does have a (sort of) fixed bit depth: floating point. If you are not satisfied with that, you should translate it to a linear integer format [1], with a size of your choosing (8, 16, or 24 bits usually). Since 16 bits is what the majority of sound cards can handle, that's what it is often decoded to.

More information: http://mp3decoders.org/24bit.html



[1] I'm extrapolating this from what I know about other formats. It may not hold true for MP3.
[2] Most decoder libraries can do this for you. If you try to do it yourself, don't forget to dither

hhaamu