Add Album Volume Increase via Replay Gain Tag

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.

This works for me ...


Hmm ... got it!
-6.51 + 6 must be negatve and should be -0.51.
I will have a look into the maths.

DD.20120202.1808.CET


Add or subtract negative or positive value to REPLAYGAIN_TRACK_GAIN value or REPLAYGAIN_ALBUM_GAIN value.

For example ... add + 6dB to the existing value in the tag-field REPLAYGAIN_TRACK_GAIN.

Action: Format value
Field: REPLAYGAIN_TRACK_GAIN
Formatstring:

$replace($if($less($add($num($replace(%replaygain_track_gain%,'.',),1),'+600'),0),'-',)$replace($div($add('+600',$replace(%replaygain_track_gain%,'.',)),100),'-',)'.'$num($replace($mod($add('+600',$replace(%replaygain_track_gain%,'.',)),100),'-',),2),'--','-')' dB'

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'

Action #3
Actiontype 9: Remove fields
Fields to remove (semicolon separated): RGTG_MODIFIER

Note: Replace each special ÷ character with one space character.
End Action Group RGTG.Modify (3 Actions)

DD.20120202.2102.CET

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'

Action #9
Actiontype 9: Remove fields
Fields to remove (semicolon separated): RGTG_TEMP;RGTG_SIGN;RGTG_MODIFIER

Action #10
Actiontype 5: Format value
Field ______: REPLAYGAIN_ALBUM_GAIN
Formatstring: %REPLAYGAIN_ALBUM_GAIN%

Action #11
Actiontype 5: Format value
Field ______: REPLAYGAIN_ALBUM_PEAK
Formatstring: %REPLAYGAIN_ALBUM_PEAK%

Action #12
Actiontype 5: Format value
Field ______: REPLAYGAIN_TRACK_GAIN
Formatstring: %REPLAYGAIN_TRACK_GAIN%

Action #13
Actiontype 5: Format value
Field ______: REPLAYGAIN_TRACK_PEAK
Formatstring: %REPLAYGAIN_TRACK_PEAK%

Note: Replace each special ÷ character with one space character.
End Action Group RG#ReplayGainTrackGain.Modify (13 Actions)

Begin Action Group RG#ReplayGainAlbumGain.Modify

Action #1
Actiontype 5: Format value
Field ______: RGAG_MODIFIER
Formatstring: +600

Action #2
Actiontype 5: Format value
Field ______: RGAG_TEMP
Formatstring: %REPLAYGAIN_ALBUM_GAIN%

Action #3
Actiontype 5: Format value
Field ______: RGAG_TEMP
Formatstring: $num($replace(%RGAG_TEMP%,'.',),1)

Action #4
Actiontype 5: Format value
Field ______: RGAG_TEMP
Formatstring: $add(%RGAG_TEMP%,%RGAG_MODIFIER%)

Action #5
Actiontype 5: Format value
Field ______: RGAG_SIGN
Formatstring: $if($less(%RGAG_TEMP%,0),'-',)

Action #6
Actiontype 5: Format value
Field ______: RGAG_TEMP
Formatstring: $trimLeft(%RGAG_TEMP%,'-')

Action #7
Actiontype 5: Format value
Field ______: RGAG_TEMP
Formatstring: $div(%RGAG_TEMP%,100)'.'$num($mod(%RGAG_TEMP%,100),2)

Action #8
Actiontype 5: Format value
Field ______: REPLAYGAIN_ALBUM_GAIN
Formatstring: %RGAG_SIGN%%RGAG_TEMP%'÷dB'

Action #9
Actiontype 9: Remove fields
Fields to remove (semicolon separated): RGAG_TEMP;RGAG_SIGN;RGAG_MODIFIER

Action #10
Actiontype 5: Format value
Field ______: REPLAYGAIN_ALBUM_GAIN
Formatstring: %REPLAYGAIN_ALBUM_GAIN%

Action #11
Actiontype 5: Format value
Field ______: REPLAYGAIN_ALBUM_PEAK
Formatstring: %REPLAYGAIN_ALBUM_PEAK%

Action #12
Actiontype 5: Format value
Field ______: REPLAYGAIN_TRACK_GAIN
Formatstring: %REPLAYGAIN_TRACK_GAIN%

Action #13
Actiontype 5: Format value
Field ______: REPLAYGAIN_TRACK_PEAK
Formatstring: %REPLAYGAIN_TRACK_PEAK%

Note: Replace each special ÷ character with one space character.
End Action Group RG#ReplayGainAlbumGain.Modify (13 Actions)

The Mp3tag MTA files ...

RG_ReplayGainTrackGain.Modify.mta (802 Bytes)
RG_ReplayGainAlbumGain.Modify.mta (802 Bytes)

DD.20120202.2202.CET

RG_ReplayGainAlbumGain.Modify.mta (802 Bytes)

RG_ReplayGainTrackGain.Modify.mta (802 Bytes)

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.

As requested by LyricsLover, here is my complete MTA file, as modified from DetlevD's original to add a 4 dB boost and to add to the Comment tag:

Replay Gain Boost Track Gain +4 dB.mta (864 Bytes)

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.