Skip to content

lrc_general

Ediel Chedlyramber edited this page Apr 15, 2021 · 4 revisions

This page specifies how WEBSF.Spec treats data structured in LRC, xLRC and TRC formats.

Structure

Format Structure

<metadata area>
<lyrics>

Parsing

Escaping

This behaviour does not exist in the original LRC specification.

The parser uses the \ character as the hint of escaping. Unlike normal parsers, this only processes \n, \\, \<, \>, \[ and \].

Events

A line that starts with [ is treated as an event announcement. It could indicate the declaration of metadata or a line of lyrics.

If a number is behind [, the line is treated as lyrics. If a letter is behind [, the line is treated as metadata. Otherwise, it should silently throw an error, and ignore the line.

Comments

This behaviour does not exist in the original LRC specification.

The parser should treat # and // as the symbols for commenting. A line is treated as a comment if it begins with #. All of the characters after the // symbols in the same line is treated as a comment.

Events

Metadata

Stackable

Metadata tags in this category will co-exist and stack upon each other.

If you want to declare multiple tags and still make them be indexed correctly in the media player, this is a way to do it.

  • ar or artist: Artist of the music. Arbitrary text.
  • au or author: Author of the lyrics. Arbitrary text.
  • by: Creator of the lyrics file. Arbitrary text.
  • gr or genre: Genre of the music. Arbitrary text, or an ID3 genre ID (#0 for Blues). Case insensitive. Read more...

Overwritable

Metadata tags in this category will overwrite each other. The latter should always overwrite the last.

  • al or album: Arbitrary text.
  • img: Album cover image. Use data URIs or IPFS URIs. Accepts BMP, JPEG, GIF, PNG and WEBP.
  • length: Length declared in ((hh:)mm:)ss.xx format. Will also be overwritten by total.
  • offset: 32-bit signed integer (long). Offset declared in milliseconds.
  • re: Arbitrary text.
  • ti or title: Arbitrary text.
  • total: 32-bit unsigned integer (long). Length declared in milliseconds. Will also be overwritten by length.
  • tr or track: 8-bit unsigned integer (short).
  • ve: Arbitrary text.
  • yr or year: 16-bit unsigned integer.

Lyrics

Plain text

The basic form of lyrics text.

Timed text

Allows two forms of timing: xLRC style and TRC style.

<> are time tags, which are used to define the duration of the part behind the tag. If the text inside the brackets contains . (points) or : (colons), it is considered a xLRC-style annotation, otherwise, it will be considered as a TRC-style annotation. Different types of annotations in tags are not allowed to be mixed, or it will silently throw an error, and make the lyric in the current line in plain text.

xLRC style

xLRC-styled annotations use the hh:mm:ss:xxx format. It declares when to end each part.

TRC style

TRC-styled annotations use integers. It declares the length of each part in milliseconds.

Example

metadata

[ar:Pinkie Pie] // [artist:Pinkie Pie]
[au:Daniel Ingram] // [author:Daniel Ingram]
[al:It's a Pony Kind of Chrismas] // [album:It's a Pony Kind of Chrismas]
[ti:Pinkie's Present] // [title:Pinkie's Present]
[gr:ragtime] // [genre:#0]
[yr:2016] // [year:2016]
[length:((00:)01:)46.604]
[total:106604]
[by:Ediel Chedlyramber]
[tr:14] // [track:14]
[offset:+1000]
[re:WEBSF.Spec/dev WebMP/0.30]
[ve:0.30]
[img:data:image/jpeg;base64,P]

lyrics

[00:00.3] First line
[00:00.76] Line 1
[00:01.200] Line 2
[00:00:03.27] Line 3
[00:00:04.128] Line 4