Help - Search - Members - Calendar
Full Version: Replaygain TAG Retaining Transcode Tool?
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
Stone Free
Hi,

I am currently in the processes of ripping all my CDs to the hard disk for later upload to my iPod. All of the CDs are going to be recorded to FLAC Format, and have replaygain info. I want to be able to transcode them, and retain the Replaygain info.

Are there any transcoding tools that as well as retaining the album info tags will also copy of the replay gain tags?


Peter
Silversight
If you convert your files to a lossy format, the ReplayGain values have to be recalculated as lossy audio compression can change the perceived loudness and result in distortion while decoding. When converting losslessly, RG values could be copied (I requested that once), but AFAIK no program does that.
Alex B
QUOTE(Silversight @ Apr 22 2007, 16:55) *
If you convert your files to a lossy format, the ReplayGain values have to be recalculated as lossy audio compression can change the perceived loudness and result in distortion while decoding.

Actually, the measured gain dB values remain almost identical after a lossless file is converted to a lossy format. The difference is in peak values. Lossy files generate short additional peaks on decoding that can go over the full scale and lead to clipping. However, this is not a practical problem. I have tried to ABX test these clipped peaks without any luck. The duration of these peaks is mostly only a couple of samples (1 sample is 1/44100 s) and human ear just cannot detect any difference. I have wondered if it would be actually better to let these peaks clip (thus play in a reduced volume) because these peaks seem to be only artifacts that are added to the original waveform.

QUOTE
When converting losslessly, RG values could be copied (I requested that once), but AFAIK no program does that.

Several programs can copy all tags including the replay gain tags. It doesn't matter if the end format is lossy or lossless. E.g. dBpoweramp 11.5 (I have not tried the v. 12 yet) preserves the replay gain tags when converting from a format to another (if the "preserve tags" option is selected). Another option is to copy the tags afterwards e.g. with Mp3tag.

Edit: typo
Lyx
QUOTE(Alex B @ Apr 22 2007, 20:40) *

QUOTE(Silversight @ Apr 22 2007, 16:55) *
If you convert your files to a lossy format, the ReplayGain values have to be recalculated as lossy audio compression can change the perceived loudness and result in distortion while decoding.

Actually, the measured gain dB values remain almost identical after a lossless file is converted to a lossy format. The difference is in peak values. Lossy files generate short additional peaks on decoding that can go over the full scale and lead to clipping. However, this is not a practical problem. I have tried to ABX test these clipped peaks without any luck. The duration of these peaks is mostly only a couple of samples (1 sample is 1/44100 s) and human ear just cannot detect any difference. I have wondered if it would be actually better to let these peaks clip (thus play in a reduced volume) because these peaks seem to be only artifacts that are added to the original waveform.


This is interesting, because it means that there is potential to significantly increase the RG-gain (and thus increase loudness) of lossy files, without any perceivable quality loss. Why is this useful? Because the majority of other OS-apps and website-audio, is not replaygained and thus results in large loudness differences between your audioplayer and the rest of your apps(unless you adjust every single app of you - which is not always possible).
greynol
QUOTE(Lyx @ Apr 22 2007, 13:10) *
This is interesting, because it means that there is potential to significantly increase the RG-gain (and thus increase loudness) of lossy files, without any perceivable quality loss.
Where did you get the idea that Alex B was talking about clipping caused by a significant increase in volume?

He's only talking about peaks clipped by just a few samples:
QUOTE(Alex B @ Apr 22 2007, 20:40) *
The duration of these peaks is mostly only a couple of samples (1 sample is 1/44100 s) and human ear just cannot detect any difference.

QUOTE(Alex B @ Apr 22 2007, 20:40) *
I have wondered if it would be actually better to let these peaks clip (thus play in a reduced volume) because these peaks seem to be only artifacts that are added to the original waveform.
Reduced volume? Don't you mean increased volume? I'm not sure I follow this last sentence.
Lyx
QUOTE(greynol @ Apr 22 2007, 22:27) *

