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.
ILyricsParser is the core interface every lyrics parser in Accompanist Lyrics Core implements. It defines a format-detection method and two mutually-delegating parse overloads, so you only need to provide one parsing implementation — the other is wired up automatically via the default method bodies.
Interface definition
Methods
canParse
true if this parser is capable of handling its format. This method is called by AutoParser to select the correct parser automatically, and can also be used directly when you want to validate content before parsing.
The full raw lyrics string to inspect. Examine headers, structure, or magic bytes to determine format compatibility.
true if the parser can handle this content, false otherwise.
parse(lines: List<String>)
SyncedLyrics object.
The lyrics content already split into individual lines.
SyncedLyrics instance containing the parsed lines and metadata.
The default implementation joins
lines with "\n" and forwards to parse(content: String). If you implement the String overload, you get this for free and do not need to override it.parse(content: String)
SyncedLyrics object.
The full raw lyrics string, with lines separated by
"\n".SyncedLyrics instance containing the parsed lines and metadata.
The default implementation splits
content on '\n' and forwards to parse(lines: List<String>). If you implement the List<String> overload, you get this for free and do not need to override it.Implementing one parse overload is enough
Because the twoparse overloads each delegate to the other by default, implementing exactly one of them is sufficient. The unused overload will call through to your implementation automatically.
Minimal custom implementation
parse(lines: List<String>) is not overridden here — it will automatically join the list and call your parse(content: String) implementation.
Built-in parsers
All built-in parsers implementILyricsParser. You can use them directly or register them with AutoParser.
EnhancedLrcParser
Parses standard and enhanced (syllable-timed) LRC files. Declared as an
object singleton.TTMLParser
Parses TTML/Apple Music lyrics XML. Instantiated as a
class to accept an optional fallbackPhoneticProvider.LyricifySyllableParser
Parses the Lyricify Syllable JSON format. Declared as an
object singleton.KugouKrcParser
Parses Kugou KRC files. Declared as an
object singleton.AutoParser
A composite parser that tries each of the above in order and delegates to the first one whose
canParse() returns true. Pass a custom ILyricsParser in its parsers list to extend it with your own format.Using a custom parser with AutoParser
AutoParser itself implements ILyricsParser, so it can be used anywhere a parser is expected — including nested inside another AutoParser.See also
- Writing a custom parser — full step-by-step guide
- AutoParser — composite parser that auto-detects format
- SyncedLyrics — the data model returned by all parsers