Skip to main content

AI-powered LRC generator with Whisper and LLM correction

Project description

lrcgen

AI-powered LRC generator using Whisper + optional LLM correction.

Install

pip install lrcgen

Optional extras:

# enable online LLM correction
pip install "lrcgen[online]"

# enable OpenCC (Traditional→Simplified conversion)
pip install "lrcgen[opencc]"

# enable both
pip install "lrcgen[full]"

Requirements

  • Offline transcription uses Whisper models (first run may download model files).
  • Online correction requires OPENAI_API_KEY (or a compatible API via OPENAI_BASE_URL).

Usage

# batch
lrcgen input/ output/
lrcgen input/ output/ --offline
lrcgen input/ output/ --online

# single file
lrcgen --audio input/song.mp3 --output out.lrc --offline

# choose whisper model/language
lrcgen --audio input/song.mp3 --output out.lrc --offline --model small --language zh

# lyrics-guided generation (use your full lyrics as the "source of truth")
# lyrics can be out-of-order; txt or lrc both work
lrcgen --audio input/song.mp3 --output out.lrc --offline --lyrics-file input/lyrics.txt

# module entrypoint (same as lrcgen command)
python -m lrcgen --audio input/song.mp3 --output out.lrc --offline

# version
python -m lrcgen --version

Online config

Set env vars (e.g. via .env):

  • OPENAI_API_KEY=...
  • OPENAI_BASE_URL=https://api.openai.com/v1 (optional)
  • OPENAI_MODEL=gpt-4o-mini (optional)

Library usage

from lrcgen.api import generate_lrc_sync

generate_lrc_sync("input/song.mp3", "out.lrc", mode="offline")

Project structure

genlrc/
	README.md
	pyproject.toml
	music_to_lrc_batch.py
	lrcgen/
		__init__.py        # package version
		__main__.py        # enables: python -m lrcgen
		cli.py             # argparse CLI entrypoint
		api.py             # stable library API (sync + async)
		whisperer.py       # Whisper transcription wrapper
		corrector.py       # optional LLM correction + guardrails
		lyrics_aligner.py  # align transcript lines to user-provided full lyrics
		utils.py           # time formatting + basic text cleaning
		config.py          # env/.env config (OPENAI_*, etc.)
		input/             # optional local test inputs (not packaged)
		output/            # optional local outputs (not packaged)
	test/
		test.py            # small unittest suite
	tools/
		clean.py           # removes dist/build/cache artifacts
	.github/workflows/
		ci.yml             # CI build + checks
		publish.yml        # tag-based publish via PyPI Trusted Publishing (OIDC)

How it fits together:

  • CLI: lrcgen/cli.py parses args and calls lrcgen/api.py.
  • Core pipeline: whisperer.py transcribes audio → utils.py cleans → corrector.py optionally fixes lines → writes .lrc.
  • Configuration: config.py loads environment variables (and .env if present).

Features

  • Offline Whisper transcription
  • Optional LLM correction
  • Simplified Chinese output
  • Batch processing

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

lrcgen-0.1.4.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

lrcgen-0.1.4-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file lrcgen-0.1.4.tar.gz.

File metadata

  • Download URL: lrcgen-0.1.4.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lrcgen-0.1.4.tar.gz
Algorithm Hash digest
SHA256 24a7859f063bee48c5df5212413d56df4cd3766042aa66254adfe3b5831502dd
MD5 b76d529149931a2628839cec2dce5602
BLAKE2b-256 01c6068d005693862c5d8d88eb2ce82a125be36d1c6e698e11320d377b5ae8f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for lrcgen-0.1.4.tar.gz:

Publisher: publish.yml on lihan3238/genlrc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lrcgen-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: lrcgen-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lrcgen-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9757688defffe93baedec65bf96c06826e3ee8ed3386cfb829f657becbbbe8ec
MD5 fbf6f051175f1960ed12c19902bf701a
BLAKE2b-256 41694a57c422dcfc977f5d7011485ba0304315ad4476f4aa5f4c63f40fdee064

See more details on using hashes here.

Provenance

The following attestation bundles were made for lrcgen-0.1.4-py3-none-any.whl:

Publisher: publish.yml on lihan3238/genlrc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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