#!@TARGET_PYTHON@
#
# midi2ly.py -- LilyPond midi import script
-#
-# source file of the GNU LilyPond music typesetter
+
+# This file is part of LilyPond, the GNU music typesetter.
#
-# (c) 1998--2008 Han-Wen Nienhuys <hanwen@xs4all.nl>
+# Copyright (C) 1998--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
# Jan Nieuwenhuizen <janneke@gnu.org>
+#
+# LilyPond is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# LilyPond is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
'''
%s
%s
-''' % ( _ ('Copyright (c) %s by') % '2001--2008',
+''' % ( _ ('Copyright (c) %s by') % '2001--2011',
'\n '.join (authors),
_ ('Distributed under terms of the GNU General Public License.'),
_ ('It comes with NO WARRANTY.')))
return '\n '.join (lines) + '\n'
+def number2ascii (i):
+ s = ''
+ i += 1
+ while i > 0:
+ m = (i - 1) % 26
+ s = '%c' % (m + ord ('A')) + s
+ i = (i - m)/26
+ return s
+
def track_name (i):
- return 'track%c' % (i + ord ('A'))
+ return 'track' + number2ascii (i)
def channel_name (i):
- return 'channel%c' % (i + ord ('A'))
+ return 'channel' + number2ascii (i)
def dump_track (channels, n):
s = '\n'
global duration_quant_clocks
global allowed_tuplet_clocks
- str = open (in_file).read ()
+ str = open (in_file, 'rb').read ()
midi_dump = midi.parse (str)
clocks_per_1 = midi_dump[0][1]
s = ''
- s = tag + '\n\\version "2.7.18"\n\n'
+ s = tag + '\n\\version "2.7.38"\n\n'
for i in range (len (tracks)):
s = s + dump_track (tracks[i], i)