On Tuesday 22 April 2008 16:26:16 Laura nmi Michaels wrote:
> Yair K. wrote:
> >Do you have any example of a kar
> > file with this problem? The few files I checked seem fine.
>
> Since you mentioned other files seemed fine, I went back and tried some of
> my other midi kar files.  Some of them work beautifully.  I've never seen
> Timidity do such as good job at Karaoke before.  Some of them mess up with
> strange results though.  One of them has that echoing effect I mentioned
> and several of them show all the lyrics before the song has a chance to
> start playing.  I put together a few of the songs that were having problems
> as a test case and uploaded them to
> http://www.distasis.com/recipes/karmusic.zip I'll leave them up for a few
> weeks.

All of these have the same underlying issue. I'm no MIDI or timidity expert 
(Hopefully the real MIDI experts on the list will correct me if I say 
anything wrong), but I think it goes like this:
  A. MIDI files allow meta message, like "Text" and "Lyrics". "Text" should be 
output before playing.
  B. Quite a few MIDI files use "Text" inappropriately for lyrics. These need 
to be output while playing.
  C. But some do use it correctly, and expect that behaviour.
So every solution is a bit of an hack.

TiMidity++ has the following test in readmidi.c:
(opt_trace_text_meta_event ||  karaoke_format == 2 ||
 chorus_status_gs.text.status == CHORUS_ST_OK).
opt_trace_text_meta_event can be enabled using "Trace all meta text events" in 
XAW's option dialog (or the "-E t" command line option).
karaoke_format is set to 2 basically depending on a "@KMIDI" text.

If the test works, this is treated as a lyric event.
If it fails, it eventually gets to line 3616: "dumpstring...", and dumps the 
text to the screen right away.

The three files which show all the lyrics before playing fail the test.
(If opt_trace_text_meta_event is enabled, the files will play mostly fine, but 
that's not optimal (no linebreaks, because timidity doesn't really recognize 
the type)).
Traditional - The Band Played On.mid has a "@K MIDI" signature instead.
keycant.mid has a "@KMIDI" signature, but on track 0 (one of the checks is 
limited to track 1).
Traditional - Blow The Man Down.kar - it seems to be truncuted a bit "@K" 
instead of "@K MIDI" (I suspect).

afrika.kar has two tracks: one for lyrics, and another for text. And 
timidity's test fingers the text track as a lyric track as well (It's has the 
right text at the right place). So both tracks are outputted at the same 
time.

What can be done?

A. Check for "@K" instead of "@KMIDI", on all tracks. This patch fixes the 
three files which output immidiately:

--- timidity/readmidi.c   2008-04-01 04:15:27.000000000 +0300
+++ timidity/readmidi.c 2008-04-22 23:00:32.565546242 +0300
@@ -468,9 +468,8 @@
     si[len]='\0';

     if(type == 1 &&
-       current_read_track == 1 &&
        current_file_info->format == 1 &&
-       strncmp(si, "@KMIDI", 6) == 0)
+      strncmp(si, "@K", 2) == 0)
        karaoke_format = 1;

     code_convert(si, so, s_maxlen, NULL, NULL);
@@ -5337,7 +5336,7 @@
                    }
                    if(karaoke_format != -1)
                    {
-                       if(trk == 1 && strncmp(si, "@KMIDI", 6) == 0)
+                       if(trk == 1 && strncmp(si, "@K", 2) == 0)
                            karaoke_format = 1;
                        else if(karaoke_format == 1 && trk == 2)
                            karaoke_format = 2;


B. Another test, if there are actual lyric events, don't treat text on track 2 
as lyrics. I'm not sure this is a good idea - it may break more stuff than it 
fixes.
C. Check for the track name "Soft Karakoe" instead/with the "@K" check. Maybe 
a good idea.

Please test the above change, and see if it doesn't break anything

Yours,
        Yair K.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Timidity-talk mailing list
Timidity-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Reply via email to