back to index

LRC indexer


Purpose
      Peculiarities
Notes
Dependencies
Examples
Files

Purpose

Some music players allow displaying lyrics while playing a song. A popular way for this is the  LRC file formatEven some portable players are capable of handling it.

However, manual editing of the timecodes is cumbersome. The workaround is getting a program that takes lyrics in a plaintext format, and then adds timecodes semiautomatically, with a single keypress per line. For this, the lrc_indexer.sh was written.

The program takes a plaintext file on its input. Reads it line by line, after each line it waits for a keypress. Then it issues a HTTP query to the WinAmp player playing the song, using the HTTPQ plugin, retrieving the offset within the song in milliseconds. Reformats the value to minute:second.hundredth format, and writes the tagged line to the output .lrc file. Repeat until end of file.

Lines that are empty are passed through. Lines starting with '[' character, considered the LRC file tags, are passed through as well.

As humans are error-prone, the program allows undoing last line. That is done by outputting a line with UNDO mark, and reusing the previous output line. The wrongly timestamped lines have to be removed manually. The keys for this are either "x", "u", or "backspace". The program can be aborted prematurely by pressing "q".

Peculiarities

Some players do not cope well with national characters. The code as-is is filtering the ä and ö characters, replacing them with a: and o: notation, due to issues with Finnish language.

The MP4 watch is a pretty nice MP3 player with LRC support. However, in the LRC showing mode it does not allow seeking within the file being played (ow), it requires CR-LF line terminations (hence the unix2dos call on the output file), and terminates line shown when a higher than 0x7F character is encountered (hence the accented characters filtering). The watch also requires the minutes to be two-digit, leading-zero. (The DKE WinAmp plugin can cope with single or double digit.)

The Joseph's DKE Lyrics plugin also requires CR-LF terminators to correctly show empty lines.


Notes

This code has limited use as-is, as it depends on both a windows machine running WinAmp and a linux machine running this script. It can be however adapted to cooperate with other players, or even use its own clock source. Feel free to hack the code.


Dependencies

Linux side: unix2dos, curl, replace
Windows side: WinAmp, HTTPQ plugin


Examples

Sample input
Sample output (as text/plain)

Files

lrc_indexer.sh - the shell script (as text)
HTTPQ WinAmp plugin, third-party link
Joseph's DKE lyrics WinAmp plugin, third-party link

If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Spambait
Leave this empty!
Only spambots enter stuff here.
Feedback: