Sorry to complain, but I did demonstrate by the picture in my previous post, that the given formula works without error.
So please give a detailed hint, what is wrong with the formula, maybe I am currently blind to see it.
Be aware of the integer math and the string related scripting language used in Mp3tag.
From:
2.02 dB
-2.78 dB
-6.51 dB
To:
8.02 dB
3.22 dB
-0.51 dB
To adapt the formula to your needs, replace all text strings '+600' within the above example formatstring with your special value (three replaces).
For example ...
'+450' ... represents +4.50 dB
'-450' ... represents -4.50 dB
Better to create an action group ...
and adapt only once the modifier value for the tag-field RGTG_MODIFIER within the group's action #1.
Begin Action Group RGTG.Modify
Action #1 Actiontype 5: Format value Field ______: RGTG_MODIFIER Formatstring: +600
Action #2 Actiontype 5: Format value Field ______: REPLAYGAIN_TRACK_GAIN Formatstring: $replace($if($less($add($num($replace(%replaygain_track_gain%,'.',),1),%RGTG_MODIFIER%),0),'-',)$replace($div($add(%RGTG_MODIFIER%,$replace(%replaygain_track_gain%,'.',)),100),'-',)'.'$num($replace($mod($add(%RGTG_MODIFIER%,$replace(%replaygain_track_gain%,'.',)),100),'-',),2),'--','-')'÷dB'
Add or subtract negative or positive value to REPLAYGAIN_TRACK_GAIN value or REPLAYGAIN_ALBUM_GAIN value.
Here are two action groups, which perhaps are easier to read and to understand how the process of adding or subtracting of a value works, than an endless Mp3tag one line tape worm scripting expression.
The modifier value (numeric string with leading +/- sign character), for example +600 (represents +6 dB) or -450 (represents -4.5 dB) or whatever value is allowed by the ReplayGain method, can be set in the first action from each action group.
Each action group takes care and tries to store the group of four ReplayGain values in the same order into the media file as it might be expected by other ReplayGain ready applications.
Above in this thread read about the behaviour of WinAmp when the order of the ReplayGain tag-fields is disarranged.
Begin Action Group RG#ReplayGainTrackGain.Modify
Action #1 Actiontype 5: Format value Field ______: RGTG_MODIFIER Formatstring: +600
Action #2 Actiontype 5: Format value Field ______: RGTG_TEMP Formatstring: %REPLAYGAIN_TRACK_GAIN%
Action #3 Actiontype 5: Format value Field ______: RGTG_TEMP Formatstring: $num($replace(%RGTG_TEMP%,'.',),1)
Action #4 Actiontype 5: Format value Field ______: RGTG_TEMP Formatstring: $add(%RGTG_TEMP%,%RGTG_MODIFIER%)
Action #5 Actiontype 5: Format value Field ______: RGTG_SIGN Formatstring: $if($less(%RGTG_TEMP%,0),'-',)
Action #6 Actiontype 5: Format value Field ______: RGTG_TEMP Formatstring: $trimLeft(%RGTG_TEMP%,'-')
Action #7 Actiontype 5: Format value Field ______: RGTG_TEMP Formatstring: $div(%RGTG_TEMP%,100)'.'$num($mod(%RGTG_TEMP%,100),2)
Action #8 Actiontype 5: Format value Field ______: REPLAYGAIN_TRACK_GAIN Formatstring: %RGTG_SIGN%%RGTG_TEMP%'÷dB'
I was so happy to find DetlevD's replay gain Action above, RG_ReplayGainTrackGain.Modify.mta. It works perfectly and it saves me a tremendous amount of work.
Anyway, I have one minor addition. After using this action to modify large numbers of files, I had trouble remembering or seeing which files I had modified, after the fact. So I added a short action at the end of Detlev's actions which adds a code at the end of each comment tag. My code is "RPG+4", signifying a 4 dB boost to the previous track replay gain values, but you could use any convenient code. Previous content in the comment tag is left undisturbed. My Action is:
Action #13 Actiontype 5:Format value Field_______:COMMENT Format String:%comment%$char(13)$char(10)RPG+4
With "RPG+4" embedded in files, I can now use a simple view filter to detect files that have not yet had their replay gain values modified:
NOT %comment% HAS "RPG+4"
I thought about creating a custom tag to hold the code but that seemed like overkill.
If you add the extra bit with a line break at the end, then it could lead to suprises if you export that data as CSV or a similar format that expects data to be a single line. Either you take care of that during export or you use a different separator straight away. Or you leave it like that as it is no problem for you.
Thanks for the suggestion, ohrenkino. I never export comments but others may well. Using a space character as separator should work fine here. I added the line break to make the code easier to spot.