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.
AutoParser is the recommended entry point for parsing lyrics files when the format is not known ahead of time. It holds an ordered list of ILyricsParser implementations, calls canParse on each in sequence, and delegates to the first parser that claims the content. You get a single, consistent API regardless of whether the file is TTML, KRC, LRC, or any custom format you register.
Constructor
An optional
PhoneticProvider forwarded to TTMLParser when using the default parser list. It is applied to TTML lines that carry no existing phonetic annotation. Has no effect on other parsers. Ignored when you supply a custom parsers list unless you wire it up yourself.The ordered list of parsers to try. Defaults to
[TTMLParser, LyricifySyllableParser, EnhancedLrcParser, KugouKrcParser]. The first parser whose canParse returns true is used. Provide a custom list to change priority, exclude formats, or add your own parsers.Basic usage
Instantiate with the defaults and callparse. The format is detected automatically:
parse returns a SyncedLyrics object. If no registered parser recognises the content, an empty SyncedLyrics(emptyList()) is returned rather than throwing an exception.
Checking before parsing
UsecanParse to verify that at least one registered parser can handle a piece of content before committing to a full parse:
canParse returns true when any parser in the list returns true for the same content.
Default detection order
The default parser list is evaluated in this sequence:TTMLParser
Detects Apple Music TTML by checking for the
http://www.w3.org/ns/ttml namespace string. The XML namespace is highly specific, so this check almost never produces false positives.LyricifySyllableParser
Detects the Lyricify Syllable format by looking for the
word(startMs,durationMs) pattern. Checked before Enhanced LRC because its detection pattern is distinct from LRC timestamps.EnhancedLrcParser
Detects standard and Enhanced LRC by checking for a
[dd:dd.dd] timestamp pattern. Produces SyncedLine for plain LRC and KaraokeLine when syllable timing brackets are present.First match wins. If content somehow satisfies multiple
canParse checks, only the first matching parser in the list is used. Keep this in mind when reordering or adding parsers.With a PhoneticProvider
Supply aPhoneticProvider to have TTMLParser annotate TTML lines with phonetic readings when none are embedded in the file:
TTMLParser in the default parsers list. It is not applied to LRC, Lyricify Syllable, or KRC output.
Custom parser order
Pass an explicitparsers list to control priority or exclude formats you don’t need:
Registering a custom parser
Any class that implementsILyricsParser can be inserted into the list. Override canParse to return true only for your format, then implement parse to return a SyncedLyrics:
Result type
AutoParser.parse always returns SyncedLyrics. Inspect SyncedLyrics.lines to find out which concrete types were produced: