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: finding if two files are continuous (gap detection)? (Read 5974 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

finding if two files are continuous (gap detection)?

Hi Folks,

I'm trying to determine if two audio files have a gap between them.  For instance if the end of track 0, transitions into the beginning of track 1 with no gap.

I suspect there is some audio processing here and thought the sox list would be a good place to start.  For instance, the last sample of track 0 could have perhaps close amplitude level as first sample of track 1.  Other considerations would be frequency analysis.  I'm hoping there is some tool or low level library that could accomplish this automatically.

Anyone have any suggestions or could point me in the right direction?

Thanks

finding if two files are continuous (gap detection)?

Reply #1
Are these lossy or lossless files ?

finding if two files are continuous (gap detection)?

Reply #2
Are these lossy or lossless files ?


Lossless.  FLAC files converted to WAV.

Why?  Would lossy require more heuristics?

finding if two files are continuous (gap detection)?

Reply #3
Are these lossy or lossless files ?


Lossless.  FLAC files converted to WAV.

Why?  Would lossy require more heuristics?


At the moment, I'm inspecting the two files with http://www.sonicvisualiser.org, which displays a spectogram of the audio.  I'm thinking a good match could be made here using three factors for the last samples of track 0 and first few samples of track 1.  Using silence gap, change in RMS amplitude for the samples and spectrum match for the samples.  Obviously some hueristic would need to be applied.  I'm hoping to avoid reinventing the wheel here.

There are some other tools that appear to look at frequency domain, which I'm still investigating:
http://dream.cs.bath.ac.uk/software/sndan/mqan.html
http://dream.cs.bath.ac.uk/software/sndan/pvan.html

Suggestions are appreciated.

Thanks

finding if two files are continuous (gap detection)?

Reply #4
Measuring time is easiest in the time domain. If they are lossless this is easiest. Just take the RMS power of the signal in the last fraction of a second and pick a threshold.

finding if two files are continuous (gap detection)?

Reply #5
Measuring time is easiest in the time domain. If they are lossless this is easiest. Just take the RMS power of the signal in the last fraction of a second and pick a threshold.



I have been playing with the Sound Visualiser (open source) to see if there is any relationship between the last few seconds of track 0 to the first few seconds of track 1 which may suggest that the two tracks are contiguous.  For instance, the second half of The Beadatles Abbey Road album has contiguous "gapless" tracks.  I'm hoping to detect such tracks with audio analysis and additional information from the original CD (each audio file represents a track from a CD, unfortunately may not include a TOC with gap info).  This may have some similar goals as a spectrogram is involved.

So far ideas are to use knowledge that each audio file represented a real track on the CD and the following:

o Use RMS volume between samples, variance should be minimal
o Spectrum analysis between samples
    + Peak Bins between samples
o Use Melodic analysis between samples
    + dB for certain percentage of frequencies line up between samples
    + Phase?

Here are some screenshots which displays Track 10 and 11 joined together.  These two tracks play from a CD contiguously without gap from 2:26:26 position (cursor is there in screenshots).  Thoughts on this are appreciated.

http://imageshack.us/a/img708/7442/rfg9.png
http://imageshack.us/a/img209/4337/ard.jpg
http://imageshack.us/a/img96/8233/if3i.jpg