AudioFileTags
data class AudioFileTags(val title: String? = null, val artist: String? = null, val album: String? = null, val trackNumber: Int? = null, val genre: String? = null, val year: Int? = null, val albumArt: ByteArray? = null)
Metadata tags associated with an audio file.
All properties are optional and default to null; a file may contain none, some, or all of these tags. The albumArt field, when present, contains the raw bytes of an embedded image (typically JPEG or PNG).
Tags can be read from existing files via AudioFileReader and AudioFileInfo.tags, or written into new files by passing an instance to the AudioFileWriter constructor.
Because albumArt is a ByteArray, this class provides custom equals and hashCode implementations that compare array contents rather than references.
Usage
// Reading tags from a file
val reader = AudioFileReader("/path/to/song.mp3")
val tags = reader.info.tags
println("Now playing: ${tags.title} by ${tags.artist}")
reader.close()
// Creating tags for a new file
val tags = AudioFileTags(
title = "My Song",
artist = "My Artist",
album = "My Album",
year = 2025,
)Content copied to clipboard