How to manage lyrics coming from LRC files
LRC is a text-based file format that synchronizes song lyrics with an audio file. When an audio file is played with certain music players on a computer or on modern digital audio players, the song lyrics are displayed. The lyrics file generally has the same name as the audio file, for example MySong.mp3 and MySong.lrc.
LRC files can be in 2 different formats:
Simple LRC format was introduced by Kuo (Djohan) Shiang-shiang's Lyrics Displayer. It was one of the first computer programs, if not the first, that attempted to simulate Karaoke performance. It usually displays a whole line of lyrics by creating a time tag for each line.
The Line Time Tags are in the format [mm:ss.xx] where mm is minutes, ss is seconds and xx is hundredths of a second.
[mm:ss.xx] lyrics line 1
[mm:ss.xx] lyrics line 2
[mm:ss.xx] last lyrics line
ID Tags may appear before the lyrics, although some players may not recognize or simply ignore this.
[ti:Lyrics Title ]
[by:Creator of the LRC file]
[re:the player or the editor that creates LRC file]
[ve:version of program]
Example with ID tags:
[ti:Let's Twist Again]
[ar:Chubby Checker oppure Beatles, The]
[au:Written by Kal Mann / Dave Appell, 1961]
[al:Hits Of The 60's - Vol. 2 – Oldies]
[00:12.00]Lyrics beginning ...
[00:15.30]Some more lyrics ... ...
Enhanced LRC format is an extension of Simple LRC Format developed by the designer of A2 Media Player. It adds an extra Enhanced time tag in the format: <mm:ss.xx>.
Example of an Enhanced LRC file:
[mm:ss.xx] <mm:ss.xx> line 1 word 1 <mm:ss.xx> line 1 word 2 <mm:ss.xx> ... line 1 last word <mm:ss.xx>
[mm:ss.xx] <mm:ss.xx> line 2 word 1 <mm:ss.xx> line 2 word 2 <mm:ss.xx> ... line 2 last word <mm:ss.xx>
[mm:ss.xx] <mm:ss.xx> last line word 1 <mm:ss.xx> last line word 2 <mm:ss.xx> ... last line last word <mm:ss.xx>
Active DJ Studio supports both Simple and Enhanced LRC formats through a set of methods and events.
LRC files can be loaded manually, through a call to the LrcLoad method, or automatically by setting the automatic load through the LrcNotifEnableSet method: in this latest case, each time a sound is loaded into a player, the control will automatically search for a file having the same filename of the loaded sound file and extension ".LRC": if for example the loaded sound file should be named MySong.mp3, the corresponding LRC file should be named MySong.lrc; the search would be obviously limited to the same directory containing the sound file. You can know if automatic loading of LRC file is enabled through the LrcNotifEnableGet method.
Each time a LRC file has been loaded, the container application is notified through the LrcFileAvailable event which also reports if the LRC format is Enhanced.
When a LRC file is loaded, its contents are parsed and stored internally, ID Tags are separated from Line Time Tags and Line Time Tags are parsed again and separated from eventual Enhanced Time Tags: you can request each of them through the following methods:
It's important to remark that Enhanced LRC format can contain both Line Time Tags and Enhanced Time Tags while Simple LRC format can contain Line Time Tags only.
In most cases you won't need getting contents of Line Time Tags and of Enhanced Time Tags using methods described above because, during playback of a sound whose LRC file has been loaded, Active DJ Studio will automatically generate the following set of events that will allow the container application and the playing sound to be synchronized with lyrics:
The possibility to fine tune the raising of the mentioned events is guaranteed by the LrcNotifTimingsSet method: it allows to set both the advance time used to fire the LrcAdvanceTimeLineFull event and the advance time used to fire the LrcRealTimeLineFull and LrcRealTimeLinePortion events; both timings are expressed in milliseconds and, by default, the LrcAdvanceTimeLineFull event is fired with an advance of 2000 milliseconds (2 seconds) while the LrcRealTimeLineFull and LrcRealTimeLinePortion events are fired with an advance of 20 milliseconds. Current settings can be obtained through the LrcNotifTimingsGet method.