QUOTE(Lyx @ Apr 22 2007, 13:10) *
This is interesting, because it means that there is potential to significantly increase the RG-gain (and thus increase loudness) of lossy files, without any perceivable quality loss.
Where did you get the idea that Alex B was talking about clipping caused by a significant increase in volume?


Well, how do you expect the peak-value in replaygain to work during playback, hmm? It is used to ADDITIONALLY decrease the volume, if the RG-preamp would cause clipping. Since apparently, with some lossy files, some high peak values are practially irrelevant/unperceivable, this logically means that there is room for loudness increase with some files (and in some setups, even a better working equal-loudness, since it is actually undesirable do reduce volume because of the peak-value - because it means going below the RG-target). Excessive peak values in lossy files are not uncommon - i regularily find peaks above 1.2 in albums.

- Lyx
greynol
Last time I checked, usage of the peak value is not part of the normal usage of replaygain. Equal loudness is undermined when the peak value is used as the maximum for amplification which is what happens when someone wants to apply gain but prevent clipping.

Are you able to tell us on the average how many samples are getting clipped when your peaks are 1.2? Excuse my ignorance, but do you mean 20% over full-scale, 1.2 dB or something else, hmm?

Remember, Alex B is talking about situations where there are only a few samples that are clipping.
Lyx
AFAIK, it is 20% over full scale, but i am uncertain if this scale is logarithmic or linear. The effect on loudness on such tracks is however obvious to me (can be tested easily in foobar, by editing the peak values).

Preventing clipping is the only use of the peak-value i can think of. What else do you need a peak-value for? If you dont use it, then everything which goes above 100% will get clipped anyways, so i dont really get your point for mentioning this. Since the topic is already about peak values and perceivable or non-perceivable clipping, what use is there in discussing NOT adjusting for clipping? That mode doesnt apply to this thread anyways, or do i miss something here? This thread IS about making use of the peak value and thus going below the RG-target. It is about avoiding audible clipping.

Lastly, i also dont get why you mention that alex was only talking about more subtle increases in peak-value. What does this have to do with my post above? Did i write anywhere that i propose to completely ignore ALL peak-information? What i wrote was, that there may be room for increasing loudness without perceivable quality loss - not more, not less.

- Lyx
Alex B
QUOTE(greynol @ Apr 22 2007, 23:27) *

QUOTE(Lyx @ Apr 22 2007, 13:10) *
This is interesting, because it means that there is potential to significantly increase the RG-gain (and thus increase loudness) of lossy files, without any perceivable quality loss.
Where did you get the idea that Alex B was talking about clipping caused by a significant increase in volume?

He's only talking about peaks clipped by just a few samples...

Yes, I was talking only about the decoder clipping that often results some clipped samples if the lossless source was near full range.

QUOTE
Reduced volume? Don't you mean increased volume? I'm not sure I follow this last sentence.

For example,
- lossless: replaygain -6.1 dB, peak 0.99
- after converting to lossy: replaygain -6.1 dB, peak 1.19

Both files can be played also without a replay gain adjustment just fine. The "lossy peaks" are inaudible, but naturally the file volume cannot be increased without causing audible clipping distortion.

If the volume level is not reduced about 1.5 dB before changing the format to integer PCM (using a floating point decoder that can reproduce peaks and adjust the volume) the lossy peaks would be clipped to the full scale (1.0) so the peaks would essentially be somewhat attenuated. I have no idea how that would affect the audio quality during those particular moments (which are often less than 1/10 of a millisecond). Possibly the peaks are just ugly artifacts (in theory) so wouldn't it be better if the peaks are clipped a bit?


QUOTE(Lyx @ Apr 22 2007, 23:50) *

