https://github.com/quark-zju/loop-detect
Detect loop body of an audio track
https://github.com/quark-zju/loop-detect
Last synced: 3 months ago
JSON representation
Detect loop body of an audio track
- Host: GitHub
- URL: https://github.com/quark-zju/loop-detect
- Owner: quark-zju
- License: mit
- Created: 2024-01-01T19:53:44.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-27T19:21:25.000Z (10 months ago)
- Last Synced: 2025-01-08T08:45:52.312Z (5 months ago)
- Language: Rust
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Detect loops in audio files.
Useful for [certain](https://rainbowdragoneyes.bandcamp.com/album/the-messenger-original-soundtrack-disc-ii-the-future) kinds of [tracks](https://music.apple.com/us/artist/falcom-sound-team-jdk/120174391).
For example, if a track consists of these parts:
[ head ] [ loop start | loop middle | loop end ] [ loop start ] [ tail ]
This program can figure out the start and end of `[ loop ]` so the track can be played like:
[ head ] [ loop ] [ loop ] [ loop ] ...
Requires `ffmpeg` binaries:
- `ffmpeg`: Decode audio files.
- `ffprobe` and `ffplay`: Read channel information, play audio streams (optional, only used by playback).## Examples
Analyze a track. This usually takes less than 1 second:
$ loop-detect track.flac
{"start": 6.3, "end": 111.9, "confidence": 0.88}Analyze, then play in an infinite gapless loop:
$ loop-detect -p track.flac
...Analyze multiple files:
$ loop-detect -q *.flac
{"a.flac":{"start":4.2,"end":106.6,"confidence":0.99},"b.flac":null}To get indented JSON output, use:
$ loop-detect -q *.flac | python3 -m json.tool
## Library interface
This project also provides a library interface for the loop detection algorithm. I intend to integrate it with [foobar2000](https://www.foobar2000.org/).
## License
MIT