]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/midi2ly.py
*** empty log message ***
[lilypond.git] / scripts / midi2ly.py
index 58fd49f5bb5a20fb2d6803821f2ce9d32f060c4a..66d8fbee9adf19a3899ab56261f87f5b5709a001 100644 (file)
@@ -4,7 +4,7 @@
 # 
 # source file of the GNU LilyPond music typesetter
 #
-# (c)  1998--2003  Han-Wen Nienhuys <hanwen@cs.uu.nl>
+# (c) 1998--2005  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 #                 Jan Nieuwenhuizen <janneke@gnu.org>
 
 
@@ -80,7 +80,7 @@ except:
        def _ (s):
                return s
 
-program_name = 'midi2ly'
+program_name = sys.argv[0]
 program_version = '@TOPLEVEL_VERSION@'
 
 errorport = sys.stderr
@@ -133,14 +133,13 @@ def identify ():
 def warranty ():
        identify ()
        sys.stdout.write ('\n')
-       sys.stdout.write (_ ('Copyright (c) %s by' % ' 2001--2003'))
+       sys.stdout.write (_ ('Copyright (c) %s by') % ' 2001--2005')
        sys.stdout.write ('\n')
        sys.stdout.write ('  Han-Wen Nienhuys')
        sys.stdout.write ('  Jan Nieuwenhuizen')
-       sys.stdout.write ('\n')
-       sys.stdout.write (_ (r'''
-Distributed under terms of the GNU General Public License. It comes with
-NO WARRANTY.'''))
+       sys.stdout.write ('\n\n')
+       sys.stdout.write (_ ("Distributed under terms of the GNU General Public License."))
+        sys.stdout.write (_ ("It comes with NO WARRANTY."))
        sys.stdout.write ('\n')
 
 def progress (s):
@@ -792,7 +791,7 @@ def dump_chord (ch):
                        s = s + i.dump (dump_dur = 0 )
                s = s + '>'
 
-               s = s + notes[0].duration.dump()
+               s = s + notes[0].duration.dump() + ' '
                reference_note = r
        return s
 
@@ -892,16 +891,15 @@ def dump_track (channels, n):
 
                if item and item.__class__ == Note:
                        skip = 's'
-                       s = s + '%s = \\notes' % (track + channel)
+                       s = s + '%s = ' % (track + channel)
                        if not absolute_p:
                                s = s + '\\relative c '
                elif item and item.__class__ == Text:
                        skip = '" "'
-                       s = s + '%s = \\lyrics ' % (track + channel)
+                       s = s + '%s = \\lyricmode ' % (track + channel)
                else:
                        skip = '\\skip '
-                       # must be in \notes mode for parsing \skip
-                       s = s + '%s = \\notes ' % (track + channel)
+                       s = s + '%s =  ' % (track + channel)
                s = s + '{\n'
                s = s + '  ' + dump_channel (channels[i][0], skip)
                s = s + '}\n\n'
@@ -984,8 +982,9 @@ def convert_midi (f, o):
 
        tag = '%% Lily was here -- automatically converted by %s from %s' % ( program_name, f)
 
+        
        s = ''
-       s = tag + '\n\n'
+       s = tag + '\n\\version "2.3.25"\n\n'
        for i in range (len (tracks)):
                s = s + dump_track (tracks[i], i)
 
@@ -1085,7 +1084,6 @@ if not files or files[0] == '-':
 
 
 for f in files:
-
        g = f
        g = strip_extension (g, '.midi')
        g = strip_extension (g, '.mid')