]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/midi2ly.py
* scm/editor.scm: add char argument.
[lilypond.git] / scripts / midi2ly.py
index 14413228bdbfae888d05c96bf508fe9f88f91725..8726c8d59f8231ac148ba1691e2b07e2af2f0186 100644 (file)
@@ -4,14 +4,13 @@
 # 
 # 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>
 
 
 '''
 TODO:
    * test on weird and unquantised midi input (lily-devel)
-   * drop c++ midi2ly
    * update doc and manpage
 
    * simply insert clef changes whenever too many ledger lines
@@ -80,7 +79,7 @@ except:
        def _ (s):
                return s
 
-program_name = 'midi2ly'
+program_name = sys.argv[0]
 program_version = '@TOPLEVEL_VERSION@'
 
 errorport = sys.stderr
@@ -133,14 +132,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):
@@ -504,10 +502,9 @@ class Key:
 
                s = ''
                if self.sharps and self.flats:
-                       s = '\\keysignature %s ' % 'TODO'
+                        pass
                else:
-                       
-                       if self.flats:
+                        if self.flats:
                                k = (ord ('cfbeadg'[self.flats % 7]) - ord ('a') - 2 -2 * self.minor + 7) % 7
                        else:
                                k = (ord ('cgdaebf'[self.sharps % 7]) - ord ('a') - 2 -2 * self.minor + 7) % 7
@@ -892,16 +889,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 +980,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 +1082,6 @@ if not files or files[0] == '-':
 
 
 for f in files:
-
        g = f
        g = strip_extension (g, '.midi')
        g = strip_extension (g, '.mid')