--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.1 Partwise//EN"\r
+ "http://www.musicxml.org/dtds/partwise.dtd">\r
+<score-partwise version="1.1">\r
+ <identification>\r
+ <miscellaneous>\r
+ <miscellaneous-field name="description">Transposing instruments: Trumpet \r
+ in Bb, Horn in Eb, Piano; All of them show the C major scale (the \r
+ trumpet with 2 sharp, the horn with 3 sharp).</miscellaneous-field>\r
+ </miscellaneous>\r
+ </identification>\r
+ <part-list>\r
+ <score-part id="P1">\r
+ <part-name>Trumpet in Bb</part-name>\r
+ <part-abbreviation>Bb Tpt.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P2">\r
+ <part-name>Horn in Eb</part-name>\r
+ <part-abbreviation>Hn.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P3">\r
+ <part-name>Piano</part-name>\r
+ </score-part>\r
+ </part-list>\r
+ <!--=========================================================-->\r
+ <part id="P1">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>2</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-1</diatonic>\r
+ <chromatic>-2</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>E</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>F</step>\r
+ <alter>1</alter>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ </measure>\r
+ <!--=======================================================-->\r
+ <measure number="2">\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>B</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <alter>1</alter>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P2">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>3</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-5</diatonic>\r
+ <chromatic>-9</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>B</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <alter>1</alter>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ </measure>\r
+ <!--=======================================================-->\r
+ <measure number="2">\r
+ <note>\r
+ <pitch>\r
+ <step>E</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>F</step>\r
+ <alter>1</alter>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <alter>1</alter>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P3">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>0</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>E</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>F</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ </measure>\r
+ <!--=======================================================-->\r
+ <measure number="2">\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>B</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>1</duration>\r
+ <voice>1</voice>\r
+ <type>quarter</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+</score-partwise>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.1 Partwise//EN"\r
+ "http://www.musicxml.org/dtds/partwise.dtd">\r
+<score-partwise version="1.1">\r
+ <identification>\r
+ <miscellaneous>\r
+ <miscellaneous-field name="description">Various transposition. Each\r
+ part plays a c'', just displayed in different display pitches.\r
+ The second-to-last staff uses a transposition where the displayed c'\r
+ is an actual f''' concert pitch. The final staff is an untransposed\r
+ instrument.</miscellaneous-field>\r
+ </miscellaneous>\r
+ </identification>\r
+ <part-list>\r
+ <score-part id="P1">\r
+ <part-name>Clarinet in Eb</part-name>\r
+ <part-abbreviation>Eb Cl.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P2">\r
+ <part-name>Clarinet in Bb</part-name>\r
+ <part-abbreviation>Bb Cl.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P3">\r
+ <part-name>Clarinet in A</part-name>\r
+ <part-abbreviation>A Cl.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P4">\r
+ <part-name>Horn in F</part-name>\r
+ <part-abbreviation>Hn.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P5">\r
+ <part-name>Horn in Eb</part-name>\r
+ <part-abbreviation>Hn.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P6">\r
+ <part-name>Piccolo Trumpet in A</part-name>\r
+ <part-abbreviation>Picc.Tpt.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P7">\r
+ <part-name>Trumpet in Bb</part-name>\r
+ <part-abbreviation>Bb Tpt.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P8">\r
+ <part-name>Trumpet in C</part-name>\r
+ <part-abbreviation>C Tpt.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P9">\r
+ <part-name>Trumpet in D</part-name>\r
+ <part-abbreviation>D Tpt.</part-abbreviation>\r
+ </score-part>\r
+ <score-part id="P10">\r
+ <part-name>displayed c'=fis'''</part-name>\r
+ </score-part>\r
+ <score-part id="P11">\r
+ <part-name print-object="no">MusicXML Part</part-name>\r
+ </score-part>\r
+ </part-list>\r
+ <!--=========================================================-->\r
+ <part id="P1">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>4</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>2</diatonic>\r
+ <chromatic>3</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P2">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>3</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-1</diatonic>\r
+ <chromatic>-2</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P3">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>-2</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-2</diatonic>\r
+ <chromatic>-3</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>E</step>\r
+ <alter>-1</alter>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P4">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>2</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-4</diatonic>\r
+ <chromatic>-7</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>G</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P5">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>4</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-5</diatonic>\r
+ <chromatic>-9</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>A</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P6">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>-2</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>5</diatonic>\r
+ <chromatic>9</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>E</step>\r
+ <alter>-1</alter>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P7">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>3</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>-1</diatonic>\r
+ <chromatic>-2</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>D</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P8">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>1</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P9">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>-1</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>1</diatonic>\r
+ <chromatic>2</chromatic>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>B</step>\r
+ <alter>-1</alter>\r
+ <octave>4</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P10">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>7</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>F</sign>\r
+ <line>4</line>\r
+ <clef-octave-change>-1</clef-octave-change>\r
+ </clef>\r
+ <transpose>\r
+ <diatonic>3</diatonic>\r
+ <chromatic>6</chromatic>\r
+ <octave-change>3</octave-change>\r
+ </transpose>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>F</step>\r
+ <alter>1</alter>\r
+ <octave>1</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+ <part id="P11">\r
+ <measure number="1">\r
+ <attributes>\r
+ <divisions>1</divisions>\r
+ <key>\r
+ <fifths>1</fifths>\r
+ <mode>major</mode>\r
+ </key>\r
+ <time symbol="common">\r
+ <beats>4</beats>\r
+ <beat-type>4</beat-type>\r
+ </time>\r
+ <clef>\r
+ <sign>G</sign>\r
+ <line>2</line>\r
+ </clef>\r
+ </attributes>\r
+ <note>\r
+ <pitch>\r
+ <step>C</step>\r
+ <octave>5</octave>\r
+ </pitch>\r
+ <duration>4</duration>\r
+ <voice>1</voice>\r
+ <type>whole</type>\r
+ </note>\r
+ <barline location="right">\r
+ <bar-style>light-heavy</bar-style>\r
+ </barline>\r
+ </measure>\r
+ </part>\r
+ <!--=========================================================-->\r
+</score-partwise>\r
change.mode = mode
change.tonic = start_pitch
return change
+
+def musicxml_transpose_to_lily (attributes):
+ transpose = attributes.get_transposition ()
+ if not transpose:
+ return None
+
+ shift = musicexp.Pitch ()
+ octave_change = transpose.get_maybe_exist_named_child ('octave-change')
+ if octave_change:
+ shift.octave = string.atoi (octave_change.get_text ())
+ chromatic_shift = string.atoi (transpose.get_named_child ('chromatic').get_text ())
+ chromatic_shift_normalized = chromatic_shift % 12;
+ (shift.step, shift.alteration) = [
+ (0,0), (0,1), (1,0), (2,-1), (2,0),
+ (3,0), (3,1), (4,0), (5,-1), (5,0),
+ (6,-1), (6,0)][chromatic_shift_normalized];
+ shift.octave += (chromatic_shift - chromatic_shift_normalized) / 12
+
+ diatonic = transpose.get_maybe_exist_named_child ('diatonic')
+ if diatonic:
+ diatonic_step = string.atoi (diatonic.get_text ()) % 7
+ if diatonic_step != shift.step:
+ # We got the alter incorrect!
+ old_semitones = shift.semitones ()
+ shift.step = diatonic_step
+ new_semitones = shift.semitones ()
+ shift.alteration += old_semitones - new_semitones
+
+ transposition = musicexp.Transposition ()
+ transposition.pitch = musicexp.Pitch ().transposed (shift)
+ return transposition
+
+
def musicxml_attributes_to_lily (attrs):
elts = []
attr_dispatch = {
'clef': musicxml_clef_to_lily,
'time': musicxml_time_to_lily,
- 'key': musicxml_key_to_lily
+ 'key': musicxml_key_to_lily,
+ 'transpose': musicxml_transpose_to_lily,
}
for (k, func) in attr_dispatch.items ():
children = attrs.get_named_children (k)