### Notice

If you are using a Hotmail or Outlook email address, please change it now, as Microsoft is rejecting all email from our service outright.
Topic: MPC replaygain data; how to covert peak from dB to float? (Read 8106 times)
0 Members and 1 Guest are viewing this topic.

## MPC replaygain data; how to covert peak from dB to float?

##### 2010-01-23 06:07:50
Hi all,

I'm seeking some help with replaygain and musepack files...

MPC stores the peak level as a 16 bit integer representing the loudness. How do I convert this value to a 32 bit float? e.g. A peak value of 23225 (read from the .mpc file) shows as a peak of 1.048776 in foobar; what's the calculation to go from one to the other?

I've read the specs, but it might as well be in another language!
http://trac.musepack.net/trac/wiki/SV8Spec...eplaygainPacket
Quote
Replay gain finds that this title has a loudness of 78.56 dB. It will be encoded as 78.56 * 256 ~ 20111 = 0x4E8

For float output (range [-1 1]), the max is 0.96. It will be encoded as 20 * log10(0.96 * 215) * 256 ~ 23029 = 0x59F5 (for peak values it is suggested to round to nearest higher integer)

## MPC replaygain data; how to covert peak from dB to float?

##### Reply #1 – 2010-01-23 21:43:24
e.g. A peak value of 23225 (read from the .mpc file) shows as a peak of 1.048776 in foobar; what's the calculation to go from one to the other?

20 * log10(1.048776 * 2^15) * 256 = 23225

10^(23225/(20*256)) / 2^15 = 1,04877633098761506451

with ^ the power operator, so 2^15 = 32768

## MPC replaygain data; how to covert peak from dB to float?

##### Reply #2 – 2010-01-24 01:34:57
Awesome! Thank you for the help.