Open jacekiwaszko1 opened 4 years ago
Both in Verovio Humdrum Viewer and in console musicxml2hum
It will always be the same, because they are the same program.
The loss of slur direction is intentional, since its direction can usually be inferred from the pitch/stem/layering of music.
This is a similar situation for stems, but for stems I have an option called -s
that will preserve their directions.
Perhaps I can add an option to preserve slur directions.
Notice that the slur directions in this example are half nonsense:
But the converter fixes them to look nice:
The main reason for this is that data encoders will place notes into the wrong layers, and then adjust the stems and slur directions to make them look visually correct, but in fact the contents of the layers is incorrect. I have seen lots of cases of this. If the stem and slur directions are preserved, then it is not visually obvious that there is a semantic data error. In other words, the primary purpose of Humdrum is for analysis, not for notation, so there is a preference for doing things to avoid bad encoding, or encourage good encoding, that would otherwise be irrelevant as long as it gave the correct visual display.
Here is an example of when the reversed slur is appropriate:
Here is the MusicXML for this example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
<work>
<work-title>Title</work-title>
</work>
<identification>
<creator type="composer">Composer</creator>
<encoding>
<software>MuseScore 3.3.4</software>
<encoding-date>2020-02-04</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>7.05556</millimeters>
<tenths>40</tenths>
</scaling>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<word-font font-family="FreeSerif" font-size="10"/>
<lyric-font font-family="FreeSerif" font-size="11"/>
</defaults>
<credit page="1">
<credit-words default-x="1133.86" default-y="1502.09" justify="right" valign="bottom" font-size="12">Composer</credit-words>
</credit>
<credit page="1">
<credit-words default-x="595.275" default-y="1627.09" justify="center" valign="top" font-size="24">Title</credit-words>
</credit>
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<part-abbreviation>Pno.</part-abbreviation>
<score-instrument id="P1-I1">
<instrument-name>Piano</instrument-name>
</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="287.59">
<print>
<system-layout>
<system-margins>
<left-margin>0.00</left-margin>
<right-margin>552.25</right-margin>
</system-margins>
<top-system-distance>195.00</top-system-distance>
</system-layout>
</print>
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note default-x="69.27" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="above" number="1"/>
</notations>
</note>
<note default-x="123.45" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<note default-x="177.63" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="below" number="1"/>
</notations>
</note>
<note default-x="231.81" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<backup>
<duration>4</duration>
</backup>
<note print-object="no">
<rest/>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
</note>
<note default-x="177.27" default-y="0.00">
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
<stem>up</stem>
</note>
</measure>
<measure number="2" width="237.32">
<note default-x="10.00" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="above" number="1"/>
</notations>
</note>
<note default-x="64.18" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<note default-x="118.36" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="below" number="1"/>
</notations>
</note>
<note default-x="172.54" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<backup>
<duration>4</duration>
</backup>
<note print-object="no">
<rest/>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
</note>
<note default-x="118.00" default-y="0.00">
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>2</voice>
<type>half</type>
<stem>up</stem>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
Here is the display of the data in VHV, when the slur and stem directions are removed:
Now, here is a better encoding of the voices/layer. The MuseScore editor shows the same visual result:
But now VHV is also matching the MuseScore output:
Not encoding stem/slur directions is also important if you want to transpose music, or change the clef of the music (or switch between a written or sounding score). Of course, you can remove them before transposing, but there will still be exceptions to the standard rules, and these exceptions would need to be fixed after transposition. If you only encoded the exceptions, then the transposed music would be more likely to be correct.
Another option would be to write a slur layout tool (perhaps called autoslur, similar to the exiting autostem and autobeam programs). If the slur has the same orientation as the one calculated by autoslur, then the direction would be remove; otherwise, the direction would be preserved.
Related to this, there could be an intensifier that prevents removal of the direction for a slur, such as (>>
to mean that the slur goes above, and this direction is contrary to the default placement syntax (or more literally, it means the slur goes up and do not remove this direction with autoslur).
There is a similar system for stems, with "//" meaning stem up, but do not delete with autostem -r
processing (but I tried it just not and this is not implemented yet).
In other words, this is a form of sic to explain that the parameter is really wanted. MusicXML (and MEI) do not have such a system to differentiate between automatically and manually generated parameters, so this is not available in the MusicXML import. However, a system could be developed based on embedding text directions to allow controlling it from a graphical music editor such as MuseScore.
Here is the data for the "correct" example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.1 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.1">
<work>
<work-title>Title</work-title>
</work>
<identification>
<creator type="composer">Composer</creator>
<encoding>
<software>MuseScore 3.3.4</software>
<encoding-date>2020-02-04</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>7.05556</millimeters>
<tenths>40</tenths>
</scaling>
<page-layout>
<page-height>1683.78</page-height>
<page-width>1190.55</page-width>
<page-margins type="even">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>56.6929</left-margin>
<right-margin>56.6929</right-margin>
<top-margin>56.6929</top-margin>
<bottom-margin>113.386</bottom-margin>
</page-margins>
</page-layout>
<word-font font-family="FreeSerif" font-size="10"/>
<lyric-font font-family="FreeSerif" font-size="11"/>
</defaults>
<credit page="1">
<credit-words default-x="1133.86" default-y="1502.09" justify="right" valign="bottom" font-size="12">Composer</credit-words>
</credit>
<credit page="1">
<credit-words default-x="595.275" default-y="1627.09" justify="center" valign="top" font-size="24">Title</credit-words>
</credit>
<part-list>
<score-part id="P1">
<part-name>Piano</part-name>
<part-abbreviation>Pno.</part-abbreviation>
<score-instrument id="P1-I1">
<instrument-name>Piano</instrument-name>
</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="287.59">
<print>
<system-layout>
<system-margins>
<left-margin>0.00</left-margin>
<right-margin>552.25</right-margin>
</system-margins>
<top-system-distance>195.00</top-system-distance>
</system-layout>
</print>
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note print-object="no">
<rest/>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
</note>
<note default-x="177.27" default-y="0.00">
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
</note>
<backup>
<duration>4</duration>
</backup>
<note default-x="69.27" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="above" number="1"/>
</notations>
</note>
<note default-x="123.45" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<note default-x="177.63" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="below" number="1"/>
</notations>
</note>
<note default-x="231.81" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
</measure>
<measure number="2" width="237.32">
<note print-object="no">
<rest/>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
</note>
<note default-x="118.00" default-y="0.00">
<pitch>
<step>F</step>
<octave>5</octave>
</pitch>
<duration>2</duration>
<voice>1</voice>
<type>half</type>
<stem>up</stem>
</note>
<backup>
<duration>4</duration>
</backup>
<note default-x="10.00" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="above" number="1"/>
</notations>
</note>
<note default-x="64.18" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<note default-x="118.36" default-y="-15.00">
<pitch>
<step>C</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="start" placement="below" number="1"/>
</notations>
</note>
<note default-x="172.54" default-y="-10.00">
<pitch>
<step>D</step>
<octave>5</octave>
</pitch>
<duration>1</duration>
<voice>2</voice>
<type>quarter</type>
<stem>down</stem>
<notations>
<slur type="stop" number="1"/>
</notations>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
Thank you for answer!
I was using older version of musicxml2hum
until yesterday and it was converting the information about slur position. I didn't know that was intentional change, hence the issue.
In NIFC project XML encoders were asked to encode all slur positions so it would be a handy option to preserve that information.
Another think is that autoslur
would be a great tool to have for use in cases you described.
I didn't know that was intentional change
I didn't know that it was previously recording the directions :-). I remember removing them from stems since that information is almost always uninteresting, but I added the -s
option at the time to allow for cases where they might be important to preserve (so adding a similar option for slurs would be good).
In MuseScore export of MusicXML, I think that all slurs have directions, so the encoders do not have to do anything special other than ensure that the direction of the slur in MuseScore is correct.
Both in Verovio Humdrum Viewer and in console
musicxml2hum
ignores the position of slur:sample XML:
Humdrum conversion: