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.
PhoneticProvider is an interface for injecting phonetic romanization — such as Pinyin, Romaji, or any other transliteration scheme — into the lyrics parsing pipeline. It is used exclusively as a fallback by TTMLParser: when a TTML file contains no existing phonetic data (no x-roman spans, no embedded transliterations), the parser calls getPhonetic() to populate the phonetic fields on each line or syllable.
Interface definition
Members
phoneticLevel
getPhonetic() is called per lyric line.
The level of phonetic granularity this provider supports. Must be one of the
PhoneticLevel enum values.getPhonetic
TTMLParser for each line or syllable depending on phoneticLevel.
The source text to romanize. When
phoneticLevel is LINE, this is the full text content of a KaraokeLine. When phoneticLevel is SYLLABLE, this is the content of a single KaraokeSyllable."nǐ hǎo" for "你好"). Return an empty string if no romanization is available for the input.
PhoneticLevel enum
| Value | Granularity | Stored on |
|---|---|---|
LINE | One call per KaraokeLine | KaraokeLine.phonetic |
SYLLABLE | One call per KaraokeSyllable | KaraokeSyllable.phonetic |
Only
KaraokeLine and KaraokeSyllable carry phonetic fields. Plain SyncedLine entries (non-karaoke lines) are not passed to getPhonetic().Connection to TTMLParser and AutoParser
PhoneticProvider is wired into the parsing pipeline via the fallbackPhoneticProvider parameter on TTMLParser and AutoParser.
<span ttm:role="x-roman"> spans or embedded transliteration runs — getPhonetic() is never called for those entries and the existing data is preserved.
Example implementation
phoneticLevel to PhoneticLevel.LINE:
See also
- PhoneticProvider guide — full walkthrough with library integration examples
- TTMLParser — the parser that consumes
PhoneticProvider - AutoParser — forwards
fallbackPhoneticProvidertoTTMLParser