views:

72

answers:

1
+1  Q: 

Music and Lyrics

I have a song and its lyrics. The song can be played using MusicPlayer class. But how do I show the lyrics of the song and also highlight them in sync with the audio. Words appear and fade with the playback.

Does Android have anything in-built for such a thing?

How can this be achieved?

Thanks.

+1  A: 

You need to match the time with the words.

Place each word on a single line with a time stamp. IE:

[00:01]Some
[00:02]where 
[00:03]over 
[00:04]the 
[00:05]rainbow

You can then add metadata for [chorus], [verse] etc.

graham.reeds
A quick search suggested LRC file format which recommends tagging lines/word with time. But how do I connect these time tags with actual media playback? Don't think MediaPlayer class of android does that by default?
Samuh
Not too sure. Can/Does you extend the MediaPlayer to allow inspection of the current play time?
graham.reeds
yes, we can get the current playback position in milliseconds
Samuh
So every tenth of a millisecond have an event that collects the time from MedaiaPlayer and then uses that to highlight the current word that is playing. You can be even more frugal and reschedule the next event to be when the next word is due to be lit.
graham.reeds