X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmidi2ly.py;h=2a36874962c8160d31f8fb0d4d4da7b216553126;hb=46eb67a07e39cf052e5712f2fc5eb90fd7124c74;hp=bf9f09f26e7f6b64a3549c4cd34bbd32974d2e1f;hpb=9a73c67a79a21b889d67f8d28f2c106de830d936;p=lilypond.git diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index bf9f09f26e..2a36874962 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--2012 Han-Wen Nienhuys +# Copyright (C) 1998--2015 Han-Wen Nienhuys # Jan Nieuwenhuizen # # LilyPond is free software: you can redistribute it and/or modify @@ -32,7 +32,6 @@ import sys @relocate-preamble@ """ -import midi import lilylib as ly global _;_=ly._ @@ -78,7 +77,7 @@ def warranty (): %s %s -''' % ( _ ('Copyright (c) %s by') % '1998--2012', +''' % ( _ ('Copyright (c) %s by') % '1998--2015', '\n '.join (authors), _ ('Distributed under terms of the GNU General Public License.'), _ ('It comes with NO WARRANTY.'))) @@ -268,11 +267,13 @@ class Note: elif commas < 0: s = s + "," * -commas - if ((dump_dur - and self.duration.compare (reference_note.duration)) - or global_options.explicit_durations): + if (dump_dur + and (self.duration.compare (reference_note.duration) + or global_options.explicit_durations)): s = s + self.duration.dump () + # Chords need to handle their reference duration themselves + reference_note = self # TODO: move space @@ -923,6 +924,9 @@ class Staff: return dump_track (self.voices, i) def convert_midi (in_file, out_file): + global midi + import midi + global clocks_per_1, clocks_per_4, key global start_quant_clocks global duration_quant_clocks