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

# 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
		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.3.tar.gz (10.6 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.3-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lrcgen-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 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.3.tar.gz
Algorithm Hash digest
SHA256 df12cb85ffd69601839f1552e4f68aab2409fd33824cd770d17018228bee0537
MD5 20d0c0154cdd61f6033457076c75bee5
BLAKE2b-256 59bc0a81e60b951b2cabd2c37890e982b6cc69affbd1f5ff43675a323f96838c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lrcgen-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: lrcgen-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.2 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f76d944564923d47eb68b3064ed563adad2d92d133f09306b3e49177827e5a5
MD5 eba34558f0ec8e3ec994fc36a563bcb2
BLAKE2b-256 0862c9d997721e48fb9bebdb46143365532d90b3412cccbdfb7860cc6d902d20

See more details on using hashes here.

Provenance

The following attestation bundles were made for lrcgen-0.1.3-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