From 2f1b610a95ee79e6a9f93e1dee5ab936b386cb0d Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sun, 16 Nov 2008 00:45:14 +0100 Subject: [PATCH] MusicXML: Implement church modes; fix empty tags for keys --- .../regression/musicxml/00o-Basics-Modes.xml | 180 ++++++++++++++++++ python/musicxml.py | 4 +- scripts/musicxml2ly.py | 11 +- 3 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 input/regression/musicxml/00o-Basics-Modes.xml diff --git a/input/regression/musicxml/00o-Basics-Modes.xml b/input/regression/musicxml/00o-Basics-Modes.xml new file mode 100644 index 0000000000..63bac0bf3b --- /dev/null +++ b/input/regression/musicxml/00o-Basics-Modes.xml @@ -0,0 +1,180 @@ + + + + + + All different modes: major, + minor, ionian, dorian, phrygian, lydian, mixolydian, aeolian, and + locrian; All modes are given with 2 sharps. + + + + + MusicXML Part + + + + + + + 1 + + 2 + major + + + + G + 2 + + + + + G + 4 + + 1 + 1 + quarter + major + + + + 2 + minor + + + + + G + 4 + + 1 + 1 + quarter + minor + + + + 2 + ionian + + + + + G + 4 + + 1 + 1 + quarter + ionian + + + + 2 + dorian + + + + + G + 4 + + 1 + 1 + quarter + dorian + + + + + + 2 + phrygian + + + + + G + 4 + + 1 + 1 + quarter + phrygian + + + + 2 + lydian + + + + + G + 4 + + 1 + 1 + quarter + lydian + + + + 2 + mixolydian + + + + + G + 4 + + 1 + 1 + quarter + mixolydian + + + + 2 + aeolian + + + + + G + 4 + + 1 + 1 + quarter + aeolian + + + + + + 2 + locrian + + + + + G + 4 + + 1 + 1 + quarter + locrian + + + + + diff --git a/python/musicxml.py b/python/musicxml.py index e9df0b3010..e1a9446826 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -341,9 +341,11 @@ class Attributes (Measure_element): key = self.get_named_attribute ('key') mode_node = key.get_maybe_exist_named_child ('mode') - mode = 'major' + mode = None if mode_node: mode = mode_node.get_text () + if not mode or mode == '': + mode = 'major' fifths = int (key.get_maybe_exist_named_child ('fifths').get_text ()) return (fifths, mode) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 91b28ae2c1..8c8e336e31 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -650,8 +650,15 @@ def musicxml_key_to_lily (attributes): (fifths, mode) = attributes.get_key_signature () try: (n,a) = { - 'major' : (0,0), - 'minor' : (5,0), + 'major' : (0,0), + 'minor' : (5,0), + 'ionian' : (0,0), + 'dorian' : (1,0), + 'phrygian' : (2,0), + 'lydian' : (3,0), + 'mixolydian': (4,0), + 'aeolian' : (5,0), + 'locrian' : (6,0), }[mode] start_pitch.step = n start_pitch.alteration = a -- 2.39.2