Well, how do you expect the peak-value in replaygain to work during playback, hmm? It is used to ADDITIONALLY decrease the volume, if the RG-preamp would cause clipping. Since apparently, with some lossy files, some high peak values are practially irrelevant/unperceivable, this logically means that there is room for loudness increase with some files (and in some setups, even a better working equal-loudness, since it is actually undesirable do reduce volume because of the peak-value - because it means going below the RG-target).

- Lyx

Often the replay gain adjustment reduces the volume level quite a bit and that is enough for keeping the lossy peaks under 1.0 without any additional clip prevention. There are exceptions, like some highly dynamic classical recordings that can have a positive replay gain value and still have near full-scale peaks. These will audibly clip already in the lossless format if no peak prevention is used with the replay gain correction.

If the replay gain is close to zero dB (but not over) you can "safely" avoid the additional volume level reduction by simply using replay gain without clipping prevention. However, the change would often be only about 1-2 dB with near transparent lossy files. The peaking increases gradually when the quality settings & bitrates are lowered. I have seen 48 kbps files that produce over 2.0 peaks. That means an about 6 dB volume level reduction when the peak prevention is used.


QUOTE(greynol @ Apr 23 2007, 00:08) *
Are you able to tell us on the average how many samples are getting clipped when your peaks are 1.2? Excuse my ignorance, but do you mean 20% over full-scale, 1.2 dB or something else, hmm?

The amount of these peaks seem to vary a lot. Some files contain only a couple of them, some have hundreds. However, the peeks seem to always be very short. The 1/10 of a millisecond duration I mentioned is about the longest that I have seen. If the peak value is 1.2 (20% over full scale) that means an about 1.5 dB difference to the 1.0 value. A 6 dB volume level increase to a 1.0 peak produces a 2.0 peak (exactly).

Edit

These lossy peaks are an interesting matter, but a bit OT here. I may start a new thread because I have seen some contradictory information about the decoder clipping. I may have some interesting file analysis data to publish.
greynol
QUOTE(Lyx @ Apr 22 2007, 14:30) *
Preventing clipping is the only use of the peak-value i can think of. What else do you need a peak-value for? If you dont use it, then everything which goes above 100% will get clipped anyways, so i dont really get your point for mentioning this.
I mentioned it because you asked:
QUOTE(Lyx @ Apr 22 2007, 13:50) *
Well, how do you expect the peak-value in replaygain to work during playback, hmm?

dry.gif

QUOTE(Lyx @ Apr 22 2007, 14:30) *
Lastly, i also dont get why you mention that alex was only talking about more subtle increases in peak-value. What does this have to do with my post above? Did i write anywhere that i propose to completely ignore ALL peak-information? What i wrote was, that there may be room for increasing loudness without perceivable quality loss - not more, not less.

I took issue with your use of the word, "significant." I don't feel that this is a logical conclusion given the evidence as limited by Alex B's post.

Clipping becomes audible when either a maximum amplitude is held for some given minimum amount of time in the event of a single peak or the maximum amplitude is held for a smaller minimum amount of time when it occurrs over repeated cycles.

This goes to the heart of the discussion and this is why I asked you about how many samles get lopped off (on average) when you see peaks at 1.2 (I now understand you mean a literal RG peak value here). Alex mentionded that he isn't able to distinguish clipping when only a couple of samples are held at a maximum value. "Subtle" is a much better adjective in this instance than "significant."

Whether you're going to hear clipping or not for various audio samples when allowing RG to amplify/attenuate without regard to the peak value is going to depend on the individual audio sample. I don't think it makes sense to generalize in this situation.


I just read your post Alex, thanks for clarifying your point of view.
Alex B
QUOTE(Stone Free @ Apr 22 2007, 14:48) *

Hi,

I am currently in the processes of ripping all my CDs to the hard disk for later upload to my iPod. All of the CDs are going to be recorded to FLAC Format, and have replaygain info. I want to be able to transcode them, and retain the Replaygain info.

Are there any transcoding tools that as well as retaining the album info tags will also copy of the replay gain tags?


Peter


Sorry about hijacking your thread smile.gif (- unless you find our discussion interesting.)

