From: Jan Nieuwenhuizen Date: Sun, 13 Mar 2011 16:20:31 +0000 (+0100) Subject: Midi2ly: key parsing fixlet for new voice<->track mapping. X-Git-Tag: release/2.13.55-1~11^2~18 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=9079a8e47afbb0895850c2ea81b9316e85fdfab4;p=lilypond.git Midi2ly: key parsing fixlet for new voice<->track mapping. --- diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index 9a6a0bb9e2..4e026f5198 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -945,13 +945,22 @@ def convert_midi (in_file, out_file): print 'allowed tuplet clocks:', allowed_tuplet_clocks tracks = [create_track (t) for t in midi_dump[1]] + # urg, parse all global track events, such as Key first + # this fixes key in different voice/staff problem + for t in tracks: + t.music = t.parse () prev = None staves = [] for t in tracks: voices = t.get_voices () if ((t.name and prev and prev.name) and t.name.split (':')[0] == prev.name.split (':')[0]): - staves[-1].voices += voices + # staves[-1].voices += voices + # all global track events first + staves[-1].voices = ([staves[-1].voices[0]] + + [voices[0]] + + staves[-1].voices[1:] + + voices[1:]) else: staves.append (Staff (t)) prev = t