Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WMP and ReplayGain? (Read 3984 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WMP and ReplayGain?

If you are Sacher-Masoch fan, continue reading, though I'll be gentle

I share part of my library with WMP user.
I've never used WMP and was a bit surprised that it can't understand ReplayGain, not even with addition plugin or tweak or Google tip. Naively I thought to investigate, despite above.

I learned that WMP uses normalizer (if set by user) and writes AverageLevel (AL) and PeakValue in private tag frame, in some circumstances (files needs to be in Library and in MP3 or WMA format).
As I couldn't find any reference how WMP calculates this numbers so that I could potentially deduce it from RG value, I went to manual data analysis of 6 albums: output from RG processed files by foobar, and output by WMP 11 with enabled Auto Volume Leveling, considering calculated RG by foobar and AL by WMP.

PeakValue is simple normalized peak times 32768

AverageLevel (AL) values are quantized with 256 units step. Comparing both data, with mission to tell WMP to output audio at same volume level as foobar, I came to this approximate equation:

RG = 18*log(AL-123) - 66

inverting to:

AL = 123 + 4742*10^(-RG/18)

and there is a limit, AL can't be lower than 1147 (= 2^10 + 123) which according above formula for RG is -11.81 dB


Now I needed to test and put those values in files, which was a bigger problem. Neither foobar nor Mp3tag (or other utils I'm aware of) can read this WMP tags, not mentioning writing it to file. Only tagger that can read and write this info is Kid3. However I couldn't find a way to automate it, and made vbscript around wmenceng.dll (can be extracted with 7zip from Windows Media Encoder 9 Series setup) and id3com.dll (its listed by Google): http://db.tt/GcC3dnM3
Script expects path to MP3/WMA file and it will write AverageLevel and PeakValue calculated from present ReplayGain tag values to passed files (for MP3 in known ID3v2.3 scheme and iso-8859-1 encoding)

But as soon as file with AL tag is played through WMP, if the value is not in WMP database (was imported in Library baked) then WMP is re-calculating again on the fly while playing afterwhich it rewrites database with it's calculated value, suggesting that programmatically accessing WMP database maybe should have been my next step, but I wasn't insane enough to check if it would not rewrite again

If you can't install new software to some PC node for whatever reason and want built in Windows player to obey RG, only reasonable approach seems to me mp3gain, which uses former RG algorithm, and changes MP3 level to only one RG mode, although reversibly