]> git.donarmstrong.com Git - lilypond.git/commitdiff
Midi2ly: add --skip option, print rests by default. Fixes #1549.
authorJan Nieuwenhuizen <janneke@gnu.org>
Fri, 4 Mar 2011 20:31:16 +0000 (21:31 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Fri, 4 Mar 2011 20:31:16 +0000 (21:31 +0100)
This was inspired by a patch from Martin Tarenskeen, however,
using rests only works in combination with the Completion_rest_engraver.

scripts/midi2ly.py

index ab2fb708d78b11391a9d7482c64cc9b06ed5e70c..c1f3543b88f6429135e8f7eef0f5301a90259c6b 100644 (file)
@@ -800,7 +800,9 @@ def dump_track (track, n):
             item = voice_first_item (voice)
 
             if item and item.__class__ == Note:
-                skip = 's'
+                skip = 'r'
+                if global_options.skip:
+                    skip = 's'
                 s += '%(voice_id)s = ' % locals ()
                 if not global_options.absolute_pitches:
                     s += '\\relative c '
@@ -944,6 +946,8 @@ def convert_midi (in_file, out_file):
     \Voice
     \remove "Note_heads_engraver"
     \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
   }
 }
 '''
@@ -1025,6 +1029,9 @@ def get_option_parser ():
            action='store_true')
     p.add_option ('-s', '--start-quant',help= _ ('quantise note starts on DUR'),
            metavar=_ ('DUR'))
+    p.add_option ('-S', '--skip',
+           action = "store_true",
+           help =_ ("use s instead of r for rests"))
     p.add_option ('-t', '--allow-tuplet',
            metavar=_ ('DUR*NUM/DEN'),
            action = 'append',