This software is not provided or supported by MediaMonkey, Ventis Media Inc. or any of their associates, Sonos Inc. or any of theirs nor Apple Inc. for iTunes. It has been created by a customer of all for their own use. Please see the copyright notice and terms below.

The problems

When processing ReplayGain, Sonos supports WMP tags for WMA & MP3 files, iTunes tags for AAC & MP3 files and the standard tags for Flac files. It only supports "Track Gain" (and, as I have discovered by experiment, only supports negative values, so it will lower the volume but not raise it). Some of these problems are unsolvable but what I most wanted was "Album Gain" on Flac and MP3 files so that the dynamics of an entire album would be consistent (known as audiophile mode) and for MP3 files to honour the settings at all. So what I needed was a method to write either iTunes or WMP type tags based on the MediaMonkey database values. The first pass was a MediaMonkey script that first saves the "Track Gain" in a custom field for safety then copies the "Volume Gain" to the "Track Gain" field to fool the player into supporting audiophile mode. This was only effective on FLAC files, because those were the only ones for which Sonos read the MediaMonkey ReplayGain tags. To do the rest of the job I needed to get MediaMonkey to write iTunNORM tags. This required a separate (binary) program.

A correspondent had a related problem with loading an iPod. He wished to create the iTunNORM tag for the iPod to interpret but wished to also retain the ReplayGain tags (both Track and Album) for other systems to use. This only applies to MP3 files. To this end I provided the separate script iTunesReplayGain. It also provides the useful ability to remove the iTunNORM (SoundCheck) tag and also to read existing iTunNORM tags for diagnostic purposes.

Installing the program

There are three parts to the program—scripts "Menu_SonosReplayGain.vbs" & Menu_iTunesReplayGain and an executable "mp3rg2sc.exe". The latter is only needed if you want to work with MP3 files and it can also be run standalone from the command line. A Mac version of this program is also provided for stanaalone use.

Firstly, stop MediaMonkey then unzip the downloaded file into "C:\Program Files\MediaMonkey\Scripts\Auto\". On Windows 7 systems and above this will be "C:\Program Files (x86)\MediaMonkey\Scripts\Auto\". I am not sure about Vista. You will need to be an administrator on your system to do this. If you don't have WinZip just open the zip file as if it was a folder and copy the files out. There three extra files in here—"mp3rg2sc.c" which is the source code for the executable and not necesary for operation, mp3rg2sc (no extension) which is a Mac/Intel binary of the same program and sonosreplaygain.htm - a copy of this documentation.

Once you have done this you can start MediaMonkey again and it will pick up the new files..

Using the system

In MediaMonkey, in the Tools menu and in the right click context menu on tracks you will find a new tab—Sonos ReplayGain. Under there you will find

In MediaMonkey, in the Tools menu and in the right-click context menu on tracks you will also find a new tab—iTunes ReplayGain. Under there you will find

Only the last option in iTunes ReplayGain changes any value in the MediaMonkey database.

Note 1: Analyze Volume (NOT Level Track Volume) must be run prior to using these tools, otherwise there is no data for it to work with. If you wish to use Album Volumes then the option "Player / Volume Leveling / When analyzing Track volume, also analyze Album volume" must also be set and whole albums Analyzed is one operation.

Note 2: Sonos ReplayGain uses MediaMonkey "Custom4" database field, overwriting it without warning. If you are using this for something else then this can be changed to another Custom field by editing the VBS script.

Note 3: If you wish to set the Sonos gain to an offset from that calculated by the Analyze Volume function, a facility is made in the script to allow this. Edit the script in the two places where you see the phrase "Optional gain adjustment". You may wish to do this to allow Sonos some headroom to make upward as well as downwards adjustments but you would have to do it consistetly across the whole library.

Note 4: Any previous iTunNORM settings such as may be applied by iTunes are overwritten by both scripts without warning and are not saved.

Note 5: iTunes ReplayGain options "Read SoundCheck" and "Clear SoundCheck" use MediaMonkey "Custom2" database field, overwriting it without warning. If you are using this for something else then this can be changed to another Custom field by editing the VBS script.

Note 6: The actual value recovered by Read SoundCheck is the first Left Channel value in the tag. In practice the Left and Right values are the same or very similar. There is some loss of precision due to the way the values are processed but it is right to two inaudible decimal places.

If you want to run mp3rg2sc.exe standalone on either Windows or MacOS it takes a single argument—the MP3 file name and the following switches

To conform to Windows standards the "/" character can be used instead of the unix style "-" character for switches.

mp3rg2sc does not change any values in the MediaMonkey database or anything else in the song files.

Known bugs and limitations

Contact information can be found on my Home Page.

Copyright ©2013–17 Rick Parsons, Bristol, England except those things that belong to MediaMonkey. Ventis Media Inc, Sonos Inc & Apple Inc. including their respective trademarks.

This software is published Open Source Freeware. You are free to use the programs either in full or part without charge. I would ask however that this notice is included with any extract or onward distribution.

No charge may be made for the use of this code, however there is no objection to including modest extracts (with acknowledgement) in otherwise commercial software.

No warranty is given or implied by the use of the software which you do at your own risk. No compensation can be considered regarding damage to data, computers or any thing else arising as a result of using these programs.

Download

I try to keep my system virus free but you do check downloaded files yourself, don’t you? <grin>

The zip file contains the full source code and executables for MS-DOS/Windows.

5 Feb 2017—Version 2.6a for MediaMonkey 4.1

SonosReplayGain.zip (45K)

Release Notes

V2.6a—Revised mp3rg2sc program to erase incorrect and duplicate iTunNORM & xTunNORM frames

V2.6—Refine & bug fix Read SoundCheck and Clear SoundCheck options

V2.5—Implement Read SoundCheck option

V2.4—Allow for file names containing '.'. Affects mp3rg2sc only. (Thanks Igor for spotting this)

V2.3—Add iTunes ReplayGain and considerably improve the logic so that files can be updated in bulk without halting at the first hint of trouble.

V2.2—Fix the binary to accept any case for the file extension.

V2.1—Fix a minor error in the script and a more major one in the binary which failed with long file names (over 63 characters).

V2.0—It now supports MP3 files using the mp3rg2sc.exe program.

V1.0—For FLAC files using the script only.

Note that the binary program has its own separate version number.