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: Can I make lame write replaygain information? (Read 9638 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Can I make lame write replaygain information?

Hi. I just batch re-encoded my lossless library to mp3 and I've been trying to figure out what the --replaygain-fast command line option does in lame (3.98 final2). I used that option but now I cant work out why lame was calculating the replaygain info (and said it was writing it) but when I load the tracks in foobar there is no replaygain info there.

Now I've just read in another thread that the replaygain only gets written to the "lame-tag" and foobar and most other software wont use that information, so the upshoot is I've got to scan everything again in foobar. Is this understanding correct?  The replaygain information is there somewhere in the file (I dont seem to have the software to view it though) but it's not in a format that's of any use to anyone so I've got to do it again in foobar.

If the above is correct then second question. Is there any simple way to get the replay gain from the lame-tag and put it where other software expects it to be?

Can I make lame write replaygain information?

Reply #1
You are correct. There is a command-line program called lametag.exe that will show the contents of the Lame tag. I understand that there are programs that will read the lame tag RG and write an ID3 tag, but I don't know them.
Glass half full!

Can I make lame write replaygain information?

Reply #2
Thanks for confirming that bilbo. It's a shame that lame cant write them to (or there's not some simple procedure to transfer them from the lame tag to) where-ever it is that they need to be for software like foobar to use them.

Anyway I've rescanned them all in foobar now so it's all good. I was just getting annoyed with this yesterday as I was batch encoding my lossless collection to mp3 and trying to scan one completed batch in foobar while another batch was encoding. It was just so slow due to all the cpu usage that it was driving me crazy (like scanning at 0.8 speed when it would normally do it about 125 speed). I was really wishing there was an easier way, like if there was a simple utility to just transfer the lame tag replaygain data and then I could batch it in with the rest of the encoding and tagging.

Can I make lame write replaygain information?

Reply #3
I had looked into this some time ago, and IIRC I was told that in Lame the ID3 tags are written before the encode and RG can't be calculated until after the encode.
Glass half full!


Can I make lame write replaygain information?

Reply #5
Thanks for the info greynol, I'll take a look at that util and see what it can do.

Can I make lame write replaygain information?

Reply #6
Quote
I was really wishing there was an easier way, like if there was a simple utility to just transfer the lame tag replaygain data and then I could batch it in with the rest of the encoding and tagging.


IIRC Lame calculates only track_gain value. With --replaygain-accurate switch it also calculates track_peak value. But album gain and peak. If this is enough, fine; but one cannot get album gain/peak values from Lame tag.

Can I make lame write replaygain information?

Reply #7
but one cannot get album gain/peak values from Lame tag.

Yes but it wouldn't be hard to calculate the average album gain using the track values.

Can I make lame write replaygain information?

Reply #8
it wouldn't be hard to calculate the average album gain using the track values.

Maybe [a href='index.php?act=findpost&pid=487435']this post[/a] is helpful. 

Can I make lame write replaygain information?

Reply #9
Quote
Yes but it wouldn't be hard to calculate the average album gain using the track values.

Album gain calculated by foobar2000 isn't just an average of track gains.

Can I make lame write replaygain information?

Reply #10
I've thought that instead of performing an analysis over all the tracks, using the value of the loudest track should give a comparable if not perhaps a more worthwhile result.  People aren't likely to notice that the loudest portion of the music 20 minutes before was a one or two dB different than the loudest part they're currently experiencing.

Thinking about this has peaked my interest once again.  Perhaps we can even work out a way to create APE tags that are recognizable by mp3gain in order to save a lot of time.  I personally don't care that the peak values may be different with --replaygain-fast.  Preventing clipping that you are in all likelihood never going to hear is not worth the increase in time resulting from using --replaygain-accurate, IMO.

uart, you said you're re-encoding your lossless library which I assume is replay-gained.  Why not just use the scale command or have foobar2000 apply RG prior to encoding and not bother having Lame add rg info?  If your lossless library doesn't have replay gain, adding it can be really quick.

Can I make lame write replaygain information?

Reply #11
uart, you said you're re-encoding your lossless library which I assume is replay-gained.  Why not just use the scale command or have foobar2000 apply RG prior to encoding and not bother having Lame add rg info?  If your lossless library doesn't have replay gain, adding it can be really quick.


