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: Command line tool to detect gapless album (Read 14315 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Command line tool to detect gapless album

All my CDs are ripped with EAC. First I do gap detection, then rip as Image+Cue, convert to FLAC. I'd like to know if a command line tool or script exists that takes the cue file as input and tells me, for example by exit code, if the album has two or more tracks with no silence inbetween (gap length 0).

Basically, I'm looking for a method to detect gapless albums without human intervention, just by automatically examining the cue sheet, that can be used in a script-based transcoding process.

Command line tool to detect gapless album

Reply #1
If the info text in cue file is formatted always the same then doesn't windows explorer's Search tool return those files which has the string you put in the search box?

Command line tool to detect gapless album

Reply #2
If the info text in cue file is formatted always the same then doesn't windows explorer's Search tool return those files which has the string you put in the search box?

Sure, I could also use grep within the console window. But what is the search string?

Command line tool to detect gapless album

Reply #3
If the info text in cue file is formatted always the same then doesn't windows explorer's Search tool return those files which has the string you put in the search box?
Sure, I could also use grep within the console window. But what is the search string?


I don't know (I've never used EAC) ... maybe the string is "Pre-gap length  0:00:00.00" ... so maybe "0:00.0" could be the searhed string?


You have all the tools there, just make sucha log least one entry has cap length 0 and then look how it's presented in log.

Command line tool to detect gapless album

Reply #4
This discussion seems to assume that data indexed by 00 is necessarily silent.  It also seems to assume that silence between tracks will always be indexed by 00.

These assumptions are false.

Command line tool to detect gapless album

Reply #5
The only way to know if the gap/index-00 portions of the audio are silent is to test the audio; the cue sheet, by design, holds the CD's non-audio info.

All my CDs are ripped with EAC. First I do gap detection


Since gap detection happens automatically when generating a cue sheet, the only reasons you would do it before the rip are:
  • You are checking to see if gap detection settings are good (not producing weird values) for this drive+CD combo before generating the cue sheet
  • You want gap info to be written to the log, even though it's also going into the cue sheet
  • You enjoy seeing gap info in the main window
  • You blindly follow ripping guides posted on illicit file sharing sites, without understanding what you are doing




Command line tool to detect gapless album

Reply #7
I wonder if this lack of gapless playback problem can't be solved by choosing a capable player and/or encoder.

If you (or anybody else) is aware of a 2-DIN car receiver with USB input and gapless MP3 playback, please let me know. I really searched hard and did not find a single one.

The reason why I would like to have a command line tool to detect gapless albums is that I want to keep the MP3 image then (and only then), and not just the files splitted from it using pcutmp3.

Command line tool to detect gapless album

Reply #8
  • You enjoy seeing gap info in the main window

Bingo. So, is it a misunderstanding on my side that a gap of 0s displayed in EAC means gapless?


Command line tool to detect gapless album

Reply #10
Just to get it right: Are you saying that the length of the gap is meaningless and even a zero length gap could actually contain audio? That sounds so weird--I'd assume that zero length always means null data, neither audio nor anything else.

Command line tool to detect gapless album

Reply #11
Gaps (also called pregaps or pre-gaps) are nothing more than audio data that is enumerated with a 00 index. This data may or may not contain silence. Discs with silence between tracks will not necessarily have this silence indexed as 00.

You need to divorce whatever idea you have that these "gaps" must always have something to do with gapless playback.

The only time you will know for sure that 00 indices contain silence is with CD-R/RWs that were burned as track-at-once, where the burning program places two seconds of silence between tracks. If there was silence at the ends of the source tracks then the silence written during the TAO process is additional.  Either way, the 00 indices on a TAO disc will only mark the two seconds of silence created during burning.

Command line tool to detect gapless album

Reply #12
Gaps (also called pregaps or pre-gaps) are nothing more than audio data that is enumerated with a 00 index. This data may or may not contain silence. Discs with silence between tracks will not necessarily have this silence indexed as 00.

