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.
KaraokeLine is the sealed interface for lyrics lines that carry syllable-level timing — the building block for animated, word-by-word highlighting. It extends ISyncedLine and adds a list of KaraokeSyllable objects, alignment information for multi-singer layouts, and optional phonetic annotations.
There are two concrete subtypes: MainKaraokeLine for the primary vocalist (which may embed AccompanimentKaraokeLine tracks), and AccompanimentKaraokeLine for background or harmony vocals. Both enforce end >= start in their init blocks.
Sealed interface: KaraokeLine
Interface properties
Ordered list of syllables that make up this line. See
KaraokeSyllable.Optional translation of the full line;
null when not provided.Visual alignment hint for multi-singer layouts. See
KaraokeAlignment below.Start time of the line in milliseconds.
End time of the line in milliseconds.
Optional phonetic (romanized) representation of the full line;
null when absent.Computed as
end - start in each concrete subtype. Inherited from ISyncedLine.Interface methods
progress(current: Int): Float
[0.0, 1.0].
| Condition | Return value |
|---|---|
current < start | 0.0 |
current in start..end | (current - start) / duration |
current > end | 1.0 |
Current playback position in milliseconds.
isFocused(current: Int): Boolean
true when current falls within [start, end]. Use this to decide whether to render the line as active (e.g. apply a highlight color or scale animation).
Current playback position in milliseconds.
MainKaraokeLine
The primary lyrics line. May embed a list ofAccompanimentKaraokeLine objects for background vocals that sing simultaneously.
Syllables for the main vocal line.
Optional translation of the line.
Alignment hint for display —
Start, End, or Unspecified.Start time in milliseconds. Must be ≤
end.End time in milliseconds. Must be ≥
start; otherwise construction throws IllegalArgumentException.Optional phonetic annotation for the full line.
Zero or more accompaniment (background/harmony) vocal lines that overlap with this main line.
null when the format carries no accompaniment data.Additional property
Embedded accompaniment lines.
null indicates no accompaniment; an empty list means the field was explicitly set to none.AccompanimentKaraokeLine
A background or harmony vocal line. Structurally identical toMainKaraokeLine but without the accompanimentLines field. Instances of this type are typically found nested inside MainKaraokeLine.accompanimentLines.
Syllables for the accompaniment vocal.
Optional translation of the accompaniment line.
Alignment hint; typically
KaraokeAlignment.End to visually separate it from the main line.Start time in milliseconds. Must be ≤
end.End time in milliseconds. Must be ≥
start; otherwise construction throws IllegalArgumentException.Optional phonetic annotation.
KaraokeAlignment
An enum that communicates the intended visual alignment of a line within a multi-singer UI layout.The line should be aligned to the leading edge (typically the primary vocalist, left in LTR layouts).
The line should be aligned to the trailing edge (typically a second vocalist or background harmony, right in LTR layouts).
No alignment preference. The UI can apply its own default, or center the line.
Extension functions
KaraokeLine.copy()
KaraokeLine subtypes without requiring a when expression. Delegates to the data class copy() of the underlying concrete type, preserving the runtime type.
This extension does not expose
accompanimentLines. To change accompanimentLines on a MainKaraokeLine, cast to MainKaraokeLine and call its data class copy() directly.KaraokeLine.toSyncedLine()
SyncedLine by joining all syllable content strings (trimmed). Useful when you need to fall back to line-level display or serialize to a simpler format.