Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

equal duration for all chord notes #418

Merged
merged 4 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions partitura/io/importmusicxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,8 @@ def _handle_note(e, position, part, ongoing, prev_note, doc_order, prev_beam=Non
# same duration
assert prev_note is not None
position = prev_note.start.t
duration = prev_note.duration
duration_from_symbolic = prev_note.duration_from_symbolic

articulations_e = e.find("notations/articulations")
if articulations_e is not None:
Expand Down
4 changes: 4 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,7 @@
os.path.join(DATA_PATH, MUSICXML_PATH, "test_cross_staff_voices.musicxml"),
os.path.join(DATA_PATH, MEI_PATH, "test_cross_staff_voices.mei"),
]

MUSICXML_CHORD_FEATURES = [
os.path.join(MUSICXML_PATH, fn) for fn in ["test_chord_duration.musicxml"]
]
336 changes: 336 additions & 0 deletions tests/data/musicxml/test_chord_duration.musicxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,336 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
<identification>
<encoding>
<software>MuseScore 4.4.2</software>
<encoding-date>2025-01-10</encoding-date>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="print" attribute="new-page" type="yes" value="yes"/>
<supports element="print" attribute="new-system" type="yes" value="yes"/>
<supports element="stem" type="yes"/>
</encoding>
</identification>
<defaults>
<scaling>
<millimeters>6.99911</millimeters>
<tenths>40</tenths>
</scaling>
<page-layout>
<page-height>1696.94</page-height>
<page-width>1200.48</page-width>
<page-margins type="even">
<left-margin>85.7252</left-margin>
<right-margin>85.7252</right-margin>
<top-margin>85.7252</top-margin>
<bottom-margin>85.7252</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>85.7252</left-margin>
<right-margin>85.7252</right-margin>
<top-margin>85.7252</top-margin>
<bottom-margin>85.7252</bottom-margin>
</page-margins>
</page-layout>
<appearance>
<line-width type="light barline">1.8</line-width>
<line-width type="heavy barline">5.5</line-width>
<line-width type="beam">5</line-width>
<line-width type="bracket">4.5</line-width>
<line-width type="dashes">1</line-width>
<line-width type="enclosure">1</line-width>
<line-width type="ending">1.1</line-width>
<line-width type="extend">1</line-width>
<line-width type="leger">1.6</line-width>
<line-width type="pedal">1.1</line-width>
<line-width type="octave shift">1.1</line-width>
<line-width type="slur middle">2.1</line-width>
<line-width type="slur tip">0.5</line-width>
<line-width type="staff">1.1</line-width>
<line-width type="stem">1</line-width>
<line-width type="tie middle">2.1</line-width>
<line-width type="tie tip">0.5</line-width>
<line-width type="tuplet bracket">1</line-width>
<line-width type="wedge">1.2</line-width>
<note-size type="cue">70</note-size>
<note-size type="grace">70</note-size>
<note-size type="grace-cue">49</note-size>
</appearance>
<music-font font-family="Leland"/>
<word-font font-family="Edwin" font-size="10"/>
<lyric-font font-family="Edwin" font-size="10"/>
</defaults>
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<score-instrument id="P1-I1">
<instrument-name></instrument-name>
<instrument-sound>keyboard.piano</instrument-sound>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>1</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1" width="206.34">
<print>
<system-layout>
<system-margins>
<left-margin>50</left-margin>
<right-margin>772.7</right-margin>
</system-margins>
<top-system-distance>170</top-system-distance>
</system-layout>
<staff-layout number="2">
<staff-distance>65</staff-distance>
</staff-layout>
</print>
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<staves>2</staves>
<clef number="1">
<sign>G</sign>
<line>2</line>
</clef>
<clef number="2">
<sign>F</sign>
<line>4</line>
</clef>
</attributes>
<!-- STAFF 1 FIRST NOTE FIRSt CHORD -->
<note default-x="82.98" default-y="-40">
<pitch>
<step>E</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="82.98" default-y="-30">
<chord/>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="82.98" default-y="-15">
<chord/>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="143.76" default-y="-35">
<pitch>
<step>F</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="143.76" default-y="-25">
<chord/>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="143.76" default-y="-15">
<chord/>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="174.15" default-y="-40">
<pitch>
<step>E</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="174.15" default-y="-30">
<chord/>
<pitch>
<step>G</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<note default-x="174.15" default-y="-15">
<chord/>
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>up</stem>
<staff>1</staff>
</note>
<backup>
<duration>4</duration>
</backup>
<note default-x="82.98" default-y="-130">
<pitch>
<step>C</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="82.98" default-y="-120">
<chord/>
<pitch>
<step>E</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="82.98" default-y="-110">
<chord/>
<pitch>
<step>G</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="113.36" default-y="-125">
<rest/>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<staff>2</staff>
</note>
<note default-x="143.76" default-y="-130">
<pitch>
<step>C</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="143.76" default-y="-115">
<chord/>
<pitch>
<step>F</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="143.76" default-y="-105">
<chord/>
<pitch>
<step>A</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="174.15" default-y="-130">
<pitch>
<step>C</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="174.15" default-y="-120">
<chord/>
<pitch>
<step>E</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
<note default-x="174.15" default-y="-110">
<chord/>
<pitch>
<step>G</step>
<octave>3</octave>
</pitch>
<duration>1</duration>
<voice>5</voice>
<type>quarter</type>
<stem>down</stem>
<staff>2</staff>
</note>
</measure>
</part>
</score-partwise>
Loading