Skip to content

mattWoolly/mwAudioAutoChop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mwAudioAutoChop

One-line description: Automatically split continuous vinyl rips into individual tracks with sample-exact, lossless precision.

What It Does

Two operating modes:

Reference mode: Align a vinyl rip to reference audio (CD rip, WEB files) and derive split points from track boundaries. Uses full-track cross-correlation to find where each reference track appears in the vinyl.

Blind mode: Detect track boundaries by finding where program audio decays into vinyl surface noise, using spectral flatness, RMS energy, and onset detection.

The Lossless Guarantee

Output samples are byte-identical to the source. No resampling, no bit-depth conversion, no normalization, no dithering, no fades. The tool computes WHERE to split; the split itself is a raw byte copy. CI enforces this with SHA-256 hash verification.

Supported Formats

  • Input: WAV, RF64, AIFF (any sample rate and bit depth)
  • Reference: WAV, AIFF, FLAC, MP3, OGG, M4A (any format librosa can read)
  • Output: WAV (matching source bit depth and sample rate)

Installation

# Clone
git clone https://github.com/mattWoolly/mwAudioAutoChop.git
cd mwAudioAutoChop

# Create virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install
pip install -e .

# Or for development
pip install -e ".[dev]"

Usage

Reference Mode

Split a vinyl rip using reference tracks (most accurate):

# Reference directory of per-track files (recommended)
mw-audio-auto-chop reference vinyl_side_a.wav -r reference_tracks/ -o output/

# Single reference file
mw-audio-auto-chop reference vinyl_side_a.wav -r reference.wav -o output/

# Dry run (preview splits without writing)
mw-audio-auto-chop reference vinyl_side_a.wav -r reference_tracks/ -o output/ --dry-run

# Verbose output with per-track evidence
mw-audio-auto-chop reference vinyl_side_a.wav -r reference_tracks/ -o output/ -v

Reference files can be in any format (FLAC, MP3, WAV, etc.) and at any sample rate — they're only used for alignment analysis, not for output.

Blind Mode

Split without reference audio (detects gaps between tracks):

mw-audio-auto-chop blind vinyl_side_a.wav -o output/

# Adjust gap detection sensitivity
mw-audio-auto-chop blind vinyl_side_a.wav -o output/ --min-gap 1.5 --max-gap 30

Common Options

Flag Description
-o, --output-dir Output directory for track files
-v, --verbose Show per-track alignment evidence
--dry-run Preview splits without writing files
--confidence N Filter splits below confidence threshold (default: 0.0)
--skip-lead-in N Seconds of vinyl lead-in to skip (default: auto-detect)
--no-chroma Use waveform correlation instead of chromagram

Reference Mode Options

Flag Description
-r, --reference Reference file or directory (required)
--drift-correct Enable piecewise drift correction (default: on)
--search-window N Search window around reference boundaries in seconds (default: 5.0)
--format FORMAT Output format: WAV or AIFF (default: match input)

Blind Mode Options

Flag Description
--noise-floor-db N Manual noise floor in dB (default: auto-detect)
--min-gap N Minimum gap between tracks in seconds (default: 2.0)
--max-gap N Maximum gap between tracks in seconds (default: 30.0)

How It Works

Reference Mode Pipeline

  1. Load vinyl at analysis sample rate (22050 Hz)
  2. Detect lead-in — find where music starts (skips groove noise)
  3. Per-track alignment — cross-correlate each reference track against the full vinyl to find its exact position
  4. Boundary refinement — adjust split points using energy and onset features
  5. Byte-copy split — write output files by copying raw bytes from source

Architecture

mw_audio_auto_chop/
├── io.py              # Lossless I/O (raw byte-copy output)
├── alignment.py       # Cross-correlation, per-track alignment
├── reference_mode.py  # Reference mode pipeline
├── blind_mode.py      # Blind mode (noise-floor detection)
├── analysis.py        # Audio feature extraction (RMS, spectral, onset)
├── split_points.py   # Data structures, confidence scoring
└── cli.py            # Thin CLI consumer

Library layer + thin CLI — designed for a future GUI.

Development

# Run tests
pytest -v

# Run linter
ruff check .

# Run on test data (if available)
mw-audio-auto-chop reference test_data/target_test.wav -r test_data/reference/ -o test_data/output/

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages