Skip to content

easyLRC

Small C++ library for parsing LRC and eLRC files

Features

  • Parse standard LRC – Simple timestamped lyrics ([mm:ss.xx]Line text)
  • Parse extended LRC (eLRC) – Word-level timestamps for karaoke-style lyrics ([mm:ss.xx]<mm:ss.xx>Word)
  • Extract embedded lyrics – Read lyrics directly from audio file metadata (via FFmpeg)
  • Sidecar file support – Automatically loads .lrc files alongside audio files
  • Multi-voice support – Handle duets with v1: and v2: voice tags
  • Multiple output formats – Render lyrics as XML, HTML, or JSON
  • Timestamp queries – Get current line/word at any playback position

Formats Supported

Format Description
Standard LRC Line-level timestamps ([00:05.00]Lyrics line)
Extended LRC (eLRC) Word-level timestamps ([00:05.00]<00:05.00>Word <00:05.50>next)
Embedded (LRC/eLRC) Lyrics stored in audio file metadata (ID3, etc.)

CLI Usage

# Detect LRC file type
ezlrc -t <path>

# Get line at specific timestamp (ms)
ezlrc -lt <path> <ms>
ezlrc -slt <path> <ms>   # Force standard LRC
ezlrc -elt <path> <ms>   # Force extended LRC

# Render to different formats
ezlrc -rxml <path> <ms> [custom_tag]
ezlrc -rhtml <path> <ms>
ezlrc -rjson <path> <ms>

Library Usage

#include <easylrc/parser.h>
#include <easylrc/render.h>

easylrc::Parser parser;
parser.load_lrc("/path/to/song.flac");

// Get line at 5 seconds
auto line = parser.std_get_line_by_timestamp(5000);

// Render as HTML
easylrc::Render renderer;
std::string html = renderer.render_html(parser.get(), 5000);

// Clean as parser is not needed anymore
parser.clear();

Dependencies

  • FFmpeg (libavformat, libavutil)
  • libmagic (probably file-devel)

Build

Built with Meson:

meson setup build --prefix=/usr
meson compile -C build

License

zlib/libpng license