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.

LRC files can carry a small set of metadata tags at the top of the file. Accompanist Lyrics Core parses these into two data classes: Attributes, which holds the song-level metadata fields, and Artist, which represents a single credited performer. While Attributes is produced internally by the parser’s metadata helper, its values are surfaced directly on SyncedLyrics — you access the title through lyrics.title and the artist list through lyrics.artists.

Attributes

Attributes maps the five standard LRC metadata tags to typed Kotlin properties. Every field is nullable and defaults to null, since any tag may be absent in a given file.
data class Attributes(
    val artist: String? = null,
    val album: String? = null,
    val title: String? = null,
    val offset: Int? = null,
    val duration: Int? = null,
)

Constructor parameters

artist
String?
default:"null"
The raw artist string from the [ar:] tag. When the file contains multiple artists they are represented as separate Artist objects on SyncedLyrics.artists rather than concatenated here.
album
String?
default:"null"
Album name from the [al:] tag. null when the tag is absent.
title
String?
default:"null"
Song title from the [ti:] tag. On SyncedLyrics this surfaces as the non-nullable title property (empty string when absent).
offset
Int?
default:"null"
Global timing offset in milliseconds from the [offset:] tag. A positive value shifts all timestamps later; a negative value shifts them earlier. null when the tag is absent (no adjustment applied).
duration
Int?
default:"null"
Total song duration in milliseconds from the [length:] tag. null when the tag is absent.

Properties

artist
String?
Raw artist string from [ar:]. null if not present in the file.
album
String?
Album name from [al:]. null if not present.
title
String?
Song title from [ti:]. null if not present.
offset
Int?
Global timestamp offset in milliseconds from [offset:]. null when absent.
duration
Int?
Total duration in milliseconds from [length:]. null when absent.

LRC tag mapping

LRC tagAttributes fieldType
[ti:Song Title]titleString?
[ar:Artist Name]artistString?
[al:Album Name]albumString?
[offset:200]offsetInt? (ms)
[length:210000]durationInt? (ms)

Relationship to SyncedLyrics

Attributes is an internal type produced by the parser. After parsing, its values are promoted directly onto the SyncedLyrics object:
  • Attributes.titleSyncedLyrics.title (non-nullable; empty string when absent)
  • Attributes.artistSyncedLyrics.artists (parsed into a List<Artist>)
You do not need to interact with Attributes directly when consuming a fully parsed SyncedLyrics.

Artist

Artist represents a single credited performer on a track. The artists list on SyncedLyrics contains one Artist per credited name.
data class Artist(
    val type: String,
    val name: String
)

Constructor parameters

type
String
required
The role or category of the artist (e.g. "main", "featured", "ar"). The exact vocabulary depends on the source format — for standard LRC the type reflects the tag name used.
name
String
required
The display name of the artist (e.g. "Taylor Swift").

Properties

type
String
The artist role or category string.
name
String
The artist display name.

Usage examples

Accessing metadata from SyncedLyrics

val lyrics: SyncedLyrics = parsedLyrics

// Title is always non-nullable on SyncedLyrics
println(lyrics.title)   // e.g. "Shake It Off"

// artists is nullable — null means no artist info at all
lyrics.artists?.forEach { artist ->
    println("${artist.type}: ${artist.name}")
    // e.g. "ar: Taylor Swift"
}

Guarding against absent artist info

val creditLine: String = when {
    lyrics.artists.isNullOrEmpty() -> "Unknown artist"
    else -> lyrics.artists!!.joinToString(", ") { it.name }
}

Example LRC file and resulting model

[ti:Hello]
[ar:Adele]
[al:25]
[offset:0]
[length:295000]
[00:25.73]Hello, it's me
[00:31.40]I was wondering if after all these years
Parsing this file yields:
SyncedLyrics(
    title = "Hello",
    artists = listOf(Artist(type = "ar", name = "Adele")),
    lines = listOf(
        SyncedLine(content = "Hello, it's me", start = 25730, end = 31400, translation = null),
        SyncedLine(content = "I was wondering if after all these years", start = 31400, end = ..., translation = null),
    ),
    id = "0"
)
The offset and duration values from Attributes are consumed by the parser during processing. After parsing, the offset has already been applied to all line timestamps — there is no separate offset field on SyncedLyrics.

Build docs developers (and LLMs) love