Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: MP3Gain workaround needed for both fb2k / portable player (Read 7867 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

MP3Gain workaround needed for both fb2k / portable player

Hello!

I'm looking for some solution to apply the "best" non-clipping Album Gain (89 dB) to my collection, but there are some problems:

1. I need ID3v2.3 Tags for my Portable (Sony Network Walkman) to display Tags and Album Art correctly (which means that the APE-Tag must not be present)
2. MP3Gain supports only APEv2 and somehow removes any ID3 Tags when (Album) Gain is applied
3. without the MP3Gain-Tags the changes can't be undone

It seems MP3Gain is no longer in development, so I don't expect an ID3-Tag support. Can fb2k's "Apply ReplayGain" do the same job as MP3Gain? I could put up with that.

Besides, could someone explain the MP3Gain-Tags, please?

MP3_GAIN_UNDO (+002,+002,N)
MP3_GAIN_MINMAX (000,175)
MP3_GAIN_ALBUM_MINMAX (000,205)

The "+002,+002" means the Track & Album Gain originally was +3 dB higher (2 x 1,5 dB) and "N" means no clipping will occur when these Values are applied, the values in the other two tags are Track & Album Gain.

Am I right?

MP3Gain workaround needed for both fb2k / portable player

Reply #1
Green emphases and square-bracketed additions mine:
Quote
My tags ("Artist", "Title", etc.) are not working after using MP3Gain

MP3Gain stores [read: stores only] "Analysis" and "Undo" information in special tags inside the mp3 file itself. These tags are in the APEv2 format. APEv2 tags are carefully designed to not interfere with other tag formats, such as the popular ID3v1 format.

Unfortunately, some mp3 players do not strictly adhere to the ID3v1 standard when reading tags. As a result, when MP3Gain writes its APEv2 tags, these mp3 players might get confused and try to read the MP3Gain tags instead of the regular ID3v1 tags such as "Artist", "Title", etc. As a result, the player will show random garbage in these fields.

(To be fair, the mp3 players that have this problem are actually probably trying to compensate for data corruption that can occur in mp3s due to bad encoders, incomplete downloads, etc.)

If you use MP3Gain and discover that your mp3 player has this problem, then here's what you need to do:
• Select "Options - Tags - Ignore (do not read or write tags)" from the MP3Gain menu. This will prevent MP3Gain from writing any more tags to your files.
• To remove tags that MP3Gain has already written, simply load the affected mp3s into MP3Gain and do "Options - Tags - Remove Tags from files"


IMPORTANT
If you choose the "Options - Tags - Ignore" option, then you will not be able to automatically undo changes made by MP3Gain. You will still be able to undo any changes, but you will have to manually keep track of what changes you make to your files.

In other words, MP3Gain can normalise your files without needing to add tags at all, you can remove the tags that it’s previously added, and changes can be undone as long as you have stored the reversion information in some other way.

Is that any help?

As for the format of undo info, I think you’re correct that it’s that simple, but someone more in-the-know than me can confirm.

MP3Gain workaround needed for both fb2k / portable player

Reply #2
could someone explain the MP3Gain-Tags, please?

MP3_GAIN_UNDO (+002,+002,N)
MP3_GAIN_MINMAX (000,175)
MP3_GAIN_ALBUM_MINMAX (000,205)

The two numbers in the UNDO tag refer to the gain applied to left and right channels that would need to be undone, in units of 1.505dB. The 'N' means the Wrap flag was not used. A 'Y' would mean the Wrap flag was used (i.e. during undo, a small amplitude should wrap around to a large number, or vice-versa).

The MINMAX values refer to the minimum and maximum amplitudes in the file. This allows MP3Gain to check for clipping without having to re-analyze audio data in the file.

Hope that helps...

Dave

MP3Gain workaround needed for both fb2k / portable player

Reply #3
Green emphases and square-bracketed additions mine[...]

Thanks, but I've read the whole MP3Gain Help File (Documentation), so I already knew that.
I'd rather like to know how I should "manually keep track" of the changes If I don't understand the Tag-Code in detail?
Besides, there is no option to undo the Gain Changes without theses Tags. The only solution would be storing the original Album Gain in a Text File, set it as Target "Normal" Volume and apply Album Gain. One by one.
Just imagine how long it would take for a whole library for example.
Drag & Drop a whole library and just klick "Undo Gain Changes" is way easier, faster and more convenient.

Is there another way or does anybody know more about the MP3Gain specs?


MP3Gain workaround needed for both fb2k / portable player

Reply #4
The two numbers in the UNDO tag refer to the gain applied to left and right channels that would need to be undone, in units of 1.505dB. The 'N' means the Wrap flag was not used. A 'Y' would mean the Wrap flag was used (i.e. during undo, a small amplitude should wrap around to a large number, or vice-versa).

The MINMAX values refer to the minimum and maximum amplitudes in the file. This allows MP3Gain to check for clipping without having to re-analyze audio data in the file.

Hope that helps...

Dave


Thanks, that was what I needed to know. But I don't exactly understand what the wrap flag is.

Will it be enough to store the dB-change that was made and assume the wrap flag is always "N"?
I could then write this tag back to all files with an mp3tag script for example.

MP3Gain workaround needed for both fb2k / portable player

Reply #5
I don't exactly understand what the wrap flag is.

Will it be enough to store the dB-change that was made and assume the wrap flag is always "N"?
I could then write this tag back to all files with an mp3tag script for example.

From a command window, run mp3gain with the /? wrap option (or -? wrap if you are on Linux or Mac). That will give you an explanation of what it is. If you never use the wrap flag, then you can safely assume it will always be "N".

MP3Gain workaround needed for both fb2k / portable player

Reply #6
mp3gain /s s *.mp3
mp3gain /a /s s *.mp3

Apply gain without writing tags
Apply album gain without writing tags

Foobar will do the same as above when you scan then apply gain to MP3 data.


MP3Gain workaround needed for both fb2k / portable player

Reply #7
The easyest way would be to to copy the files to a new folder and apply mp3gain to the new files. That way you would have both.

Another option would be to copy the ape info to id3 tags and delete ape tags. This can be done simply using mp3tag From the FAQ's:

http://forums.mp3tag.de/index.php?showtopic=978#entry5136

Should you need to reverse the process copy the info from id3 to ape without deleting the id3 tag.
Glass half full!

MP3Gain workaround needed for both fb2k / portable player

Reply #8
mp3gain /s s *.mp3
mp3gain /a /s s *.mp3

Apply gain without writing tags
Apply album gain without writing tags

Foobar will do the same as above when you scan then apply gain to MP3 data.


Does foobar also consider clipping?

I'll try to experiment a little with that...

MP3Gain workaround needed for both fb2k / portable player

Reply #9
mp3gain /s s *.mp3
mp3gain /a /s s *.mp3

Apply gain without writing tags
Apply album gain without writing tags

Foobar will do the same as above when you scan then apply gain to MP3 data.


Does foobar also consider clipping?

I'll try to experiment a little with that...



Yes I think so. There is an option in playback settings that control RG. Under processing: " apply gain and prevent clipping..."

Foobar RG scanner will enable RG for 'capable audio players'.. If you go further and apply gain to mp3 data, You also enable non RG capable players to have normalized audio - at the same time you keep metadata for RG aware players giving you best of both worlds.

MP3Gain workaround needed for both fb2k / portable player

Reply #10
You also enable non RG capable players to have normalized audio - at the same time you keep metadata for RG aware players giving you best of both worlds.
Except when the player in question not only cannot normalise using said metadata but actively chokes on it, which is the entire point of this thread.

MP3Gain workaround needed for both fb2k / portable player

Reply #11
You also enable non RG capable players to have normalized audio - at the same time you keep metadata for RG aware players giving you best of both worlds.
Except when the player in question not only cannot normalise using said metadata but actively chokes on it, which is the entire point of this thread.



RG metadata in ID3V2 and gain is altered internally. This should not be a problem for any player as the ape tag is absent using my examples. Undo is not possible  but i don't really care for that anymore. If its an issue one can make a copy of the folder then use foobar PREFERENCES - ADVANCED TAGGING - MP3 - Tick id3v2 compatibility mode , then- TAGGING - MP3 TAG TYPES - tick only id3v2, Scan RG, Apply gain to MP3 data. Then transfer this folder to the Sony Walkman.

If using mp3gain only: Make a copy of desired folder(s) and use mp3gain *.mp3 /s s. Transfer modified folder to the Sony. If you wanna use a GUI the frontend has an option to turn off tag writing.

MP3Gain workaround needed for both fb2k / portable player

Reply #12
You could use metamp3, a tool a made years ago, which scans, adds id3v2.3, or moves APE2 replaygain tags to id3v2.3 (without scanning). I haven't followed up on that project partly because it was based on the crappy id3lib. That's the only reason I didn't make the source public.

I still would like to make a proper command line tool that supports tagging for every audio format, and included replaygain scanning and mp3gain adjustment like metamp3. It is doable by using TagLib, which finally has support for id3v2.3 (earlier id3v2.4 only) - which was the reason that held me off using that software library. I doubt I will get around to do it though, as I'm already involved with translating lossyWAV to c++.

MP3Gain workaround needed for both fb2k / portable player

Reply #13
I still would like to make a proper command line tool that supports tagging for every audio format, and included replaygain scanning and mp3gain adjustment like metamp3.


Forget "every audio format". A modern tool just for Mp3/ID3 is sorely needed. The command-line syntax should mirror that of LAME 3.99, enabling tagging of any field and the embedding of any size image.

Quote
It is doable by using TagLib, which finally has support for id3v2.3 (earlier id3v2.4 only) - which was the reason that held me off using that software library. I doubt I will get around to do it though, as I'm already involved with translating lossyWAV to c++.


I've always thought that a tool could be derived from LAME itself, and wonder why it's never been made a part of that project. Remove the encoding and decoding ability and add ReplayGain scanning and things like tag import and export similar to metaflac.

MP3Gain workaround needed for both fb2k / portable player

Reply #14
Forget "every audio format". A modern tool just for Mp3/ID3 is sorely needed. The command-line syntax should mirror that of LAME 3.99, enabling tagging of any field and the embedding of any size image.

Well, with TagLib you basically get tagging of all important audio formats for "free". Even if you're not a programmer, you can see that the short example program taken from taglib is very powerful. It prints out meta-tags and audio property from any audio file format supported.
Code: [Select]
int main(int argc, char *argv[])
{
  int i;
  int seconds;
  int minutes;
  TagLib_File *file;
  TagLib_Tag *tag;
  const TagLib_AudioProperties *properties;

  taglib_set_strings_unicode(FALSE);

  for(i = 1; i < argc; i++) {

    file = taglib_file_new(argv[i]);

    if(file == NULL)
      break;
    tag = taglib_file_tag(file);
    properties = taglib_file_audioproperties(file);

    if(tag != NULL) {
      printf("-- TAG --\n");
      printf("title   - \"%s\"\n", taglib_tag_title(tag));
      printf("artist  - \"%s\"\n", taglib_tag_artist(tag));
      printf("album   - \"%s\"\n", taglib_tag_album(tag));
      printf("year    - \"%i\"\n", taglib_tag_year(tag));
      printf("comment - \"%s\"\n", taglib_tag_comment(tag));
      printf("track   - \"%i\"\n", taglib_tag_track(tag));
      printf("genre   - \"%s\"\n", taglib_tag_genre(tag));
    }
    if(properties != NULL) {
      seconds = taglib_audioproperties_length(properties) % 60;
      minutes = (taglib_audioproperties_length(properties) - seconds) / 60;

      printf("-- AUDIO --\n");
      printf("bitrate     - %i\n", taglib_audioproperties_bitrate(properties));
      printf("sample rate - %i\n", taglib_audioproperties_samplerate(properties));
      printf("channels    - %i\n", taglib_audioproperties_channels(properties));
      printf("length      - %i:%02i\n", minutes, seconds);
    }
    taglib_tag_free_strings();
    taglib_file_free(file);
  }
  return 0;
}

Quote
I've always thought that a tool could be derived from LAME itself, and wonder why it's never been made a part of that project. Remove the encoding and decoding ability and add ReplayGain scanning and things like tag import and export similar to metaflac.

I suppose it could (but only for mp3) as it contains both tagging and replaygain code, but I'd say it's easier to add mp3gain/wavegain code with the above.