Help - Search - Members - Calendar
Full Version: SUBLAME -- announcing experimental batch file!
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - General
PhileasFogg
In my quest for the perfect mp3 rip i have hit a few snags. I created this batchfile as a workaround--please tell me what you think, and if you can solve the remaining
problems! (go easy on me, this is the most complicated thing i've programmed, other than a convoluted autoexec.bat i made years ago!)

Sublame.txt:

CODE

SUBLAME 0.01a by Adam Golding
-----------------------------

The Problems:

--Concerning --nogap

      -LAME's experimental --nogap option is not supported by EAC

      -WinLame supports it but:
        -winlame only uses a special lame dll, which is rarely updated
        -winlame does prevent LAME from applying --nogap to tracks from
         different albums
        -winlame does not recurse subdirectories automatically
        -(otherwise WinLame was an impressive front end!)
        -WinLame does not have encoding log

      -all2lame supports it but:
        -all2lame's "album separator[s]" have to be manually inserted
        -all2lame has no option to delete source files after encoding
        -all2lame also does not recurse subdirectories automatically
        -all2lame also appears to have a bug that prevents you from adding
         many files at once (you have to add them in groups of 20 or so)
        -all2lame also has no encoding log

       -other frontends?
        -no other frontends appear to support --nogap


--Concerning EAC

       -EAC creates .log, .cue, and .m3u files, but gives no options for
        naming them or placing them in directories.  Using these options
        for the files themselves will separate these files from the albums
        they correspond to.

       -EAC does not create .cue sheets which are compatible with its own
        index-based extraction.


A Partial Solution:

    I have no programming experience, so I have resorted to a crude batch
    file.  This file will not work on some older windows/dos systems, because
    I learned all of the commands from WindowsXP doccumentation.

sublame.bat:

       The assumption is that you've used EAC to name files with something
       like %D\%Y - %C\%N$%T$%A$%I, with a directory for each album.  (The
       filename is like that so you can pass all the info from EAC to a
       tagger (which will tag and rename your files) while keeping the
       path and filname as short as possible.)

       sublame.bat performs the following steps:

       1. Starting in the current directory, it will compress each directory
          as one album using lame --nogap.  You will have to put options in
          the .bat file.

       2. sublame will delete all wav files in the tree.

       3. sublame will move log, cue, and m3u files in the starting dir to
          the first subdirectory that contains their filename in the
          directory name, thus reuniting them with their albums.

       4. sublame will rename these files to match the directory name, so
          for example

                "1969 - Abbey Road\Abbey Road.log" becomes
                "1969 - Abbey Road\1969 - Abbey Road.log"

       5. I cannot determine how to fix the .cue files for index-based
          extraction, nor can I find a way to log lame.exe's output! Someone
          help!  (the cue fix woult have to run after the tagger renames the
          files)

       6. At this point you need to run a tagging program to extract the tags
          from the filename and to rename the files. Then you need to run
          VBRfix (the visual basic version recurses subdirectories) to fix the
          playback times. (Note: VBR fix introduces a very small gap in winamp,
          but nothing in foobar2000.)
SUBLAME 0.01a by Adam Golding
-----------------------------

The Problems:

--Concerning --nogap

      -LAME's experimental --nogap option is not supported by EAC

      -WinLame supports it but:
        -winlame only uses a special lame dll, which is rarely updated
        -winlame does prevent LAME from applying --nogap to tracks from
         different albums
        -winlame does not recurse subdirectories automatically
        -(otherwise WinLame was an impressive front end!)
        -WinLame does not have encoding log

      -all2lame supports it but:
        -all2lame's "album separator[s]" have to be manually inserted
        -all2lame has no option to delete source files after encoding
        -all2lame also does not recurse subdirectories automatically
        -all2lame also appears to have a bug that prevents you from adding
         many files at once (you have to add them in groups of 20 or so)
        -all2lame also has no encoding log

       -other frontends?
        -no other frontends appear to support --nogap


--Concerning EAC

       -EAC creates .log, .cue, and .m3u files, but gives no options for
        naming them or placing them in directories.  Using these options
        for the files themselves will separate these files from the albums
        they correspond to.

       -EAC does not create .cue sheets which are compatible with its own
        index-based extraction.


A Partial Solution:

    I have no programming experience, so I have resorted to a crude batch
    file.  This file will not work on some older windows/dos systems, because
    I learned all of the commands from WindowsXP doccumentation.

sublame.bat:

       The assumption is that you've used EAC to name files with something
       like %D\%Y - %C\%N$%T$%A$%I, with a directory for each album.  (The
       filename is like that so you can pass all the info from EAC to a
       tagger (which will tag and rename your files) while keeping the
       path and filname as short as possible.)

       sublame.bat performs the following steps:

       1. Starting in the current directory, it will compress each directory
          as one album using lame --nogap.  You will have to put options in
          the .bat file.

       2. sublame will delete all wav files in the tree.

       3. sublame will move log, cue, and m3u files in the starting dir to
          the first subdirectory that contains their filename in the
          directory name, thus reuniting them with their albums.

       4. sublame will rename these files to match the directory name, so
          for example

                "1969 - Abbey Road\Abbey Road.log" becomes
                "1969 - Abbey Road\1969 - Abbey Road.log"

       5. I cannot determine how to fix the .cue files for index-based
          extraction, nor can I find a way to log lame.exe's output! Someone
          help!  (the cue fix woult have to run after the tagger renames the
          files)

       6. At this point you need to run a tagging program to extract the tags
          from the filename and to rename the files. Then you need to run
          VBRfix (the visual basic version recurses subdirectories) to fix the
          playback times. (Note: VBR fix introduces a very small gap in winamp,
          but nothing in foobar2000.)




sublame.bat:

CODE

@echo off
echo.
echo.
echo SUBLAME 0.01a by Adam Golding
echo -----------------------------
echo.
echo this program operates recursively and includes DELETING and RENAMING as
echo part of its operation, so PROCEED AT YOUR OWN RISK.  It is also in alpha
echo and may malfunction.
echo.
echo see sublame.txt for instructions.
echo.
echo.
echo.
echo.
echo Press CTRL+C to cancel.
pause

setlocal enabledelayedexpansion


pushd .



: all2lame commands
: -----------------
: These commands are performed by go.bat generated in
: ALL2LAME -- I don't think they are necessary since filenames are not
: written to the batch file in this case.
:
: S:
: cd "S:\Path"
: win2dos rs.bat


:nogap

: this section does a --nogap encode on *.wav in  a directory tree, staring
: in ., and treats each directory as one album (so LAME does not apply --nogap
: across albums--although, for trivia, Klaatu's first 2 albums should run
: seamlessly together, so you would need to alter this to rip them.)




: curent directory scanning: enable this to include the current directory
: call :nogap .

for /D /R %%i in (*.*) do call :nogapsub "%%i"
goto :cuelog

:nogapsub
cd %1
set Q=
for %%i in (*.wav) do set Q=!Q! "%%i"

:LAME options
:put options after lame.exe below.
lame.exe --nogap %Q%

: these are some options i am toying around with.
: -t -T -nogaptags -p --replaygain-accurate --clipdetect --verbose --priority 0 --nogapout  --preset standard

del *.wav
goto :eof

:cuelog

: this section moves *.cue, *.log & *.m3u from . into the first directory in
: the tree which contains their filename. At the same time, it renames the
: files to match the name of the directory they were moved to.  Add /Y to
: "do move" to supress prompt on overwriting existing files.

popd
for %%i in (*.cue,*.log,*.m3u) do call :cuelogsub "%%i" "*%%~ni*" "%%~xi"
goto :eof

:cuelogsub
for /F "delims==" %%i in ('dir /s /ad /b %2') do move %1 "%%i\%%~nxi%~3"
goto :eof        


Thanks!
PoisonDan
Allow me to quote zZzZzZz from this thread:

QUOTE
--nogap is useless, deprecated, and hardly supported anywhere.


You don't need the --nogap switch to get gapless playback from LAME. Read the thread I linked to.
Otto42
QUOTE(PoisonDan @ Feb 18 2004, 09:52 AM)
Allow me to quote zZzZzZz from this thread:

QUOTE
--nogap is useless, deprecated, and hardly supported anywhere.


You don't need the --nogap switch to get gapless playback from LAME. Read the thread I linked to.

I read that thread and the thread it linked to. I have a question.

First, however, let me state that I fully understand the problems behind gapless playback, both in the format and in the decoder delays and such. I also understand what the LAME tag does with regards to gapless and why you don't need --nogap to do it.

All that said, what does --nogap actually do? Is it simply using samples from the next track as padding material instead of padding with nulls to fill the final frame? Or what? And if it's using samples from the next track, do those samples get left out of the next MP3 that gets created? If so, then you'd never really want to use --nogap, would you?
PhileasFogg
i've read that thread. but in winamp, at least, as far as i can tell, t you do need --nogap, unless you want to destroy intended gaps as well. Setting the track-change buffer to 500 shortens the gap, but you have to turn on the silence clipper to get truly gapless--and that crops off tracks that shouldn't be cropped--listening to abbey road i was startled by the tracks coming quickly after one another. Mind you even with --nogap you have to get the in_mpg123 pluging and set it to full buffering.

I recall testing a plugin which was only supposed to trim in the first/last frame, but i had trouble making it work. And even if i did make it work, i think i'd prefer this method because in this case the resuly is as gapless as you can get without relying on player support (even without mpg123, this is as gapless as it gets, afaics), and thus this is the best solution for minimizing/eliminating gaps when the future decoder/player is unknown.

someone had better correct me if i'm wrong!
PhileasFogg
oops, i forgot, for these rips to actually be GOOD you need --nogaptags in the command line in the batch file, too.

and otto, i'm not sure, but i think that's exactly what it does. I've been told that the bladeEnc feature did that, and i think lame nogap is the same thing. As far as not wanting to do that, well, because the playback is gapless, it will sound the same on a track transition. As far as burning a CD from the mp3s, you keep a Single File Wav cue file, and if you want to burn a cd, you decode the mp3s to wav, and joing them into one large wav, burn with the CUE (using EAC and proper write offsets of course!) and presto! -- you have a cd with an identical layout.

so, i don't see the disadvantage to --nogap, assuming what i said in the post above is true...
evereux
This plugin for Winamp should give you gapless playback of mp3 without the need for the --nogap switch.
mmortal03
Have you tried the mp3-splice plugin?

http://www.pyramidedata.dk/mp3splice.html
PhileasFogg
yes i've tried both of those (i already referenced in_mpg123 and mp3-splice is the pluging i was trying to remember above) i've even tried BOTH at the same time (mpg123 as input, mp3-splice as output!) i've tried the various settings, and even uninstalled all other input and output plugins. The result remains the same: i tested it on files encoded with -p --replaygain-accurate --clipdetect --preset standard %s %d and there were extremely noticeable gaps. If someone else is getting different results then tell me how you work your magic!!

(and again, even so, it would be nice to have files that playback gaplessly or near-gaplessly in everyone else's programs, not just in your own uber-tweaked edition)
PhileasFogg
oh, and there are 2 issues with sublame.bat:

-it chokes on files with a "!" in them (can't fix it! it's related to the !%Q! for delayedvariableexpansion) so i use "Bulk Rename Utility" to rename the ! to &&& before encoding and use it to name them back afterwards.

-using VBRfix is a waste of time, and can actually make things worse, so ignore that instruction. edit the lame.exe options to "lame.exe --preset standard --nogaptags --nogap %Q%"
and the files will have correct times, and gapless play back (but you still need in_mpg123 and Full Buffering set in that)
mmortal03
Can you post some samples?
Otto42
QUOTE(PhileasFogg @ Feb 18 2004, 11:38 AM)
so, i don't see the disadvantage to --nogap, assuming what i said in the post above is true...

Well, if that is the way it works, then there's no disadvantage if you *always* play albums in order and in entirety. If you shuffle though, you'll have a lot of weirdness. Songs will be missing the first few samples.. Songs will have samples at the end that won't correspond to the next track that actually plays. That sort of thing.

Seems like it would just be better for each track to be self contained and have a tag that specifies the actual last sample, which is what the LAME tag is for. Yes, it needs player support, but at least you don't get weirdness like that when shuffling. In other words, playing gapless isn't enough for me to want to screw with my songs files quite that much.

And heck, you need player support *anyway* because it's got to get its decoding and buffering right to play gapless, regardless of the encoding method.
PhileasFogg
mmortal03: I have a comprehensive set of samples here, but they are copyrighted tracks (two short tracks off abbey road)--can i post those here? How can i make samples from an uncopyrighted source?

Otto42: hmm i'll have to test that out -- i would've thought the segments would be so short as to be unnoticeable, especially considering that this is only really an issue when 2 tracks lead into one another, so it's not like it's clear where the 'right' ending was supposed to be anyway, *especially* for something like abbey road, which was originally on vinyl anyway (no embedded cues in that format, hehe).

What players have support for the lame tag anyway? as i said above, i couldn't get winamp or foobar to play gapless on a standard lame file made with EAC.
jesseg
edited
tigre
QUOTE(PhileasFogg @ Feb 19 2004, 03:34 AM)
mmortal03:  I have a comprehensive set of samples here, but they are copyrighted tracks (two short tracks off abbey road)--can i post those here?  How can i make samples from an uncopyrighted source?

For testing it's only allowed to post copyrighted samples that are shorter than 30 seconds.

You could do this:
Use a wave editor to replace the biggest part of the tracks by silence and keep only the first and last ~ 3 seconds of the tracks. This way you can upload samples that have the original lenght (or cut out some silence wink.gif ) and can be used for what you want, but don't violate forum rules.
PoisonDan
QUOTE(PhileasFogg @ Feb 18 2004, 09:21 PM)
yes i've tried both of those (i already referenced in_mpg123 and mp3-splice is the pluging i was trying to remember above)  i've even tried BOTH at the same time (mpg123 as input, mp3-splice as output!) i've tried the various settings, and even uninstalled all other input and output plugins.  The result remains the same: i tested it on files encoded with -p --replaygain-accurate --clipdetect --preset standard %s %d and there were extremely noticeable gaps.  If someone else is getting different results then tell me how you work your magic!!

You did remember to set the buffer-ahead time in the Winamp output plugin, did you ? Otherwise you won't get gapless playback with anything.

QUOTE
(and again, even so, it would be nice to have files that playback gaplessly or near-gaplessly in everyone else's programs, not just in your own uber-tweaked edition)

Did you miss the "hardly supported anywhere"-part from zZzZzZz's quote ?
PhileasFogg
ok i will make tests again with these plugins as well, and i will post them all later...

(yes i set the buffer ahead)

as far as nogap being hardly supported, wouldn't it be more supported than LAME tags? AFAIU any program that won't playback nogap files definitely won't play back regular lame files gaplessly!
Peter
QUOTE(PhileasFogg @ Feb 20 2004, 09:09 AM)
as far as nogap being hardly supported, wouldn't it be more supported than LAME tags?  AFAIU any program that won't playback nogap files definitely won't play back regular lame files gaplessly!

Wrong. --nogap requires MP3 decoder not to be reset between tracks, while lame tags don't.
There is quite a lot of hard-to-believe claims in your posts above, especially regarding in_mpg123 and foobar2000 not playing files with lame tags gaplessly. Please either verify them or post sample files that "don't play gaplessly" according to you, or you are in violation of TOS #8.
PhileasFogg
fair enough. I will post samples but it may be a few weeks from now, as i now have a ton of school work.
Peter
Please use the uploads forum for files with LAME tags that supposedly "don't play gaplessly".
"Having a ton of school work" is not a very good excuse for violating forum rules; please upload the samples or appropiate admin actions will be taken against you.
PhileasFogg
ok, just tying up some loose ends here:

i have resolved the problems i was having with regular lame encodes not playing gaplessly in this thread.

jesseg: yeah, you're right, EAC puts the m3u in the right dir, but doesn't put the log or the cue in the right dir, so the second part of SUBLAME is only important for .log and .cue.

note, however, that the cue file shouldn't have the path to the file in each line (or it won't play in foobar, for example) so you need to switch naming schemes in EAC when you save the cue. not that anyone needs .cue files for this purpose.. however in this thread i fantasize about a purpose for these cue files other than recreating the original cd when you burn..

finally, although i've found a way to get gapless playback in winamp and foobar without --nogap, this post mentions that some portable players, which don't read the lame tags, *will* play gaplessly if you give them --nogap files.. so as far as i can tell, --nogap files have slightly higher 'compatibility' for gapless playback, so someone looking to 'release' rips or something, might want to consider --nogap, not to mention the people who own one of these portables. In this case, my crude solution above is actually the easiest way untill EAC supports --nogap or something like that.. myself i will be making regular encodes now that my gapless problem is solved in winamp/foobar..

thanks everyone, and *please* correct me if you think i've got something wrong...

PS--several different people have suggested that --nogap files are somehow worse since they tinker with the 'real' file and will give you some kind of problems when you shuffle etc. but this I still don't understand, you can read some of my reasons
here, not to mention higher up in this thread you're reading...

i really don't understand what's the big disadvantage in a --nogap file, other than the extra steps to create them (which is why i won't be using --nogap).. <awaits your ideas>
Peter
* --nogap files will glitch (bit reservoir errors) when not played in correct order.
* Player that doesn't "support" --nogap will encounter decode errors at the beginning of most of --nogap files (bit reservoir from previous track) will either output garbage or show errors, or just skip a few first frames.
* Most of modern software players are unable to support --nogap by design (per-track instantiation of decoder class).
* --nogap files don't preserve exact length of CD tracks.
* As far as I'm aware of, hardware players that "support" --nogap also require LAME/Xing tag not to be present, so forget about accurate bitrate/length display for VBR files.

None of the issues above apply to LAME tags. Only serious "disadvantage" of LAME tags is your problem with EAC setup it seems.
PhileasFogg
aha! okay i think everything is clear now: --nogap only has a chance of being useful if your portable plays --nogap files gaplessly, but even then you have disadvantages.

one further question: what is the difference between upping the buffer-ahead in out_ds and using other plugins like out_mp3splice or out_nogap?? do they all compromise the time display?
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.