You need to divorce whatever idea you have that these "gaps" must always have something to do with gapless playback.

The only time you will know for sure that 00 indices contain silence is with CD-R/RWs that were burned as track-at-once, where the burning program places two seconds of silence between tracks. If there was silence at the ends of the source tracks then the silence written during the TAO process is additional.  Either way, the 00 indices on a TAO disc will only mark the two seconds of silence created during burning.


Great explanation.  Thank you!

Command line tool to detect gapless album

Reply #13
Thank you. It looks my initial assumption that "gapless is equivalent to gaps with length 0" is false. Do I get your explanations right that such a tool that I am asking for would first need to consult the cue sheet to identify start and end time (or frame, respectively) of all gaps and then would have to analyze the audio in these areas if they really contain silence?


Command line tool to detect gapless album

Reply #15
The short answer is yes, to detect whether there are pauses in the audio, you have to analyze the audio. If you want to restrict where you look to just the sections that your ripper detected as being designated index 00 in the disc's subcode, that's your prerogative. There are plenty of CDs that have no index 00 portions but that do have pauses between songs. You also have to decide what "silence" is, and how much of it needs to be present. Pauses can be very quiet hiss, not "digital" silence (all zeroes), and there can be a DC offset. Also, the index 00 portions may not have been designated or detected with the utmost precision; it's normal for pauses to begin or end slightly off from where the boundaries are on the disc, and where they were detected to be.

It's an interesting project, although I don't see the point of it... They're your CDs, so surely you know which ones are DJ mixes & live albums, and which ones have separate songs.

Command line tool to detect gapless album

Reply #16
Thank you for taking the time to explain this to me, mjb. I have to admit that I still don't get it, and I can live with that. The initial question seems to be answered in that no such tool exists.

It's an interesting project, although I don't see the point of it... They're your CDs, so surely you know which ones are DJ mixes & live albums, and which ones have separate songs.

