Skip to main content

Check gap between tracks

Project description

pypi-version License

Check gap between tracks. Join the tracks if you want.


My hated (and loved at the same time) stereo.


Test if one song continues with the next. Like all songs from The Dark Side of the Moon. Optionally join songs.

System requirements


$ pip install gapcheck



usage: gapcheck [-h] [-e EXTENSION] [-p PATH] [-s SECONDS] [-a MAX_AMPLITUDE]
                [-j] [-f] [-d] [-r] [-v]

optional arguments:
  -h, --help            show this help message and exit
  -e EXTENSION, --file-extension EXTENSION
                        File extension (default FLAC)
  -p PATH, --path PATH  Path (default current path)
  -s SECONDS, --last-analyzed-seconds SECONDS
                        Last analyzed seconds (default 0.2)
  -a MAX_AMPLITUDE, --limit-maximum-amplitude MAX_AMPLITUDE
                        Limit maximum amplitude (default 0.0099)
  -j, --join-files-with-gap
                        Join files with gap
  -f, --analyze-already-tested
                        Analyze files already tested
  -d, --verbose         Prints extra debugging information
  -r, --reverse         Return the files to the original state
  -v, --version         show program's version number and exit

About check gap

To detect if a track has a gap:

  • Analyze the last 0.2 seconds

  • Analyze whether the maximum amplitude is greater than 0.0099

Both values are parameterizable

About join songs

When joining songs in a new file, the following tags are added:

  • GAPLESS_JOIN: Total songs joined

  • GAPLESS_LAST_TRACK: Last song joined

  • GAPLESS_LAST_DISCNUMBER: Last disc song joined

The title of the song will be the union of all the songs joined.


# Check all flac from current dir recursive, with last 5 seconds
$ gapcheck -p . -e 'flac' -s 5.0

# Check, but ignore files in __backup or with gapcheck.log file present
$ gapcheck -f

# Check and join
$ gapcheck -j

# Reversal of all changes made when joining
$ gapcheck -r

A real example

Let’s test and join with Radiohead’s album OK Computer.

$ pwd

$ gapcheck -j
directory: music/1997-Radiohead-OK_Computer
date: 2017-08-09 09:17:52
extension: flac
sox_last_seconds: 0.2
sox_max_amplitude: 0.0099
files_checked: 12
files_ignored: 0
files_with_gaps: 4
 - 01-radiohead-airbag.flac
 - 04-radiohead-exit_music_(for_a_film).flac
 - 06-radiohead-karma_police.flac
 - 07-radiohead-fitter_happier.flac
file_joined: 01-radiohead-airbag__GAPLESS.flac
 - 01-radiohead-airbag.flac
 - 02-radiohead-paranoid_android.flac
file_joined: 04-radiohead-exit_music_(for_a_film)__GAPLESS.flac
 - 04-radiohead-exit_music_(for_a_film).flac
 - 05-radiohead-let_down.flac
file_joined: 06-radiohead-karma_police__GAPLESS.flac
 - 06-radiohead-karma_police.flac
 - 07-radiohead-fitter_happier.flac
 - 08-radiohead-electioneering.flac

Now we remove the changes.

$ pwd

$ gapcheck -r
reverse_dir: music/1997-Radiohead-OK_Computer
extension: flac
files_restored: 7
 - __BACKUP_01-radiohead-airbag.flac_bck -> 01-radiohead-airbag.flac
 - __BACKUP_02-radiohead-paranoid_android.flac_bck -> 02-radiohead-paranoid_android.flac
 - __BACKUP_04-radiohead-exit_music_(for_a_film).flac_bck -> 04-radiohead-exit_music_(for_a_film).flac
 - __BACKUP_05-radiohead-let_down.flac_bck -> 05-radiohead-let_down.flac
 - __BACKUP_06-radiohead-karma_police.flac_bck -> 06-radiohead-karma_police.flac
 - __BACKUP_07-radiohead-fitter_happier.flac_bck -> 07-radiohead-fitter_happier.flac
 - __BACKUP_08-radiohead-electioneering.flac_bck -> 08-radiohead-electioneering.flac
files_deleted: 3
 - 01-radiohead-airbag__GAPLESS.flac
 - 04-radiohead-exit_music_(for_a_film)__GAPLESS.flac
 - 06-radiohead-karma_police__GAPLESS.flac



Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gapcheck-0.10.1.tar.gz (12.0 kB view hashes)

Uploaded source

Built Distribution

gapcheck-0.10.1-py3-none-any.whl (16.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page