Rockbox mail archiveSubject: Replaygain: New beta version of unix tagger
Replaygain: New beta version of unix tagger
From: john <ruttmannn_at_gmx.de>
Date: Wed, 31 May 2006 13:07:13 +0200
Many thanks to Sander for posting a shell script originally made by
> Credits should go to iGold from the hydrogen forums.
The script is a smart and easy approach to tag mp3s with the desired
replaygain tags. However, I did some improvements and bugfixes to the
original version, so I post a new version here.
Additionally I will give here some excessive information about the
whole thing, as I think some more replaygain information is really
neccessary. It took me quite some time to get into the whole matter,
as documentation is nearly not existant. Therefore I would also like
to create a new entry in the rockbox wiki, most possibly named
"Replaygain", addressed also at the beginner. What`s the right way to
do it? Just create an account and do it?
The script works that way:
First use the well known mp3gain program to calculate track and album
gain and peak values. mp3gain does write this information as APE-tags,
not suitable for rockbox. So, the replaygain information is read back
from the APE tags (via mp3gain) and then ID3V2 tags are written with
mp3gain needs to be called twice for every file, because in the first
step we have to give it all files of a folder as argument, so it will
calculate album gain. Consequently, all files inside a folder are
treated like one album with the same album gain for all of them. This
may not be true quite often, but does no harm, as you would play a
totally mixed up folder with activated track gain and only switch to
album gain for real albums.
Another possible improvement (not done yet) would check if a folder
really contains only tracks from one album. This could easily be done
by reading the mp3 tags and check if all album name tags are identical
for all files. If it`s not a real album, no album gain tags would be
- You could set up rockbox to use album gain and fallback to track
gain, if not available.
- The ID3 tags of all albums must be set correctly or you will lose
album gain completly. At least in my collection this is not the case.
- When doing an update run, mp3gain would recalculate the gain for all
files with missing album gain over and over again. This is quite time
consuming. Could be fixed, I think.
Therefore currently I`m satisfied with the way it works. BTW: The
original version did delete the APE tags after processing them. My
version keeps them, because I want to do update runs over my whole
music collection. If mp3gain finds existing APE tags, it will skip the
files. But be aware: Because mp3gain is calculating the album gain for
a directory, it will recalculate the whole directory, if only one file
has been added.
Put all three fills in a directory which is in your executable path.
will take a directory as argument and process all mp3 files in that
will also take a directory as argument. It`s a wrapper for
replaygain_tag.sh, that will call it for every subdirectory.
contains some shared functions for the two scripts above.
Yes, there are some bugs. Therefore this is only a beta version.
All bugs relate to the usage of eyeD3 as ID3V2 tagger.
First bug, maybe fixed: If a file contains ID3V1 tags, eyeD3`s output
clearly says, that it is writing the replaygain tags. However,
re-reading them with eyeD3 still shows only ID3V1 and of course there
a no gain tags. So, I tried extenting the script by converting ID3V1
tags to ID3V2 with the --to-v2.4 option first. This proved to be a
good solution, but I wonder if it is possible, that a file holds ID3V1
and ID3V2 with different content and what the results would be. Had no
time to make the neccessary tests yet. Anyone enlighted?
eyeD3 V0.6.4 would not show the user text info, when any of the tags
contained characters outside the ascii range. Instead this error msg
was shown: "'ascii' codec can't encode character u'\xf3' in position
61: ordinal not in range(128)". Therefore the old tag data was always
read as empty and the tags rewritten with every update run. This has
been fixed for some files with at least eyeD3 V0.6.10, but still some
files remain raising this error.
eyeD3 V0.6.4 can not process ID3V2.2 tags. Converting ID3V2.2 tags
will therefore fail and applying the replaygain tags also. Seems to
be fixed with eyeD3 V0.6.10.
BTW: Converting to ID3V2 beforehand is neccessary. It you would just
write ID3V2 tags with the -v2 option, the replaygain tags would be
written, but the resulting file would then contain ID3V2 tags with
only replaygain information and ID3V1 tags with the artists
information. At least rockbox cannot merge this, so you would
practically lose the artist information.
Thanks for all comments and improvements,
Page was last modified "Sat May 23 08:12:40 2020" The Rockbox Crew