Things are not always as easy as they seem. I'm into Metal music and there are often intros that blend into the next song without any interruption of music--that's what I call "gapless", no matter what the technical correct relationship to audio gaps on the disc may be (btw, I didn't start that discussion). Also, I've got a couple of non-live discs where four or five songs (out of ten) are really one contiguous opus with no silence between the tracks.

Be it live discs, intros/outros, or otherwise concatened passages of music that the producer decided to divide into tracks, in all the cases that I looked at EAC shows me gap length 00:00 (zero). And my perhaps stupid assumption was that this must be detectable somehow in an automated way because I surely don't want to read in 1500 CDs in EAC just to figure out if there are gapless tracks. The majority of my discs has already been ripped in the past and 'm looking for a tool or script that can work on the images and doesn't require the physical disc.

Sorry for the ignorance.

Command line tool to detect gapless album

Reply #17
There are often intros that blend into the next song without any interruption of music--that's what I call "gapless",

As do the rest of us.

Quote
no matter what the technical correct relationship to audio gaps on the disc may be

There is no relationship.

Quote
(btw, I didn't start that discussion).

That part of the discussion was intended to keep you from wasting your time on a fool's errand.

Quote
The majority of my discs has already been ripped in the past and 'm looking for a tool or script that can work on the images and doesn't require the physical disc.

A tool to determine whether there is a silent pause at a track transition need not require a physical disc.  A good one will not pay any attention to 00 indicies, rather it should search around each 01 index between the first and last track.

Quote
Sorry for the ignorance.

I think the word is obstinance.

Command line tool to detect gapless album

Reply #18
I think the word is obstinance.

I'd prefer to call it tenacity 

You haven't commented on my observation that EAC always shows 00:00 (zero) gap length.
This is a very clear indication and I'd draw no connection to "searching around" - is that what EAC does under the hood?

Command line tool to detect gapless album

Reply #19
Giving credence to your "eureka" moment would be silly.  You might as well be claiming that all machines with tires are bicycles.  Titles that have silence between tracks which have no 00 indices are commonplace. This single fact invalidates your position...completely.

EAC searches subcode data for index information in order to determine the length of "gaps" (READ: audio marked with a 00 index), not audio data.

To give you some insight, a typical use-case for a 00 index is to prompt a CD player to display the track time so that it counts up from a negative value to zero when transitioning to the next track. CD players also use this index to skip over audio when in shuffle or program play mode.

Command line tool to detect gapless album

Reply #20
Titles that have silence between tracks which have no 00 indices are commonplace. This single fact invalidates your position...completely.

I can't follow.

A := EAC shows gap length 0 for track x
B := Track x is gapless
C := Tracks can contain silence anywhere, including the appended gap (True)
D := Silence in the gap must not necessarily be 00 indexed (True)

I said: If A, then B
You say: Because of C and D, what I say can't be true

But there's no connection between what I said and what you are claiming is disproving me--I never mentioned C.

Just to cite the HA wiki on gap calculation: "With the info here, one now might be able to, given any CUE, calculate all gap lengths and, if needed, edit the CUE Sheet to convert from one format to the other."

So what is actually missing, assuming that the information in the wiki is correct? What is preventing a more capable programmer than I am to calculate the gap length for each track from the cue sheet, and, if the gap length is 0, output "gapless track"?


Command line tool to detect gapless album

Reply #21
*SIGH*

In EAC a "gap" (as shown in the GUI, log file or cue sheet) is the audio data marked with a 00 index.  It is not the same as the concept of a gap as it relates to gapless playback.  Being "tenacious" will not change this.

If track X has no 00 index, EAC will show a gap length of 0 regardless of whether it is preceded by silence.  The same is true for track X+1.

Since if not B, then not A is a false statement, if A, then B is also a false statement.

How many more times must I repeat this for it to sink in?

Command line tool to detect gapless album

Reply #22
So what is actually missing, assuming that the information in the wiki is correct? What is preventing a more capable programmer than I am to calculate the gap length for each track from the cue sheet, and, if the gap length is 0, output "gapless track"?

I saw greynol's last post (which says basically the same thing), but I'll add this anyway (because I already typed it):

I think the confusion may come from two different definitions of "gap" in this context.

One definition is areas of a CD that the TOC decribes as index 00.

Another definition would be "a silent, or near silent, period of audio near the transition of consecutive tracks on a CD". This is what most people mean when referring to "gaps" or "gapless".

The two definitions sometimes refer to the same thing, but often do not. There can be silent audio between tracks with no index 00 and there can be index 00 gaps with no silence in them. The only way to determine true silent gaps is to examine the audio data.


Command line tool to detect gapless album

Reply #24
[I started writing this before David's reply was posted; we're all saying the same thing, though.]

"EAC shows gap length 0 for track x" = Without regard for how silent the audio is, EAC checked to see if the CD itself designates any portion of the track as index 00, and no such portions could be found. So if a cue sheet was generated, it would not contain an INDEX 00 or PREGAP line for that track.

"Track x is gapless" = Without regard for what index #s are encoded on the disc, and regardless of what EAC detected, you know by listening to it that this is a continuous mix CD or live album or whatever. There are no pauses (stretches of silent audio) near the track boundaries.

Two different types of gap.

When EAC talks about gaps, it is only talking about what the CD has designated as index 00. Ordinarily, no matter what ripper you use, these sections are present in the rip at the end of each track's file. So, when you play each track's file, as you get near the end of the file, the audio maybe goes silent for a couple seconds. If the CD had designated that silent portion as the next track's index 00, then in a real CD player, the track number would've advanced by 1 and the timer would show a count-up like -0:03, -0:02, -0:01, 0:00.

EAC is unique among rippers in that it gives you the option of either removing these sections (useful when ripping a CD-R burned in TAO mode) or putting them at the beginning of each track file (matching how tracks are actually written on the disc, allowing the cue sheet to be compliant, but not what we are used to listening to).

Does this help?