w3c / mnx

Music Notation CG next-generation music markup proposal.
176 stars 19 forks source link

Actions #214

Closed notator closed 8 months ago

notator commented 3 years ago

This issue continues the discussion in Pull Request #190 (which I think should now be rejected and closed).

Summary of the discussion in #190:

Further thoughts:

First, I'd like to rename <switch> (aka <jump>) to <actions>. This makes the element's type more obvious and precise since, in addition to having a location in the score, it contains an ordered list of action elements, each of which is a non-printing, imperative verb that has to be executed at a particular time.

Begin Edit 9 Jan., 2021 I'd also like to define a new <action> (singular) element. The two definitions look something like this:

  1. The <actions> element contains an ordered list of two or more action elements that define a stack of actions. Each time the <actions> element is invoked, the action on the top of the stack is executed and then popped off the stack. If the stack is empty, the <actions> element does nothing.
  2. The <action> element contains exactly one action element that is executed each time the <action> element is invoked.

End Edit

Clearly differentiating between graphic and temporal information leads to a much simpler and considerably more powerful way to code repeats and jumps, so the current <repeat> and <ending> elements, and all printed texts (such as "dal Segno", "&segno;", "Da capo als segno" etc.) have to be considered to be purely graphical objects.

Of course, it may be possible to infer a behaviour from the graphics, but the following problems arise:

As will be seen in the accel. example below, its easy to define specialised actions for purposes other than repeats and jumps. If there is consensus that I'm on the right track here, we could well be doing that over the next few weeks, but my primary objective is to create a revision of the current MNX by Example examples and the Draft Spec that can be presented as a Pull Request before the next co-chair meeting (19th January).


Examples:

The Repeat examples in MNX by Example are still okay, but should be considered to contain only graphic information. As discussed in #190, the Jump examples in MNX by Example need revising. The Jump examples in #190 are, I think, more or less okay, but the <jump> elements there need to be renamed <actions>.

The following examples are only supposed to demonstrate the principle behind using <actions> and <action> elements. Any new actions they may use are placeholders, not precise proposals. Feedback would, of course, be very welcome!

The simplest one-time repeat simpleRepeat would be coded, using an <actions> element, like this:

<mnx>
    <global>
        <measure>
            <directions>
                <time signature="4/4"/>
                <repeat id="startRepeat1" type="start"/>
                <repeat type="end"/>
                <actions location="4/4">
                    <goto target="#startRepeat1" />
                    <stop />
                </actions >
            </directions>
        </measure>
    </global>
    ...
</mnx>

Notes:

A varied repeat: FthenP_Repeat

<mnx>
    <global>
        <measure>
            <directions>
                <time signature="4/4"/>
                <repeat id="startRepeat1" type="start"/>
                <text location="0" string="&forte;, 2nd time &piano;" orient="down" />
                <actions location="0">
                    <continue>
                    <masterVolume value="50%" />
                </actions >
                <repeat type="end"/>
                <actions location="4/4">
                    <goto target="#startRepeat1" />
                    <stop />
                </actions >
            </directions>
        </measure>
    </global>
    ...
</mnx>

An accel would be coded using an <action> (singular) element: accel

<mnx>
    <global>
        <measure>
            <directions>
                <time signature="4/4"/>
                <text location="1/8" string="accel." orient="up" >
                    <extender duration="7/8" class="accelDashes" />
                </text >
                <action location="1/8" >
                    <speedChange factor="200%" type="linear" duration="7/8" />
                </action >
            </directions>
        </measure>
    </global>
    ...
</mnx>

This is the usual way to code actions that happen once. But note that if this example was contained in a repeat, the <speedChange> would be executed every time the <action> was invoked, and the performance would continue to accelerate.


Issues:

Some <text> elements, such as accel., don't need to be printed in every part in a score, but would be needed when extracting parts. Possibly, in a score containing many parts, the <text> could be defined separately in each part that requires it, but the rules governing global <text> still need to be worked out. This may also involve being more precise about our use of global and local CSS. Note the different behaviour of <repeat> and <ending> elements. These must be printed in all <part>s, both in the full score and in the individual part-booklets, so they don't need <part>-specific CSS.

Each of the available action types (=elements) needs to define precisely how and where it can/should be coded. For example, a <speedChange> can only be global, but <part>s should probably be allowed to have individual changes of dynamic: In a repeated measure having two parts, one part could have "&forte;, 2nd time &piano;", while the other has "&piano;, 2nd time &forte;".

Comment & suggestions welcome.

bhamblok commented 3 years ago

I'd like to comment on your proposal of the <text>-element. Wouldn't it be nicer if we put the value of the "string"-attribute simply as content of the element?

<text location="0" orient="down">&forte;, 2nd time &piano;</text>

and

<text location="1/8" orient="up" >
    accel.
    <extender duration="7/8" class="accelDashes" />
</text >
notator commented 3 years ago

@bhamblok Thanks for the feedback! :-). I'm in the process of moving the debate about text into its own issue, so will reply to you there when I post it. Should be ready soon.

I've now updated my original posting to this issue (Actions) to include a proposal for a new <action> (singular) element.

notator commented 3 years ago

The <action> element is redundant. See https://github.com/w3c/mnx/issues/217#issuecomment-761548580

notator commented 3 years ago

I'd like to define the way the <actions> element works more precisely, and thereby make a small change:

  1. The contained list of actions defines a stack of actions.
  2. Each time the actions element is reached during a performance, the action at the top of the stack is performed, and then popped of the top of the stack.
  3. When the stack is empty, no action is performed.

This means that

Summary: I think the following actions are basic

I also think that all action elements should always be enclosed in an <actions> element, even when there is only one of them. That means that graphics-only applications can ignore them more easily, and that #221, #220 and #218 need to be changed accordingly. (Now doing that.)

After proper discussion, further actions are likely to be defined in future (for example something like <speedChange> in the accel. example above.)

adrianholovaty commented 8 months ago

Closing an outdated issue.