Saturday, 5 October 2024

Lyrics

Reading lyrics whilst listening to music improves the experience, particularly because I am not very good at decoding unclear words and tend not to listen to songs closely.
Putting a song title and artist into google usually provides lyrics or links to lyrics.  Very occasionally, I make the effort to do this, but it would be really helpful if I could create a Google search within my music application to display song lyrics.

In my music page I already display the title, artist and album so the information so it is a simple matter to work out what needs to go into a Google search. In the example below a google search for "Lyrics Fleetwood Mac - Second Hand News" quickly comes up with the appropriate lyrics.

All I have to do is setup a simple javascript function which takes the available track and artist information and create a suitable google search string.  This is then inserted into the page in a button tag as shown below.


It is a very simple way to add a useful function to the page.  In addition to starting the query with lyrics, I have buttons to start the query with "Images" and "info" which also yield potentially interesting Google search responses.

Google doesn't always come up with the goods, the genius.com lyric site can potentialy give better results but it seems it would entail processing lyrics using their API which would be more work.  I will take the win with a 80% result for 20% of the effort.



No comments:

Post a Comment