LRC Kit
lrc parser and runner
Install
npm
npm i -S lrc-kit
Lrc
Usage
import
;
parse lyric
var lrc = Lrc lrcinfo// { ti: 'Title', ar: 'Lyrics artist' } lrclyrics// [{// content: "i guess you're my creep tonight",// timestamp: 9.01// }, {// content: "i guess you're my creep tonight",// timestamp: 30.0// }]
make lyric
var lrc = lrcinfo'ar' = 'Lyrics artist'lrclyricslrclyrics lrc// [ar:Lyrics artist]// [00:30.00][00:09.01]i guess you're my creep tonight lrc// [ar:Lyrics artist]// [00:09.01]i guess you're my creep tonight// [00:30.00]i guess you're my creep tonight lrclrc// [ar:Lyrics artist]// [00:27.00][00:06.01]i guess you're my creep tonight
API
Lrc.parse(text): parse lyirc text and return a lrc object
Lrc object
- lrc.info lyric info plain object
{
'ar': 'Lyrics artist',
'al': 'Album where the song is from',
'ti': 'Lyrics (song) title',
'au': 'Creator of the Songtext',
'length': 'music length, such as 2:50',
'by': 'Creator of the LRC file',
'offset': '+/- Overall timestamp adjustment in milliseconds, + shifts time up, - shifts down',
're': 'The player or editor that created the LRC file',
've': 'version of program',
}
- lrc.lyrics lyric array
[
{
content: "i guess you're my creep tonight",
timestamp: 9.01,
},
{
content: "The way you knock me off my feet",
timestamp: 12.08,
},
]
-
lrc.offset(offset) offset all lyrics
-
lrc.toString(options) generate lyric string
- options.combine (boolean) lyrics combine by same content
- options.sort (boolean) lyrics sort by timestamp
- options.lineFormat (string) newline format
Runner
Usage
import
;
run
var runner = Lrc audio // Modify lyricrunnerlrclyricsrunner // Must call lrcUpdate() when update lyrics
API
new Runner(lrc = new Lrc(), offset=true)
lrc
lrc objectoffset
parse lrc.info.offset if offset is true
Runner object
- runner.setLrc(lrc) reset the lrc object
- runner.lrcUpdate() call it when lrc updated
- runner.timeUpdate(timestamp) time update
- runner.getInfo() get
runner.lrc.info
- runner.getLyrics() get
runner.lrc.lyrics
- runner.curIndex() current index
- runner.curLyric() current lyric