Skip to main content

Generate line-level .lrc and .srt lyric files from audio and reference lyrics

Project description

AutoLRC

AutoLRC generates line-level .lrc and .srt files from an audio file and a reference lyrics .txt file. A .json report is optional and is only written when --json-report is passed. LRC metadata applies only to the generated .lrc; source .wav and .mp3 files are not modified.

Primary release fixture:

  • audio: tests/fixtures/Major Revision.wav
  • lyrics: tests/fixtures/Major Revision.txt

Setup

Create a virtual environment, make sure ffmpeg is on PATH, then install one dependency set.

python3.12 -m venv .venv
. .venv/bin/activate
.venv/bin/python -m pip install --upgrade pip

# GPU
.venv/bin/python -m pip install torch --index-url https://download.pytorch.org/whl/cu128
.venv/bin/python -m pip install -e .[gpu,dev]

# CPU
.venv/bin/python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
.venv/bin/python -m pip install -e .[cpu,dev]

Check the runtime:

.venv/bin/autolrc doctor

Single File

Basic run:

.venv/bin/autolrc align --audio "tests/fixtures/Major Revision.wav" --lyrics "tests/fixtures/Major Revision.txt"

Useful options:

  • --title, --artist, --lang: add [ti], [ar], and [la] tags to the generated .lrc
  • --json-report: also write the sibling .json report
  • --separator-boost: align on a separated vocal stem
  • --save-vocals: keep the sibling .vocals.wav file

Examples:

.venv/bin/autolrc align --audio "tests/fixtures/Major Revision.wav" --lyrics "tests/fixtures/Major Revision.txt" --title "Major Revision" --artist "PiPi" --lang en
.venv/bin/autolrc align --audio "tests/fixtures/Major Revision.wav" --lyrics "tests/fixtures/Major Revision.txt" --json-report
.venv/bin/autolrc align --audio "tests/fixtures/Major Revision.wav" --lyrics "tests/fixtures/Major Revision.txt" --separator-boost --save-vocals

Defaults:

  • engine: stable-ts
  • model: medium
  • device: auto
  • separator: none
  • outputs: sibling .lrc and .srt

If a stable-ts run finishes with average_confidence < 0.5, inspect the output first and consider rerunning with --separator-boost.

Batch Mode

If --audio points to a directory, AutoLRC switches into batch mode.

.venv/bin/autolrc align --audio tests/fixtures --engine baseline
.venv/bin/autolrc align --audio tests/fixtures --artist "PiPi" --json-report --engine baseline

Batch rules:

  • search only the given directory, not subdirectories
  • match same-stem .wav or .mp3 files with a sibling .txt
  • prefer .wav when both .wav and .mp3 exist for one stem
  • continue after per-track failures
  • exit with code 1 if any matched track fails or if no valid pairs are found

Batch metadata:

  • --title and --lang are rejected
  • --artist is allowed
  • when --artist is provided, each generated .lrc gets [ar:<artist>] and [ti:<file-stem>]
  • when --artist is omitted, batch .lrc files stay metadata-free

Per-track outputs:

  • default: song.lrc, song.srt
  • with --json-report: also song.json
  • with --save-vocals: also song.vocals.wav

Release Checks

Run these before publishing to PyPI:

.venv/bin/python -m pytest -q
.venv/bin/python -m ruff check src tests
.venv/bin/python -m pre_commit run --all-files
.venv/bin/python -m build
.venv/bin/python -m twine check dist/*
.venv/bin/python -m autolrc benchmark --manifest bench/manifest.yaml

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

autolrc_tools-0.2.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autolrc_tools-0.2.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file autolrc_tools-0.2.0.tar.gz.

File metadata

  • Download URL: autolrc_tools-0.2.0.tar.gz
  • Upload date:
  • Size: 29.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for autolrc_tools-0.2.0.tar.gz
Algorithm Hash digest
SHA256 deb70fbccaac52806975cc3fec0f548c63be9ae9ace43266809b5d3fd877a540
MD5 e1ee7c96241ad22ec083dda8915cc503
BLAKE2b-256 fe483758cdc9fea3915f477b78d76d7f49b52bdb3ba036ad2e2a6a14aa9a404b

See more details on using hashes here.

File details

Details for the file autolrc_tools-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: autolrc_tools-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for autolrc_tools-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2586ff0c81978993c5a1e85d5ee4e9cdea12dfa4e682823a3e81e94d1e27d73
MD5 6446864874927e97a6535c1d1d256540
BLAKE2b-256 29c38a37ed8afc141c8178868ecf78b6ce115144df6a1b14f53c90f2a08dcf54

See more details on using hashes here.

Supported by

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