As I said, in my opinion you can safely copy the replay gain values from the lossless source files. They'll be close enough for volume levelling during playback.

A separate issue is how you can get the RG values into the iPod database. Apple's own firmware doesn't read any tags. It is up to the used software to transfer and convert the replay gain tags. However, some SW solutions exist and another option is the Rockbox firmware. Rockbox supports standard RG tags.
Lyx
Hmm, i didnt take this into account in the past: Could a decoder (not the ENcoder) introduce additional clipping (unless prevented)? From what i read and know, the answer is yes?

Thinking about the "room for loudness increase"-issue, if there is any usefulness to gain from it, any hypothetical changes to how peak-information is used, would already need to happen during the RG-analyzing phase. Doing it at playback would require analyzing the entire track in advance, to make any meaningful decision - heck, in the case of albumgain, even analyzing the entire album beforehand. Thats just not practically reasonable to do on-the-fly. Those however are just hypothetical and academical ideas for now, because as it stands now, it isnt even clear, if it is desireable and reasonable.

Even if it would be desireable, the question would be if there arent other more efficient methods to fix the problem of volume discrepancy between RG-aware software and non-RG-aware software.... like for example having some kind of virtual soundcard in the OS, to which you would point all your RG-aware players. This virtual soundcard would run at full volume, while the other soundcard (used by non-RG-aware apps) would run at reduced volume.

- Lyx
Stone Free
QUOTE(Alex B @ Apr 22 2007, 23:57) *

Sorry about hijacking your thread smile.gif (- unless you find our discussion interesting.)

Well usually I can follow what people are saying but this time its a great big huh huh.gif
Stone Free
Also is there a tool that can transfer my APE replaygain tags that currently reside in my .mp3 files (from mp3gain) to my .flac files as I have already fiddled about greatly with differing values in the "Target "Normal" Volume".

And I don't want to have to start again from scratch
Stone Free
QUOTE(Alex B @ Apr 22 2007, 19:40) *

Several programs can copy all tags including the replay gain tags. It doesn't matter if the end format is lossy or lossless. E.g. dBpoweramp 11.5 (I have not tried the v. 12 yet) preserves the replay gain tags when converting from a format to another (if the "preserve tags" option is selected). Another option is to copy the tags afterwards e.g. with Mp3tag.

Edit: typo

Whereabouts is the preserve tags option, I have just tried dBpoweramp and all the tags minus the replaygain tags where copied.
Alex B
QUOTE(Stone Free @ Apr 28 2007, 16:43) *
Whereabouts is the preserve tags option, I have just tried dBpoweramp and all the tags minus the replaygain tags where copied.

I have used the general "Preserve ID Tags" option and the following tagging options in the separate dMC Configuration tool:

