Musepack Forums

Musepack Forums (https://forum.musepack.net/index.php)
-   Tech (https://forum.musepack.net/forumdisplay.php?f=7)
-   -   MPC replaygain data; how to covert peak from int16 to float? (https://forum.musepack.net/showthread.php?t=616)

DrTwox 23 January 2010 06:38 am

MPC replaygain data; how to covert peak from int16 to float?
 
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/S...playgainPacket

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)
Edit: Thanks to r2d for answering this over at the Hydrogen Audio forums: http://www.hydrogenaudio.org/forums/index.php?showtopic=78096&st=0&gopid=682791&#entry 682791


All times are GMT. The time now is 07:16 pm.

Powered by vBulletin® Version 3.8.11 Beta 2
Copyright ©2000 - 2019, vBulletin Solutions Inc.