Metadata-Version: 2.4
Name: autolrc-tools
Version: 0.2.1
Summary: Generate line-level .lrc and .srt lyric files from audio and reference lyrics
Author: PiPi
License: MIT
License-File: LICENSE
Keywords: alignment,lrc,lyrics,srt,whisper
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.13,>=3.11
Requires-Dist: pyyaml<7.0.0,>=6.0.1
Requires-Dist: typer<1.0.0,>=0.12.3
Provides-Extra: cpu
Requires-Dist: audio-separator[cpu]>=0.26.0; extra == 'cpu'
Requires-Dist: rapidfuzz>=3.9.0; extra == 'cpu'
Requires-Dist: stable-ts>=2.17.0; extra == 'cpu'
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: pre-commit>=4.0.1; extra == 'dev'
Requires-Dist: pytest>=8.3.4; extra == 'dev'
Requires-Dist: ruff>=0.11.0; extra == 'dev'
Requires-Dist: twine>=6.1.0; extra == 'dev'
Provides-Extra: gpu
Requires-Dist: audio-separator[gpu]>=0.26.0; extra == 'gpu'
Requires-Dist: rapidfuzz>=3.9.0; extra == 'gpu'
Requires-Dist: stable-ts>=2.17.0; extra == 'gpu'
Description-Content-Type: text/markdown

# AutoLRC

Generates line-level `.lrc` and `.srt` files from an audio file and a reference lyrics `.txt`. Source audio is never modified.

## Setup

Requires Python 3.12 and `ffmpeg` on `PATH`.

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

# GPU (CUDA 12.8)
pip install torch --index-url https://download.pytorch.org/whl/cu128
pip install -e .[gpu,dev]

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

Verify the install:

```bash
autolrc doctor
```

## Single File

```bash
autolrc align --audio song.wav --lyrics song.txt
```

Outputs `song.lrc` and `song.srt` alongside the audio file.

**Key options:**

| Option | Effect |
|---|---|
| `--title`, `--artist` | Write `[ti]`, `[ar]` tags to the LRC |
| `--lang <code>` | Override language (default: auto-detected) |
| `--separator-boost` | Separate vocals before aligning (improves noisy tracks) |
| `--save-vocals` | Keep the separated stem as `song.vocals.wav` |
| `--json-report` | Write a `song.json` quality report |
| `--model` | Whisper model size: `base`, `small`, `medium` (default), `large-v3` |
| `--device` | `auto` (default), `cuda`, or `cpu` |

The `[la]` tag is written automatically from the detected language; `--lang` overrides it.

If alignment finishes with `average_confidence < 0.5`, inspect the output and consider rerunning with `--separator-boost`.

**Examples:**

```bash
# With metadata tags
autolrc align --audio song.wav --lyrics song.txt --title "Song Name" --artist "Artist"

# With vocal separation and quality report
autolrc align --audio song.wav --lyrics song.txt --separator-boost --save-vocals --json-report
```

## Batch Mode

Pass a directory to `--audio` to process all matching pairs at once:

```bash
autolrc align --audio ./my-songs/
autolrc align --audio ./my-songs/ --artist "Artist" --json-report
```

**Rules:**
- Scans the given directory only (not recursive)
- Matches same-stem `.wav`/`.mp3` with a sibling `.txt`; prefers `.wav` when both exist
- Continues on per-track failures; exits with code `1` if any track fails
- `--title` and `--lang` are rejected; `--artist` is allowed
- When `--artist` is given, each LRC gets `[ar:<artist>]` and `[ti:<file-stem>]`

**Per-track outputs:** `song.lrc`, `song.srt`, and optionally `song.json`, `song.vocals.wav`

## Other Commands

```bash
autolrc inspect --lyrics song.txt   # Preview normalized lyric lines
autolrc doctor                      # Show runtime diagnostics
autolrc cache clear                 # Remove the local cache directory
```
