]> git.donarmstrong.com Git - lilypond.git/commitdiff
Midi2ly: grok midi files with up to 256 tracks, was 32. Fixes #1479.
authorJan Nieuwenhuizen <janneke@gnu.org>
Tue, 18 Jan 2011 14:31:58 +0000 (15:31 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Tue, 18 Jan 2011 14:31:58 +0000 (15:31 +0100)
scripts/midi2ly.py

index 86c32badfaba276ecb96e6571953e4f4b641412d..b03e1a82eaea58ce5204892597f15362d5f006c9 100644 (file)
@@ -712,11 +712,20 @@ def dump_channel (thread, skip):
 
     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'