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

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.2.tar.gz (10.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.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lrcgen-0.1.2.tar.gz
  • Upload date:
  • Size: 10.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.2.tar.gz
Algorithm Hash digest
SHA256 414d79c221a01eb0f40d1ffba133fe339b8cdacdec381fbe9632d70a2a2a0808
MD5 b1a55b055a94a97c9e5516e9e0739924
BLAKE2b-256 bf725090c3903e852acfdae7f4d1c5f1c27a0db739e7f5c84fc0a19676fbca66

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lrcgen-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa0bdfc362106cdcefe3a6d3b1bb9799e3fe6967d07b33ead7e26b97a1915c0f
MD5 17209759f51ed0672568b9da02587df8
BLAKE2b-256 7d81bf3a1614ff00d127c428a9e6f87b3465d523b1e9119ba7e89ca365280959

See more details on using hashes here.

Provenance

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