FLAC
Tag Creation: Vorbis Comments
Write ID3v1 version: v.1.1
Write ID3v2 version: v.2.3
(I don't know why the ID3 options are here, it looks like dBpoweramp correctly writes only the Vorbis/FLAC comments.)

MP3
Tag creation: ID3v2 and ID3v1
Write ID3v1 version: v1.1
ID3v1 UTF8 read: Yes
ID3v1 UTF8 write: Yes
Write ID3v2 Unicode: No
Write ID3v2 version: v.2.3

I just converted a few FLAC files (standard track files) to MP3 with the v.11.5 and also the four TXXX... replay gain and peak values were included in the resulting MP3 files.

Did you use the v.12? Perhaps it has changed. As I said, I have not tried it yet.
Alex B
QUOTE(Stone Free @ Apr 28 2007, 01:56) *

Also is there a tool that can transfer my APE replaygain tags that currently reside in my .mp3 files (from mp3gain) to my .flac files as I have already fiddled about greatly with differing values in the "Target "Normal" Volume".

And I don't want to have to start again from scratch

I don't know any tool that can do that directly. Mp3tag can read the APE tags and copy them, but it does not simultaneusly include the ID3 tags. Because Mp3tag replaces all old tags on a tag copy/paste the result would be a file that has only the replay gain tags.

The following procedure could work:
Configure foobar2000 to read also APE tags, but write only ID3v1 and v2.4 tags. Load the mp3 files to foobar (or copies of the files if you want to preserve the original files). Save a tag change so that foobar converts the APE replay gain tags to ID3v2.4 (this will remove the APE tags). After this you can copy the tags with Mp3tag to the FLAC files.
greynol
QUOTE(Alex B @ Apr 28 2007, 09:08) *
I just converted a few FLAC files (standard track files) to MP3 with the v.11.5 and also the four TXXX... replay gain and peak values were included in the resulting MP3 files.

Did you use the v.12? Perhaps it has changed. As I said, I have not tried it yet.

I think he wants to go in the other direction...

QUOTE(Stone Free @ Apr 27 2007, 15:56) *
Also is there a tool that can transfer my APE replaygain tags that currently reside in my .mp3 files (from mp3gain) to my .flac files as I have already fiddled about greatly with differing values in the "Target "Normal" Volume".

Though if he's allowed mp3gain to modify the mp3 data, transferring the RG information to his flac files isn't going to produce the results that he desires.
Alex B
QUOTE(greynol @ Apr 28 2007, 20:31) *
I think he wants to go in the other direction...

The first post in this thread:
QUOTE(Stone Free @ Apr 22 2007, 14:48) *
I am currently in the processes of ripping all my CDs to the hard disk for later upload to my iPod. All of the CDs are going to be recorded to FLAC Format, and have replaygain info. I want to be able to transcode them, and retain the Replaygain info.

Are there any transcoding tools that as well as retaining the album info tags will also copy of the replay gain tags?

Peter

I think he wants go in the both directions.

QUOTE(greynol @ Apr 28 2007, 20:31) *
Though if he's allowed mp3gain to modify the mp3 data, transferring the RG information to his flac files isn't going to produce the results that he desires.

This is true, though Stone Free only asked how the tags can be copied. However, if he has altered only the tags for getting desired playback correction results the same dB values should be fine.
Stone Free
I have created FLAC files and added replaygain info to them, I then want to be able to transcode them to say MP3 or Apple AAC and have those tags retained in the new files.

I have also previously ripped some tracks to MP3 and fiddled with the Target Volume and so want to add the same info to newly converted flac versions

Surely the track cannot get louder after lossy compression and therefore it will most likely be near enough?

I am using R12 of dbPowerAmp and there does not seem to be a Preserve Tags option, either within the encoder configuration page tha appears when you convert a file or in the Configuration Tool
Alex B
I don't have much to add, but I'll try...

FLAC to MP3

You could try Mp3tag and see what it can do: www.mpt3tag.de/en. Its tag copy system is simple and fast. You can drag a few FLAC folders from Windows Explorer to Mp3tag and do right-click > copy tag. Then drag the corresponding MP3 folders and do tag paste. Naturally you must check that the files are listed in the same order, but if you have used a consistent naming scheme that should happen automatically.

You may also consider just using foobar2000 for the conversion and a new replay gain analysis. Foobar has probably the fastest replay gain scanner. On my already rather old 2.8 GHz hyperthreaded P4 it analyses MP3 files at over 100x speed. It can also convert and automatically replay gain analyze the newly converted files.

MP3 to FLAC

You didn't tell if you have allowed MP3gain to physically change the files (MP3Gain's "Modify Gain" tools do this). If you have, then you shouldn't try to copy the values as graynol said. The FLAC files don't contain these adjustments and the values would be wrong (MP3Gain adjusts the saved tag values accordingly if the physical gain is changed).

dBPoweramp v.11.5 vs 12

the v. 11.5 is still available here: http://www.dbpoweramp.com/bin/dMC-r11.5.exe
codecs for it: http://www.dbpoweramp.com/legacy/codec-central-legacy.htm
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.