#lyrics #file-format #karaoke #synced #synchronize

lrc

A pure Rust implementation of LyRiCs which is a computer file format that synchronizes song lyrics with an audio file

9 releases

0.1.8 Sep 9, 2023
0.1.7 Mar 17, 2022
0.1.6 Apr 21, 2021
0.1.5 Mar 10, 2021
0.1.0 Apr 6, 2020

#412 in Value formatting

Download history 9/week @ 2024-11-20 16/week @ 2024-11-27 5/week @ 2024-12-04 26/week @ 2024-12-11 167/week @ 2024-12-18 16/week @ 2024-12-25 10/week @ 2025-01-08 23/week @ 2025-01-15 14/week @ 2025-01-22 10/week @ 2025-01-29 53/week @ 2025-02-05 2/week @ 2025-02-12 10/week @ 2025-02-19 40/week @ 2025-02-26 3/week @ 2025-03-05

58 downloads per month
Used in cmus-notify

MIT license

24KB
555 lines

LRC

CI

A pure Rust implementation of LyRiCs which is a computer file format that synchronizes song lyrics with an audio file.

Examples

use lrc::{Lyrics, IDTag, TimeTag};

let mut lyrics = Lyrics::new();

let metadata = &mut lyrics.metadata;
metadata.insert(IDTag::from_string("ti", "Let's Twist Again").unwrap());
metadata.insert(IDTag::from_string("al", "Hits Of The 60's - Vol. 2 – Oldies").unwrap());

lyrics.add_timed_line(TimeTag::from_str("00:12.00").unwrap(), "Naku Penda Piya-Naku Taka Piya-Mpenziwe").unwrap();
lyrics.add_timed_line(TimeTag::from_str("00:15.30").unwrap(), "Some more lyrics").unwrap();


assert_eq!(
    r"[al: Hits Of The 60's - Vol. 2 – Oldies]
[ti: Let's Twist Again]

[00:12.00]Naku Penda Piya-Naku Taka Piya-Mpenziwe
[00:15.30]Some more lyrics",
    lyrics.to_string()
);
use lrc::{Lyrics, TimeTag};

let lyrics = Lyrics::from_str(r"[00:12.00][01:15.00]Naku Penda Piya-Naku Taka Piya-Mpenziwe
[00:15.30][01:18.00]Some more lyrics ...").unwrap();

if let Some(index) = lyrics.find_timed_line_index(TimeTag::from_str("00:13.00").unwrap()) {
    let timed_lines = lyrics.get_timed_lines();

    assert_eq!((TimeTag::from_str("00:12.00").unwrap(), "Naku Penda Piya-Naku Taka Piya-Mpenziwe".into()), timed_lines[index]);
} else {
    unreachable!();
}

Crates.io

https://crates.io/crates/lrc

Documentation

https://docs.rs/lrc

License

MIT

Dependencies

~2.4–4MB
~72K SLoC