Yeah, I tried all the different players and they all have the same problem, it is hard to grab the text output from them. Timidity willl print the midi info out to stdout, and it can be captured and displayed, but as soon as the music starts, the output stops. I'm not sure where they are sending it? It's not in STDERR either. Anyways, here is a pleasant looking hack of my previous "quicky". I just let timidity do it's thing in a window, so there are no synchro problems. I've set it up for 1024x768, and thru in a fun image to show you how to do it. I made a big font in the xterm, and gave it some fun colors for karaoke.
#!/usr/bin/perl -w use strict; use Tk; use Tk::PNG; #works for a 1024x768 display my $kar = shift || 'z.kar'; my $mw = MainWindow->new(); my $xscr = $mw->screenwidth; my $yscr = $mw->screenheight; $mw->geometry($xscr.'x'.$yscr.'+'.'20'.'+'.'20' ); $mw->fontCreate('big', -family=>'courier', -weight=>'bold', -size=>int(-18*18/14)); my $canv = $mw->Canvas(-bg => 'lightsteelblue', -relief => 'sunken', -width => $xscr - 100, -height =>$yscr - 100, )->pack(-expand => 1, -fill => 'both'); my $bunny = $mw->Photo(-data => 'iVBORw0KGgoAAAANSUhEUgAAAB4AAAAjEAIAAABcJvHFAAAACXBIWXMAAAsSAAALEgHS3 +X78AAAD F0lEQVR42u1YL+yqUBj1vfcLbhY3C44is8BIREYSG9FoNBqNkok2aFhp2BhJDWyadCZN/i +lOGxan jRdOuRsPxl/f+23vJKfX7x6+73znu5dK5RviV9QPDMMwDIPP7/f7/X6XTWU0Go1Go06n0+ +l0PM/z PC91CNu2bduWZVmW5bLpjsfj8XgcBEEQBJPJZDKZZAw0n8/n8zkCGYZhGIYgCIIgFEt3OB +wOh8OA gKZpmqZlDDedTqfTKRnO933f95GVer1er9fz0BVFURRFxCR3QfyMQfv9fr/fDyLgOI7jON +mo419k JUkMBoPBYJCRNBrxdrvdbrco6qvVarVaIWdFpQO/5tIcFBbE4nQ6nU6nJIpHjlGlEklTFE +VRFDIa T32/3+/3+3jqHMdxHBcfB2sK6HFFURRFeb1er9crfksoNUrr0GvUfxGfnA+FmX+QALDItG +LDA6O2 pQyCJFkPqxMDK2p9LodOAhQaLRjfoKRGo2wObl3G8PoDsA0Gb5Q5oonjfSNKTh96AOh+u9 +1ut1uS FuZrONPJ7bJ06tA9TDDsD6QkCnDltEDRkV1Q9AnENyuk8hcyChkkcZKo5uv1er1er3S6cA +PkFXSx MQodPrXFg2zTEsVANhO2JNdEmVo80ub7K/lSDHPyLkNaXrVarVar2W46LMuyLFsKaZ7neZ +4nvwFR NGKeGjYajUajkXz9z+RLn8/n8/ms/ANIQXq5XC6Xy/v9fr/fvw3p9Xq9Xq9VVVVV9fF4PB +6Pokhc r9fr9Vr6s6Lf4dNpbS6/exQA3BHDt/fkPl3wwT85wlcEcrCHZyHO1tmOSl95iGLcQN80Td +M0jTa1 LMuyLF3XdV03TdM0zWaz2Ww2Xdd1XRenDlDHgTbtvj/ykMZpDm/6LpfL5XLBmGi32+12G6 +Th5RAA Pne73W63iwfGYFosFovF4kOZrtVqtVoN16TD4XA4HPAAKDp5yZUkSZIk1GGz2Ww2m91ut9 +vt0Mof lcfxeDwej7PZbDaboRFbrVar1SJfIsLdYZfn8/l8Pue3y1zyiH9VAMFElb5Yp/+PcvAbH/ +25ox5S PYYAAAAASUVORK5CYII='); for my $x (1..15){ $canv->createImage(30, 30 + $x * 40, -image=> $bunny, ); $canv->createImage(930, 30 + $x * 40, -image=> $bunny, ); } my $xtermWidth = 600; my $xtermHeight = 500; ## this Frame is needed for including the xterm in Tk::Canvas my $xtermContainer = $canv->Frame(-container => 1); my $xtid = $xtermContainer->id(); # converting the id from HEX to decimal as xterm requires a decimal Id + my ($xtId) = sprintf hex $xtid; my $dcontitem = $canv->createWindow(475,275, -window => $xtermContainer, -width => $xtermWidth+100, -height => $xtermHeight, -state => 'normal'); my $label = $canv->createText( 475,10, -text => "Click Background To Hide Lyrics", -font => 'big', ); $canv->Tk::bind("<Button-1>", \&hideShow); my $width = $xtermWidth; my $height = $xtermHeight; my $bframe = $mw->Frame(-bg=>'black')->pack(-expand => 1, -fill => 'x' +); $bframe->Button(-text => "Exit", -bg => 'lightsteelblue', -command => [sub{Tk::exit}] )->pack(-side=>'right', -p +adx=>20 ); my $startbut; $startbut = $bframe->Button(-text => "Start", -bg => 'hotpink', -command => sub{ $startbut->configure(-state =>'disabled'); system("xterm -fn 10x20 -bg 'black' -fg 'hotpink' -into $xtId -e +timidity $kar &"); } )->pack(-side=>'left', -padx=>20); my $tl; #used to mask xterm MainLoop(); sub hideShow { if ($canv->itemcget($label, -text) =~ /Hide/) { $canv->itemconfigure($label, -fill => 'white', -text => "Click Background to Show Lyrics"); $tl = $mw->Toplevel(-use=>$xtId ); } else { $canv->itemconfigure($label, -fill => 'black', -text => "Click Background to Hide Lyrics"); $tl->withdraw; } }

I'm not really a human, but I play one on earth. flash japh

In reply to Re: Which Perl modules to use to display karaoke lyrics? by zentara
in thread Which Perl modules to use to display karaoke lyrics? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.