(I posted this some while back to bug-lilypond but once more it vanished without trace ...)
Dear All,

I've noticed that if I use lilypond to output midi and then use midi2ly to translate back to lilypond notation a part can go missing. I'm using

midi2ly (GNU LilyPond) 1.6.5
GNU LilyPond 1.6.5

on a RedHat 8.0 setup. A simple example is the following snippet:

---------------------------------- file test.ly ------------------>
trackBchannelA = \notes\relative c {
d''16
}
trackB = <
\context Voice = channelA \trackBchannelA
>
trackCchannelB = \notes\relative c {
b'4c4b4c8
}
trackC = <
\context Voice = channelB \trackCchannelB
>
\score {
<
\context Staff=trackB \trackB
\context Staff=trackC \trackC
>
\midi {}
\paper {}
}

---------------------------end of test.ly ------------------->

when the output of lilypond -m is given to midi2ly the resultant .ly file (attached) ends with
\score {
<
\context Staff=trackB \trackB
>

which is missing the second part of the original.
Peering at the code in midi2ly I see that if the function track_first_item, which is defined as:

def track_first_item (track):
for thread in track:
return thread_first_item (thread)

is replaced by the following definition:

def track_first_item (track):
for thread in track:
item = thread_first_item (thread)
if item != 0:
return item
return item

Then the lost part returns (one is reminded of the Lost Chord of Arthur Sullivan...)
Now I don't want to pretend that this is a fix - I've not tested it on anything but this example - but the very strangeness of the original definition of this function (with its one-shot for...in loop) is suspicious. I would like to understand this script better - I can see that some of the information from a given channel is being moved to channel 0, but I'm unsure of the general strategy for mapping the midi information onto lily format that has been adopted.

------------------------------------------------------------------------

% Lily was here -- automatically converted by midi2ly from lygentest.midi


trackAchannelA = \notes {
% [TEXT_EVENT] Creator: GNU LilyPond 1.6.5 % [TEXT_EVENT] Generated automatically by: GNU LilyPond 1.6.5 % [TEXT_EVENT] at Fri Dec 27 12:05:20 2002 % [TEXT_EVENT] from musical definition: test.ly:22:3
% [SEQUENCE_TRACK_NAME] Track 0
}

trackA = <
\context Voice = channelA \trackAchannelA




trackBchannelA = \notes\relative c {
% [SEQUENCE_TRACK_NAME] trackB
\tempo 4 = 60 % [INSTRUMENT_NAME] bright acoustic
\time 4/4 d''16 }

trackB = <
\context Voice = channelA \trackBchannelA




trackCchannelA = \notes {
% [SEQUENCE_TRACK_NAME] trackC
\tempo 4 = 60 % [INSTRUMENT_NAME] bright acoustic
\time 4/4 }

trackCchannelB = \notes\relative c {
b'4 c b c8 }

trackC = <

\clef bass
\context Voice = channelA \trackCchannelA
\context Voice = channelB \trackCchannelB




\score {
 <
   \context Staff=trackB \trackB
 >
}

% Lily was here -- automatically converted by midi2ly from lygentest.midi


trackAchannelA = \notes {
  
  % [TEXT_EVENT] Creator: GNU LilyPond 1.6.5            
  
  % [TEXT_EVENT] Generated automatically by: GNU LilyPond 1.6.5            
  
  % [TEXT_EVENT] at Fri Dec 27 12:05:20 2002                                 
  
  % [TEXT_EVENT] from musical definition: test.ly:22:3
  
  % [SEQUENCE_TRACK_NAME] Track 0
  
}

trackA = <
  \context Voice = channelA \trackAchannelA
>


trackBchannelA = \notes\relative c {
  
  % [SEQUENCE_TRACK_NAME] trackB
  
  \tempo 4 = 60 
  
  % [INSTRUMENT_NAME] bright acoustic
  
  \time 4/4 
  d''16 
}

trackB = <
  \context Voice = channelA \trackBchannelA
>


trackCchannelA = \notes {
  
  % [SEQUENCE_TRACK_NAME] trackC
  
  \tempo 4 = 60 
  
  % [INSTRUMENT_NAME] bright acoustic
  
  \time 4/4 
  
}

trackCchannelB = \notes\relative c {
  b'4 c b c8 
}

trackC = <

  \clef bass
  
  \context Voice = channelA \trackCchannelA
  \context Voice = channelB \trackCchannelB
>


\score {
  <
    \context Staff=trackB \trackB
  >
}
_______________________________________________
Lilypond-devel mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to