ASS to LRC Converter
A Pythonic CLI application to convert ASS (Advanced SubStation Alpha) subtitle files to LRC (Lyrics) format with support for enhanced word-level timing.
Features
- OOP Design: Clean, maintainable object-oriented architecture with dedicated classes for parsing, conversion, and data models
- Bidirectional Conversion: Convert between ASS and LRC formats
- Enhanced LRC: Generates
.elrcfiles with word-level timing from\Kkaraoke tags - Simple LRC: Standard LRC format without word timing
- Compact Format: Merge repeated lyrics with multiple timestamps (e.g., choruses)
- Expand Command: Convert compact LRC back to standard sorted format
- LRC to ASS: Convert LRC files back to ASS format with karaoke timing support
- Metadata Support: Automatically extracts and converts metadata tags (artist, lyricist, album, etc.)
- Comment Events: Support both ASS Comment events and effect=tag for metadata
- Effect-Based Line Breaks: Automatically add line breaks when effect contains "break"
- Configurable Gaps: Add customizable gaps between lyric lines
- Typer CLI: Modern, user-friendly command-line interface with subcommands
Installation
pip install -e .
Usage
Basic Usage
# Convert ASS to enhanced LRC (default)
ass2lrc convert input.ass
# Outputs: input.elrc
Commands
convert - Convert ASS to LRC
Convert ASS subtitle files to LRC lyrics format.
ass2lrc convert [OPTIONS] INPUT_FILE
Arguments:
INPUT_FILE- Path to input ASS file (required)
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--output |
-o |
Output LRC file path | Same as input with .lrc/.elrc extension |
--enhanced |
-e |
Generate enhanced LRC with word timing | enabled |
--simple |
-s |
Generate simple LRC (line timing only) | disabled |
--compact |
-c |
Use compact format (multiple timestamps per line) | disabled |
--gap |
-g |
Gap in seconds between lines (≥0.0) | 1.0 |
--version |
-v |
Show version and exit | - |
--help |
Show help message | - |
Examples:
# Convert to enhanced LRC (default)
ass2lrc convert song.ass
# Convert to simple LRC
ass2lrc convert song.ass --simple
# Specify output file
ass2lrc convert song.ass -o lyrics.lrc
# Custom line gap (0.5 seconds)
ass2lrc convert song.ass --gap 0.5
# Compact format for repeated lyrics
ass2lrc convert song.ass --compact
# Enhanced LRC with custom gap
ass2lrc convert song.ass -e -g 0.8 -o song.elrc
# Simple LRC with no gap
ass2lrc convert song.ass -s -g 0
expand - Expand Compact LRC
Expand compact LRC format to standard sorted format.
ass2lrc expand [OPTIONS] INPUT_FILE
Arguments:
INPUT_FILE- Path to input compact LRC file (required)
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--output |
-o |
Output expanded LRC file path | Input with _expanded suffix |
--help |
Show help message | - |
Examples:
# Expand compact LRC to standard format
ass2lrc expand compact.lrc
# Specify output file
ass2lrc expand compact.lrc -o expanded.lrc
lrc2ass - Convert LRC to ASS
Convert LRC lyrics files back to ASS subtitle format.
ass2lrc lrc2ass [OPTIONS] INPUT_FILE
Arguments:
INPUT_FILE- Path to input LRC file (required)
Options:
| Option | Short | Description | Default |
|---|---|---|---|
--output |
-o |
Output ASS file path | Same as input with .ass extension |
--karaoke |
-k |
Generate karaoke timing tags from enhanced LRC | enabled |
--no-karaoke |
-K |
Disable karaoke tags (plain text only) | disabled |
--help |
Show help message | - |
Examples:
# Convert enhanced LRC to ASS with karaoke tags
ass2lrc lrc2ass song.elrc
# Convert simple LRC to ASS without karaoke
ass2lrc lrc2ass song.lrc --no-karaoke
# Specify output file
ass2lrc lrc2ass lyrics.lrc -o subtitles.ass
Global Options
# Show version
ass2lrc --version
# Show help
ass2lrc --help
# Show help for specific command
ass2lrc convert --help
ass2lrc expand --help
ass2lrc lrc2ass --help
ASS Format Requirements
Metadata Tags
Include metadata using Comment events or Dialogue lines with effect=tag:
Method 1: Comment events (recommended)
Comment: 0,0:00:00.00,0:00:00.00,Default,ti,0,0,0,,Song Title
Comment: 0,0:00:00.00,0:00:00.00,Default,ar,0,0,0,,Artist Name
Comment: 0,0:00:00.00,0:00:00.00,Default,lr,0,0,0,,Lyricist Name
Method 2: Dialogue with effect=tag
Dialogue: 0,0:00:00.00,0:00:02.00,Default,ti,0,0,0,tag,Song Title
Dialogue: 0,0:00:00.00,0:00:02.00,Default,ar,0,0,0,tag,Artist Name
Dialogue: 0,0:00:00.00,0:00:02.00,Default,lr,0,0,0,tag,Lyricist Name
Supported metadata tags (following LRC specification):
ti: Title of the songar: Artist performing the songal: Album the song is fromau: Author of the songlr: Lyricist of the songlength: Length of the song (mm:ss)by: Author of the LRC file (not the song)offset: Global offset value for lyric times in milliseconds (e.g., +100 or -50)re/tool: The player or editor that created the LRC fileve: The version of the program#: Comments (can have multiple)
Karaoke Timing
Use \K or \k tags for syllable timing (in centiseconds):
Dialogue: 0,0:00:00.62,0:00:07.52,Default,,0,0,0,,{\K72}Text{\K106}Here
Effect-Based Line Breaks
Lines with an effect field containing "break" (case-insensitive) will automatically add an empty line after them in the LRC output:
Dialogue: 0,0:00:10.00,0:00:12.00,Default,,0,0,0,linebreak,First verse
Dialogue: 0,0:00:13.00,0:00:15.00,Default,,0,0,0,,Second verse
This will produce:
[00:10.00]First verse
[00:12.00]
[00:13.00]Second verse
Compact Format
The compact format merges identical lyrics that appear at different times into a single line with multiple timestamps. This is useful for repeated sections like choruses.
Example:
Standard format:
[00:10.00]Chorus line here
[00:30.00]Chorus line here
[00:50.00]Chorus line here
Compact format:
[00:10.00][00:30.00][00:50.00]Chorus line here
Architecture
The application is structured using OOP principles:
models.py: Data classes forSyllable,LyricLine, andMetadataparser.py:ASSParserclass for parsing ASS fileslrc_parser.py:LRCParserclass for parsing LRC filesconverter.py:LRCConverterclass for generating LRC outputass_converter.py:ASSConverterclass for generating ASS outputexpander.py:LRCExpanderclass for expanding compact formatcli.py: Typer-based command-line interface
Development
Running Tests
# Install dev dependencies
pip install -e ".[dev]"
# Run all tests
pytest tests/ -v
# Run specific test file
pytest tests/test_parser.py -v
# Run with coverage
pytest tests/ --cov=ass2lrc --cov-report=term-missing
Code Quality
# Lint with ruff
task lint
# Format code
task format
# Type check
task typecheck
# Run all checks
task qa
Using Task
Available commands:
task # Show all available tasks
task install # Install package
task install-dev # Install with dev dependencies
task test # Run tests
task test-cov # Run tests with coverage
task lint # Run linter
task format # Format code
task typecheck # Type checking
task qa # Run all quality checks
task clean # Remove generated files
task build # Build distribution packages
task publish-test # Publish to TestPyPI
task publish # Publish to PyPI
Install Task from: https://taskfile.dev/installation/
License
See LICENSE file for details.
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Quick Start
# Clone repository
git clone https://github.com/nattadasu/ass-to-lrc.git
cd ass-to-lrc
# Setup development environment (uses uv)
task dev
# Make changes and test
task qa
Commit Convention
This project follows Conventional Commits.
Format: <type>(<scope>): <subject>
Example: feat(converter): Add compact LRC format support
Pre-commit hooks will automatically validate your commits. See CONTRIBUTING.md for full guidelines.
Metadata
Release files for ass-to-lrc 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ass_to_lrc-0.4.0.tar.gz | 62.4 kB | With provenance | Details for ass_to_lrc-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ass_to_lrc-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for ass_to_lrc-0.4.0-py3-none-any.whl |
Total release size: 79.9 kB
Release files / ass_to_lrc-0.4.0.tar.gz
| Download URL | ass_to_lrc-0.4.0.tar.gz |
|---|---|
| Size | 62.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1df2ca52b89d3ea7d046a4bf5f2e1503a2f06ae1409ba0dbd3870d8769d4004
|
|
BLAKE2b-256 checksum How to use checksums |
2c7c8f91ee2ee5325cff1c52ffceea23051d483a19a3afbbec58573ce38f6512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2025.
Transparency logRelease files / ass_to_lrc-0.4.0-py3-none-any.whl
| Download URL | ass_to_lrc-0.4.0-py3-none-any.whl |
|---|---|
| Size | 17.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
235feec3f43c52e9c067b1365a4c906458c6e902b848abe356e41d01194ec273
|
|
BLAKE2b-256 checksum How to use checksums |
9d3459e08e80012f4f517c50f2321c02fccd97f0dde577084a1bfb0033448ba4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2025.
Transparency logSecurity for ass-to-lrc 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for ass_to_lrc-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.