[Abcde-users] Apparently unconsistent handling of LEADOUT (CD-ROM drive vs. single-track flac file with embedded cuesheet)

Nicolas Boullis nboullis at debian.org
Sun Jan 12 23:07:37 GMT 2020


I have a CD that I am willing to archive as a single-track flac file and 
encode into MP3/vorbis files.
Usually, I do first archive the disc and then use the archive to encode 
it into MP3/vorbis files.

When I ran “abcde -1 -o flac -a default,cue -B”, abcde found my disc in 
musicbrainz and everything went fine.
But then, when I ran “abcde -o mp3,vorbis -a default,playlist -d 
my_disc.flac”, abcde failed to find my disc in musicbrainz.

I wanted to investigate and ran “abcde -VV -a cddb” with both the disc 
and the archive. With the disc, I got the following:
  makeids: PREGAP 32, LEADIN 150, LEADOUT 228585
while, with the archive, I got:
  makeids: PREGAP 32, LEADIN 150, LEADOUT 228617

You can see that the LEADOUT values differ by 32, which is the PREGAP 

So I started reading abcde’s do_discid function.

When reading from a flac file, it gets the number of samples of the flac 
file from the “REM FLAC__lead-out” line of its embedded cuesheet, 
divides it by the number of samples per frame (588 = 44100/75) to get 
the LBA of the LEADOUT. If there is a pregap before the start of the 
first track, it is included in the flac file, so the LEADOUT already 
accounts for that pregap.

On the other hand, when reading from a CD-ROM drive, abcde uses 
“cdparanoia -Q --verbose” to get the toc of the disc, and uses the 
“TOTAL” line as LEADOUT. But this is the sum of the lengths of the 
tracks, which does not account for the pregap.

Then in its “makeids” function, abcde calls “abcde-musicbrainz-tool 
--command calcid” with “$(($PREGAP + $LEADOUT))” as the lead-out sector. 
As I understand it, this is right when reading from a CD-ROM file, but 
wrong when reading from a flac file.

I think it would be better not to add the number of pre-gap sectors to 
the lead-out sector number in the “makeids” function, and change the 
computation of the LEADOUT value if the “do_discid” function when 
reading from a CD-ROM drive to account for the pregap.

I may write a patch for this but, before I do, I’d rather gather 
opinions on this.

For what it’s worth, my system is running Debian Stretch, with abcde and 
libwebservice-musicbrainz-perl from Debian Buster. Feel free to ask for 
more information if you think some important information is missing in 
my e-mail.


Nicolas Boullis

More information about the Abcde-users mailing list