use MIDI; # which "use"s MIDI::Event; my @lyrics; MIDI::Opus->new( { "from_file" => $ARGV[0], "exclusive_event_callback" => sub{push @lyrics, $_[2],$_[1]\n"}, "include" => \@MIDI::Event::Text_events } );
so now @lyrics contains elements looking like this:
I think the numbers represent the length of time to wait before adding the next bit of text, though I'm not sure what the units are - presumably not absolute times, because the file may get played at different tempos, so maybe they're "midi ticks" or similar."Happy,300" "Birthday,400" "To,80" "You,500"
I've noticed that when playing a karaoke file in Timidity from the command line, it actually prints the lyric events (presumably to STDOUT) so another idea might be to just capture this and print it, letting Timitidy take care of the syncronisation.
Thanks for all your suggestions.
mj
In reply to Re^2: Which Perl modules to use to display karaoke lyrics?
by Anonymous Monk
in thread Which Perl modules to use to display karaoke lyrics?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |