Last updated:
0 purchases
lyrics parser
.lrc file parser and lyrics tracker written in Dart. #
Features #
Parse .lrc file or Lrc Format string
Track the the result of parsing
What is .lrc file. #
From Wikipedia, Lrc Format is a text-based and be used to synchronize song lyrics and audio.
Supported parsing rules #
All ID tag mentioned in Wikipedia.
Both minutes:seconds.milliseconds and minutes:seconds time tags are supported.
Comment symbol([:]). lyrics_parser will ignore the content after the symbol in this line.
Multiple lyrics or ID tag in one line.
Undefined tag for backward compatible.
No tagged lyric in some special situations.
Usage #
From lyrics string:
import 'package:lyrics_parser/lyrics_parser.dart';
// ...
final string = '...';
final parser = LyricsParser(string);
final result = await parser.parse();
copied to clipboard
From .lcr file:
import 'package:lyrics_parser/lyrics_parser.dart';
// ...
final file = File('./resources/See You Again.lcr');
final parser = LyricsParser.fromFile(file);
// Must call ready before parser.
await parser.ready();
final result = await parser.parse();
copied to clipboard
The doc contains more details about how to get lyrics meta information from result.
Example Usage #
in example/example.dart
import 'dart:io';
import 'package:lyrics_parser/lyrics_parser.dart';
void main(List<String> args) async {
final file = File('./resources/See You Again.lcr');
final parser = LyricsParser.fromFile(file);
await parser.ready();
final result = await parser.parse();
for (final lyric in result.lyricList) {
print('${lyric.startTimeMillisecond}: ${lyric.content}');
}
}
copied to clipboard
the result in console is just like:
11210: It's been a long day without you my friend
17310: And I'll tell you all about it when I see you again
23750: We've come a long way from where we began
...
copied to clipboard
LICENSE #
MIT License
Copyright (c) 2021 fusée-code-lab
LICENSE file
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.