X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmidi2ly.py;h=3a434193b083130344aa0c2f321600b0e79a000b;hb=4bc2af1aa7038df7093ddfeb37f5622199b8fe91;hp=60a2febde0b583fb7e3cf0a776594660167f0663;hpb=4bd29f98794235cbe90875a6d73ad6cf4ffeaf5b;p=lilypond.git diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index 60a2febde0..3a434193b0 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -4,7 +4,7 @@ # This file is part of LilyPond, the GNU music typesetter. # -# Copyright (C) 1998--2011 Han-Wen Nienhuys +# Copyright (C) 1998--2012 Han-Wen Nienhuys # Jan Nieuwenhuizen # # LilyPond is free software: you can redistribute it and/or modify @@ -78,7 +78,7 @@ def warranty (): %s %s -''' % ( _ ('Copyright (c) %s by') % '1998--2011', +''' % ( _ ('Copyright (c) %s by') % '1998--2012', '\n '.join (authors), _ ('Distributed under terms of the GNU General Public License.'), _ ('It comes with NO WARRANTY.'))) @@ -827,7 +827,11 @@ def dump_track (track, n): if not n and not vv and global_options.key: s += global_options.key.dump () if average_pitch[vv+1] and voices > 1: - s += ' \\voice' + get_voice_layout (average_pitch[1:])[vv] + '\n' + vl = get_voice_layout (average_pitch[1:])[vv] + if vl: + s += ' \\voice' + vl + '\n' + else: + warning (_ ('found more than 5 voices on a staff, expect bad output')) s += ' ' + dump_voice (voice, skip) s += '}\n\n' v += 1 @@ -971,7 +975,7 @@ def convert_midi (in_file, out_file): s = tag s += r''' -\version "2.13.53" +\version "2.14.0" ''' s += r''' @@ -998,6 +1002,7 @@ def convert_midi (in_file, out_file): s += '\n\\score {\n <<\n' + control_track = False i = 0 for i, staff in enumerate (staves): track_name = get_track_name (i) @@ -1005,11 +1010,12 @@ def convert_midi (in_file, out_file): staff_name = track_name context = None if not i and not item and len (staves) > 1: - # control track - staff_name = get_track_name (1) - context = 'Staff' + control_track = track_name + continue elif (item and item.__class__ == Note): context = 'Staff' + if control_track: + s += ' \\context %(context)s=%(staff_name)s \\%(control_track)s\n' % locals () elif item and item.__class__ == Text: context = 'Lyrics' if context: