Trevin Chow

Microsoft Group Program Manager and Seattle Photographer

Applying ReplayGain more easily with Foobar2000 and MP3Tag

View Comments

I previously wrote about applying ReplayGain to MP3 files with a combination of Foobar2000 and MP3Tag.  I’ve come up with a slightly easier way to reduce some of the manual steps.

I found out that both Foobar2000 and MP3Tag both supports some limited command line operations, and with a tiny bit of legwork, you can add a right-click (context menu) way of making this process easier.

With this approach, you can now right-click songs, select a context menu option and Foobar2000 will automatically apply ReplayGain at the track-level then MP3Tag will automatically open up and add the songs ready for you to apply the custom Action we previously created.

First, make sure you have Foobar2000 and MP3Tag installed.

Second, copy the following script and put it in a batch file and save it somewhere you can remember. I put mine in E:\Documents\ReplayGainScripts\ReplayGain.bat.  I’m on an x64 system, so notice the environment variables highlighted in red which will need to be changed to %PROGRAMFILES% if you are on x86 (32-bit).


@echo off
Echo Sending selected files to Foobar2000 to apply Track-level ReplayGain...
"%PROGRAMFILES(x86)%\foobar2000\foobar2000.exe" /context_command:"Replaygain/Scan per-file track gain" %*
if not %ERRORLEVEL%==0 goto :errorfoobar
Echo Sending direcotry to MP3Tag so you can apply the actions...
"%PROGRAMFILES(x86)%\Mp3tag\mp3tag.exe" /fp:%1
if not %ERRORLEVEL%==0 goto :errormp3tag
exit

:errorfoobar
echo Foobar2000 exited abnormally, ending script
pause
exit

:errormp3tag
echo MP3Tag exited abnormally, ending script
pause
exit

After you’ve saved the file, go to %APPDATA%\Microsoft\Windows\SendTo, and create a new shortcut here by right-clicking, selecting New then Shortcut.  For the location, put the path where you saved the batch file.

image Hit Next, then you’ll be prompted to enter a name for the shortcut. I used Apply ReplayGain:

image 

Hit Finish and you’ll be returned back to the explorer Window and you’ll see your newly created shortcut:

image

You’re done! Now navigate to a directory containing the MP3 files you want to apply ReplayGain to, right click, select Send To then select Apply ReplayGain.  You’ll see Foobar2000 startup, automatically apply track-level ReplayGain, then when you finish, the batch file will start MP3Tag with the files ready for you to apply our ReplayGain action.  (Right-click on the songs, select Convert then Actions…).

Notes:

  • This was tested on MP3Tag v2.45a and Foobar2000 v0.9.6.9 (which are the latest versions at the time I wrote this).
  • Foobar2000 isn’t designed to be controlled entirely by command line which is why you can’t suppress the UI
  • MP3Tag is extremely limited with only 2 command line options, so the scripts is limited to sending the entire directory to MP3Tag. This means 3 things:
    • Even if you selected a subset of songs from a folder, Foobar2000 will correctly apply ReplayGain only to the subset of songs, but MP3Tag will load all the songs from the folder
    • You can only work on a single folder at time. So do not select songs from multiple folders
    • Currently, there is no way to get MP3Tag to auto-apply the action.
  • I wrote this really quickly so there might be some bugs :)

Troubleshooting:

  • Check the batch file output to see if Foobar2000 or MP3Tag are exiting abnormally. Most common causes will be because you’ve specified the wrong path to the EXE’s or you have a copy and paste problem somewhere

If you have any issues, drop me a line in the comments.

Related Posts

  1. Getting MP3 songs to play at the same volume in iTunes and beyond
  2. Deleting song in iTunes Library from within a Playlist
  3. Create free iPhone ringtones from an MP3
  4. Strange characters after Wordpress upgrade
  5. Fix for MP3 songs not playing in iTunes

Written by Trevin

January 3rd, 2010 at 3:58 pm

  • I have several albums on my PC which consist only of song names, without artist or album details, when I open the songs in windows explorer, all it shows is the song name.
  • I have several albums on my pc which consist only of song names, without artist or album details, when I open the songs in windows explorer, all it shows is the song name.
  • Peter
    Thank you very much for your exellent work!

    Peter, Netherlands
blog comments powered by Disqus
Get Adobe Flash playerPlugin by wpburn.com wordpress themes