Hi Greynol. Yeah all my "ape" lossless files (monkey audio) are already replaygained. Currently I use a simple command line tag tool (tag.exe by case : http://www.rarewares.org/others.php#tag ) to transfer the tags from the ape files to the mp3 files. It transfers all the other tags ok but for some reason it doesn't copy the replaygain tags.

Can I make lame write replaygain information?

Reply #12
I just finished a batch script that will copy RG track gain info from the Lame header and write it as an APE tag.  It will also use the smallest track gain from a list of files as the album gain value.

APE was chosen so that it could be read by MP3Gain.

I can make it available if anyone is interested.  The script requires tag.exe, the version of lametag.exe for Windows 95/98/ME, and eval.exe.



EDIT: To answer your question, uart, try the --ape2 switch.  It should transfer everything.  ID3v1 has no provision for RG info and tag.exe doesn't do ID3v2.

From the command line in a directory of fully tagged and replaygained apes and tagless mp3s with the same filenames, this worked like a champ:
Code: [Select]
for %g in (*.ape) do tag --ape2 --fromfile "%g" "%~ng.mp3"

Can I make lame write replaygain information?

Reply #13
To answer your question, uart, try the --ape2 switch.  It should transfer everything.  ID3v1 has no provision for RG info and tag.exe doesn't do ID3v2.

From the command line in a directory of fully tagged and replaygained apes and tagless mp3s with the same filenames, this worked like a champ:
Code: [Select]
for %g in (*.ape) do tag --ape2 --fromfile "%g" "%~ng.mp3"

Arh yes, thanks for the info greynol. That was the problem, tag.exe was reading the ape files from my lossless files but was writing id3 tags to the mp3 files. With the --ape2 switch (to force writing ape2 tags) it also copies the replay gain info. Thanks.

Moderation: Pruned previous quote to only the information that was pertinent.  Please make an attempt at doing this in the future.

 

Can I make lame write replaygain information?

Reply #14
I just finished a batch script that will copy RG track gain info from the Lame header and write it as an APE tag.  It will also use the smallest track gain from a list of files as the album gain value.

APE was chosen so that it could be read by MP3Gain.

I can make it available if anyone is interested.
Such a request was issued via PM, though I really haven't used it since I first worked on it since I typically scale when encoding lossy from RG-tagged lossless.

Here it is...
Code: [Select]
@ECHO OFF
CLS
SET filelist=
SET TG=
SET AG=

:track
IF /i "%~x1" == ".mp3" CALL :tg %1
SHIFT
IF "%~1" == "" GOTO album
GOTO track

:tg
lametag %1 > "%~1.tag"
FOR /F "usebackq tokens=4 delims=<d " %%X IN (`findstr /c:"RG track gain:" "%~1.tag"`) DO CALL :check_rg %%X %1
FOR /F "usebackq" %%X IN (`findstr /c:"LAME tag not found." "%~1.tag"`) DO (
  ECHO "%~1"
  ECHO No LAME tag
  ECHO.
)
del "%~1.tag"
GOTO :eof

:check_rg
IF "%~1" == "not" (
  ECHO "%~2"
  ECHO No RG TRACK GAIN value
  ECHO.
  GOTO :eof
)
tag --ape2 -t REPLAYGAIN_TRACK_GAIN="%1 dB" %2 2>NUL
ECHO "%~2"
ECHO REPLAYGAIN_TRACK_GAIN=%1 dB
ECHO.
SET TG=%TG%,%1
SET filelist=%filelist% %2
GOTO :eof

:album
SET TG=%TG:~1%
IF "%TG%" == "~1" GOTO end
SET TG=%TG:,=^^,%
FOR /F %%X IN ('EVAL min^(%TG%^)') DO SET AG=%%X
CALL :ag %filelist%
ECHO REPLAYGAIN_ALBUM_GAIN=%AG%
GOTO end

:ag
IF "%~1"=="" GOTO :eof
tag --ape2 -t REPLAYGAIN_ALBUM_GAIN="%AG% dB" %1 2>NUL
SHIFT
GOTO ag

:end


 
SimplePortal 1.0.0 RC1 © 2008-2021