September 14, 2011

Lyricist -- A Media Player with Synchronized Lyrics

This is a small (and lightweight - memory-wise) audio player application. The idea pops out when I was listening to my favorite songs on MediaMonkey , the free version and I was also looking (or glancing) at times at its lyrics on a website (I don't actually sing but I bet you can relate).

I like the lyrics to be displayed synchronized with the song so I fired up Google and see if I can find a media player that just does that and found none (yeah, WMP displays lyrics -- the older version but it won't display the lyrics anymore for the latest version) and the keyword here is synchronized. So the idea came to life.

This application was created using the express edition of Visual C# 2008. Before I dig further with the application features, I'd like to give credit where credit is due. This application do not have it's own sound engine, instead it uses irrKlang, a cross platform sound library for C++, C# and all .NET languages. It's not quite sophisticated since it does not support some advanced features like multi-band equalizers, etc... Nevertheless, it has an easy-to-use API. Maybe later on, I'll move out from irrKlang but for now, this will do. For the lyrics database, I used the web service of LYRDB. It contains more than a million songs although the number of songs is getting smaller due to copyright issues and the songs are removed from their database eventually. Most new songs are not found there. I really can't find other free web services that will provide the full lyrics of a song. I could have tried scraping some websites but it's an ugly solution. Once that website changes it's structure/format, Lyricist would have to be changed as well, potentially. For now, I'm satisfied with LYRDB and I hope these copyright issues should not matter. If you can't find the song in LYRDB you can still use other websites but only LYRDB is integrated with this application. So, let's go to the application basics. By the way, you might want download the application first right here.

Fire up the application and you should see it running without a problem (unless your machine do not have .NET framework in it -- at least 2.0).



The top portion is the file name label (the darkest one). Below it are three labels (previous lyric line label, current and next). Next comes the playing position tracking bar as well as the play position label and play length label. You can drag the tracking bar and go directly to a specific part of a song. Now let's go to the buttons, let's start from the left. The open playable audio files button lets you open playable audio files. Next comes the button to fire up the media library dialog. From there you can view songs that you've added/opened (playlist) -- You may have set it though, the first time. Then the audio song control buttons (play, pause, stop, previous and next). Volume control comes after it. The second to that last button let's you edit some settings (lyrics database path -- we'll get to this later, overlap songs (in seconds) -- this controls how many seconds before a song ends and the next song will be played, shuffle play and equalizers -- this is only a three-band equalizer). The reset button will reset the equalizers to their default values.





Let's go to the create lyrics button (the third from the last button). This will fire up the lyrics creator dialog (it's supposed to be a lyrics synchronizer). From this dialog you can open up the song you want the lyrics to be synchronized with. You can open lyrics by downloading it first (from LYRDB) or if you have a copy of it, open it up directly by using the open lyrics button or if you have searched it from the internet (in most likely case that the lyrics cannot be found from LYRDB), just copy the contents and click on the capture lyrics from clipboard button. All these procedures will load the lyrics to the data grid view. The data grid view is composed of 3 columns (the button used to capture the time -- in milliseconds, the milliseconds column and the lyrics line column). Both the milliseconds and lyrics line column can be edited. Just select the cell to edit and press F2. Creating a synchronized lyrics with song is much like creating an SRT file of a movie file (like an AVI file).



When creating the lyrics, play the song and capture each time a lyrics line is played. One technique I can share with this is click on the capture button in advance before the next line is played (about one word before the end of the current lyrics line). Do it on all lyrics line and after that, click on the save button to save the lyrics file in the database lyrics path. Each lyrics file (with file extension LRX) corresponds to a song. The filename used is the checksum of the song you play. With this, there can never be filename collisions for songs with the same filename. I consider this the heart of the application. This is what it is supposed to do. Try to play with it for while. After you have created a lyrics file, close this create lyrics dialog and then add the song to your play list and play it. It should be played and the lyrics are displayed synchronized with the song.

That's it. That is pretty much what it can do. You may find below tricks to be useful.

1. You can drag and drop filenames to the main interface. If you drop a path, all supported files will be added to your playlist. If it is a file, it will be added as long as it is a supported file. If it is an LST file (playlist file), all existing items will be added.
2. You can do the same with the media library dialog (playlist part).

For any comments, suggestions or reactions you have, please contact me.