X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmusicxml2ly.py;h=e270aed95e7d3001ea905a3eb5c5ffac03f8adde;hb=1d3beed53413315ec6c0553b003b8c5776f8c38f;hp=5d44c39cfb30374cd20f2502a4ef37a12dc7c9c3;hpb=722ca6d1bd66fb85e525f2fa25702df7a09dea92;p=lilypond.git diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 5d44c39cfb..e270aed95e 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -22,7 +22,7 @@ import musicexp from rational import Rational -# Store command-line options in a global variable, so we can access them everythwere +# Store command-line options in a global variable, so we can access them everywhere options = None class Conversion_Settings: @@ -41,7 +41,7 @@ additional_definitions = { "tuplet-note-wrapper": """ % a formatter function, which is simply a wrapper around an existing % tuplet formatter function. It takes the value returned by the given % function and appends a note of given length. - #(define-public ((tuplet-number::append-note-wrapper function note) grob) + #(define ((tuplet-number::append-note-wrapper function note) grob) (let* ((txt (if function (function grob) #f))) (if txt (markup txt #:fontsize -5 #:note note UP) @@ -474,8 +474,6 @@ def extract_score_structure (part_list, staffinfo): group_starts.append (pos) pos += 1 - if len (staves) == 1: - return staves[0] for i in staves: structure.append_staff (i) return score @@ -533,7 +531,7 @@ def musicxml_partial_to_lily (partial_len): p.partial = rational_to_lily_duration (partial_len) return p else: - return Null + return None # Detect repeats and alternative endings in the chord event list (music_list) # and convert them to the corresponding musicexp objects, containing nested @@ -1169,7 +1167,7 @@ articulations_dict = { #"shake": "?", "snap-pizzicato": "snappizzicato", #"spiccato": "?", - "staccatissimo": (musicexp.ShortArticulationEvent, "|"), # or "staccatissimo" + "staccatissimo": (musicexp.ShortArticulationEvent, "!"), # or "staccatissimo" "staccato": (musicexp.ShortArticulationEvent, "."), # or "staccato" "stopped": (musicexp.ShortArticulationEvent, "+"), # or "stopped" #"stress": "?", @@ -1317,7 +1315,7 @@ def musicxml_words_to_lily_event (words): # convert accordion-registration to lilypond. # Since lilypond does not have any built-in commands, we need to create # the markup commands manually and define our own variables. -# Idea was taken from: http://lsr.dsi.unimi.it/LSR/Item?id=194 +# Idea was taken from: http://lsr.di.unimi.it/LSR/Item?id=194 def musicxml_accordion_to_markup (mxl_event): commandname = "accReg" command = "" @@ -1784,8 +1782,12 @@ def musicxml_note_to_lily_main_event (n): acc = n.get_maybe_exist_named_child ('accidental') if acc: - # let's not force accs everywhere. - event.cautionary = acc.cautionary + # AccidentalCautionary in lily has parentheses + # so treat accidental explicitly in parentheses as cautionary + if hasattr(acc, 'parentheses') and acc.parentheses == "yes": + event.cautionary = True + else: + event.cautionary = acc.cautionary # TODO: Handle editorial accidentals # TODO: Handle the level-display setting for displaying brackets/parentheses @@ -2571,7 +2573,7 @@ If the given filename is -, musicxml2ly reads from the command line. p.version = ('''%prog (LilyPond) @TOPLEVEL_VERSION@\n\n''' + -_ ("""Copyright (c) 2005--2012 by +_ ("""Copyright (c) 2005--2014 by Han-Wen Nienhuys , Jan Nieuwenhuizen and Reinhold Kainhofer @@ -2665,7 +2667,7 @@ information.""") % 'lilypond') action = "store_true", default = False, dest = "midi", - help = _("add midi-block to .ly file")) + help = _("activate midi-block")) p.add_option_group ('', description = (