Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/6xingyv/accompanist-lyrics-core/llms.txt

Use this file to discover all available pages before exploring further.

Accompanist Lyrics Core ships with parsers for every major lyrics file format used by modern music streaming services and karaoke applications. Each parser implements a common interface so they are interchangeable, and an AutoParser ties them all together for effortless format detection.

The ILyricsParser interface

Every parser in the library implements ILyricsParser, which defines three methods:
interface ILyricsParser {
    fun canParse(content: String): Boolean
    fun parse(lines: List<String>): SyncedLyrics
    fun parse(content: String): SyncedLyrics
}
canParse
(content: String) → Boolean
Returns true if this parser recognises the format of the given content string. Used by AutoParser to pick the right parser automatically.
parse(lines)
(lines: List<String>) → SyncedLyrics
Parses a pre-split list of lines. The default implementation joins the list with \n and delegates to the String overload.
parse(content)
(content: String) → SyncedLyrics
Parses a raw string of lyrics content. The default implementation splits on \n and delegates to the List overload.
All parsers return a SyncedLyrics object whose lines list contains a mix of SyncedLine and KaraokeLine instances depending on how much timing detail the format carries.

Available parsers

FormatClassHow it is detected
Standard LRCEnhancedLrcParserPresence of [dd:dd.dd] timestamp pattern
Enhanced LRC (syllable)EnhancedLrcParserSame detection; syllable brackets activate karaoke output
TTML (Apple Music)TTMLParserPresence of http://www.w3.org/ns/ttml in content
Lyricify SyllableLyricifySyllableParserPattern [a-zA-Z]+\s*\(\d+,\d+\)
Kugou KRCKugouKrcParserLine time [\d+,\d+] combined with word time <\d+,\d+,\d+>
EnhancedLrcParser handles both standard LRC (line-level timing only) and Enhanced LRC (syllable-level timing). The parser automatically produces SyncedLine or KaraokeLine output based on the content it finds.
For most applications you should reach for AutoParser. It tries each registered parser in order and delegates to the first one that claims it can handle the content:
val autoParser = AutoParser()
val lyrics = autoParser.parse(content) // format detected automatically
See the AutoParser page for details on configuring parser order, supplying a PhoneticProvider, and registering custom parsers.

Detection order in AutoParser

AutoParser iterates its parser list and calls canParse on each entry. The first match wins. The default order is:
  1. TTMLParser
  2. LyricifySyllableParser
  3. EnhancedLrcParser
  4. KugouKrcParser
TTML is checked first because its XML namespace string is highly specific and unambiguous. Lyricify Syllable is checked before Enhanced LRC because the Lyricify word(start,duration) notation would not be mistaken for standard LRC timestamps, but the reverse could theoretically overlap on edge-case files.

Individual parser pages

AutoParser

Automatic format detection and delegation. The right starting point for all new integrations.

LRC

Standard LRC with line-level timestamps and ID3-style metadata tags.

Enhanced LRC

Enhanced LRC with syllable timing, voice tags, and background vocal lines.

TTML

Apple Music TTML with syllable spans, transliterations, and multi-agent voices.

Lyricify Syllable

Lyricify App format with (startMs, durationMs) syllable notation and alignment codes.

Kugou KRC

Kugou Music KRC with line/word timestamps, embedded phonetics, and colon role markers.

Build docs developers (and LLMs) love