So, this might be a little out of date but I have just read this article and it seems to be what I was looking for.
I am intending on using the fb2k RG scanner to tag all my music with the four RG tags and then convert these to the iTunes 'COMMENT iTunNorm' using $rg2sc. Nothing particularly special so far.
I wanted, however, to increase the REPLAYGAIN_TRACK_GAIN values by 3dB and send these to $rg2sc, so something like,
$rg2sc(%REPLAYGAIN_TRACK_GAIN%+3.00)
This is to overcome the problem I have seen elsewhere when the 89dB SPL is just a little too low for iProducts. Since the original RG tag is designed for RG compliant devices (which should have a pre-amp feature to boost quiet outputs as in fb2k) I see no need to actually add 3dB to the RG tag. This avoids the tag re-ordering problem mentioned above.
All good so far,
I might have spotted a small problem though. I was going to use the action from DetlevD earlier to create a intermediate tag that I send to $rg2sc.
The code was,
$div($add(+600,$replace(%replaygain_track_gain%,'.',)),100)'.'$num($replace($mod($add(+600,$replace(%replaygain_track_gain%,'.',)),100),'-',),2)' dB'
This does work for the examples given but breaks for a specific case when the original gain is -6.xx dB. In this case the first part of the equation would go something like,
-6.51 dB : Start
-651 : Remove decimal point
-51 : Add 600
0 : Divide by 100
Notice the '-' (negative) sign has gone now. The second part of the equation will always be positive and so the output becomes positive. I get 0.50 dB, I should have -0.50.
Also when the RG value becomes positive there is no '+' (positive) symbol prepended which I think is needed. This missing '+' might explain the change in overall tag size? Not sure.
So finally I propose the action below to add an offset of RG gains whilst keeping the exact format written by fb2k.
[$ifgreater($add(+300,$replace(%RGTRACKPLUS1%,'.',)),0,'+','-')$replace($div($add(+300,$replace(%RGTRACKPLUS1%,'.',)),100),'-',)'.'$num($replace($mod($add(+300,$replace(%RGTRACKPLUS1%,'.',)),100),'-',),2)' dB']
(Note: the %RGTRACKPLUS1% tag can be swapped for either %REPLAYGAIN_ALBUM_GAIN% or %REPLAYGAIN_TRACK_GAIN%. I create the tag %RGTRACKPLUS1% automatically to be the track gain unless not available in which case use the album gain.)
The output of this can then be fed into $rg2sc and so create the iTunNorm tags with an offset from the RG tags. Obviously the offset can be changed by replacing 300 (for 3dB) with 600 (for 6dB) or what ever you fancy.
I have tried this on a few tracks and the results I get by manually adding 3dB to the REPLAYGAIN_TRACK_GAIN then running $rg2sc match those I get by adding 3dB with the code above. Also if I use the code to directly overwrite the REPLAYGAIN_TRACK_GAIN all of the tags are recognised immediately in fb2k and winamp. A small note is that it sometimes takes winamp a little while before the track gain is updated in the 'Basic Info' tab but it is always correct and up-to-date in the 'ID3v2' tab.
Let me know what you think because I'm going to run this through my collection soon and don't want to get it wrong.
Thanks