w3c / musicxml

MusicXML specification
518 stars 57 forks source link

Combined dynamic + text (p dolce, pp subito) #504

Open shoogle opened 6 months ago

shoogle commented 6 months ago

It's quite common to have a dynamic followed immediately by expression text, such as *p dolce, pp subito, or sempre f*. image image

However, I can't find any examples of how to represent this in MusicXML.

Going purely by the specification, it seems there are three (maybe four) possible ways to encode pp subito.

  1. Which of these methods are allowed/recommended?
  2. Could we add an example to the MusicXML reference?

Method 1: Single <dynamics> element that contains both the pp and the subito.

The subito is entered using the <other-dynamics> element in the same <dynamics> element as the pp.

<direction placement="below">
    <direction-type>
        <dynamics>
            <pp/>
            <other-dynamics> subito</other-dynamics>
        </dynamics>
    </direction-type>
    <sound dynamics="36.67"/>
</direction>

Method 2: Two separate <direction> elements, one for the pp and one for the subito.

The subito is entered using the <words> element in a separate <direction> to the dynamic.

<direction placement="below">
    <direction-type>
        <dynamics>
            <pp/>
        </dynamics>
    </direction-type>
    <sound dynamics="36.67"/>
</direction>
<direction>
    <direction-type>
        <words font-style="italic">subito</words>
    </direction-type>
</direction>

Method 3: Two separate <direction-type> elements, one for the pp and one for the subito.

The subito is entered using the <words> element in a separate <direction-type> to the dynamic.

<direction placement="below">
    <direction-type>
        <dynamics>
            <pp/>
        </dynamics>
    </direction-type>
    <direction-type>
        <words font-style="italic">subito</words>
    </direction-type>
    <sound dynamics="36.67"/>
</direction>

Method 4: Single <direction-type> that contains both the pp and the subito.

The subito is entered using the <words> element in the same <direction-type> as the dynamic.

<direction placement="below">
    <direction-type>
        <dynamics>
            <pp/>
        </dynamics>
        <words font-style="italic">subito</words>
    </direction-type>
    <sound dynamics="36.67"/>
</direction>

This final method may not be allowed. The MusicXML reference for <direction-type> says:

Content

Exactly 1 of the following

This is a bit confusing, but I think it means that a single <direction-type> element cannot contain both a <words> element and a <dynamics> element at the same time.

mdgood commented 6 months ago

@shoogle Method 3 is what is intended. I agree it would be good to add an example to the MusicXML spec.

shoogle commented 6 months ago

@mdgood, thanks! In that case, what is the <other-dynamics> element supposed to be for? Might you use it to show piano and forte in a score as text instead of using the stylised p and f symbols, or would that still go in a <words> element?

I'm happy to try creating examples following this guide, but how are the PNG images created?

mscuthbert commented 6 months ago

@mdgood, thanks! In that case, what is the <other-dynamics> element supposed to be for?

Other-dynamics allows for dynamics not defined in the spec to be used. These might include sfffz (analogous to sfz and sffz defined in the spec) sfppp (more than sfp or sfpp) or maybe it's something not in symbols such as <other-dynamics>hush</other-dynamics>.

I'm happy to try creating examples following this guide, but how are the PNG images created?

There is not a standard auto-generate images system in the docgenerator as far as I know. Early images were generated by hand. When possible I've been preparing new examples with MuseScore's automatic MusicXML to image file command-line.

mdgood commented 6 months ago

The <other-dynamics> element is also handy for exporting isolated dynamics glyphs that don't exist as a MusicXML dynamics element, like the r and s SMuFL dynamics glyphs.

I created the examples in Finale and exported them to PNG from there, but you could use MuseScore or any other notation program to prepare them.

shoogle commented 6 months ago

So applications are expected to use stylised dynamic glyphs for <other-dynamics> rather than italic text?

s has a glyph in SMuFL but h and u don't, so if somebody did write <other-dynamics>hush</other-dynamics> you'd end up with something a bit strange.

image