Expression Maps: How are switches selected?

I’m digging into Expression Maps, and it’d be really helpful to know some basic info definitively. Sorry if this is remedial, but the behaviors sometimes seem unexpected and the complexity can grow quickly (causing… unease). I’ve searched and not come up with detailed info.

Ok, how does Dorico select which switches to trigger?

Let’s say there are 3 active techniques: A, B, and C. How will the triggered Base Switch be selected in the following cases? The Expression Map includes…

  • Case 1: Base Switch for A, Base Switch for B

  • Case 2: Base Switch for A, Base Switch for “B+C”

  • Case 3: Base Switch for “A+B”, Base Switch for “B+C”

Obviously there are countless variations, which I hope can be generalized from these.

I’ve attached an example illustrating 2 surprising things:

  1. In something like case 1 above, the switch was selected neither alphabetically by technique nor by switch ID (as shown in the exported XML).

  2. In the staff where the preferred switch (Muted) comes first, not only is the other switch (Flutter-tongue) ignored, but Flutter-tongue never appears as an Active technique in the Playing Techniques lane. It’s disturbing if what’s displayed there is unreliable.

The importance of knowing clearly which switches take precedence is to save a lot of time and effort. Among other things, it could reduce greatly the number of switches needed. (Maybe CSS is a good model of a priority scheme to follow.)

Appreciate you reading the long post!

Thank you!!

Switch Selection Test.dorico (470.8 KB)

I can’t answer your specific question… (It’s long been a mystery to me)

But flutter-tongue will appear if you add it to the primary brass mutual exclusion group (though it will then fail to co-exist with a base switch muted)
However, I usually treat muted as an add-on. If you do that, all seems OK.

Of course whether this actually works will depend on the capabilities of your VST.

(Edit: You should also consider whether flutter-tongue is an attribute (of each note it appears on) or a direction (to be rescinded with nat. or similar)

1 Like

Thank you! That solves the situation in the example.

I’m working on a first Dorico project, adding to various Expression Maps as I go, which at this point is like adjusting bandaids. Like a lot of things, the first way you do it isn’t necessarily the right way.

So I’m hoping to learn the general rules to create a more extensive Expression Map going forward.

This is a complex area, and even though I’ve read through the code to provide you with this answer, I wouldn’t be confident that I have captured every possible subtlety.

Dorico builds up a timeline of the playback techniques required for a particular instrument (or even an individual voice, if independent voice playback is active). Playback techniques are usually given rise to by playing technique items in the music, but can also be produced by dynamics and articulations.

As it builds up the timeline, Dorico adds playback techniques as they arrive, and removes them as they end. Some techniques are instantaneous, and so are automatically removed at the end of the note with which they correspond; other techniques are persistent, in which case they continue until they are countermanded by a mutually exclusive technique or a general reset (such as “nat.” or “ord.”), unless the playing technique item that gives rise to them has an explicit duration, in which case they are automatically removed at the end of that duration.

The timeline allows Dorico to know the ideal combination of playback techniques at every given rhythmic position. Dorico then attempts to deliver the closest possible combination of playback techniques for each combination using the playback techniques accommodated by the base and add-on switches in the expression map, taking into consideration the mutual exclusion groups similarly defined in the expression map.

It makes a series of decisions, in descending order of preference, to determine the final combination:

  • It determines if a base switch in the expression map provides the desired combination;
  • If not, it determines if a combination of a base switch plus one or more add-on switches provides the desired combination;
  • If not, it determines how many of the playback techniques in the desired combination are provided by each of the base switches, and in the specific case that the desired combination contains three or more playback techniques, it will settle on any combination that provides two of the three at this point;
  • If not (e.g. because the desired combination is for only two playback techniques), it uses a crude (and currently hard-coded) mechanism to determine the relative priority of each playback technique in the combination; only a handful of playback techniques are currently explicitly considered, and playback techniques with a larger difference in sound have a higher priority than those with a smaller difference. Harmonic and pizzicato are the highest priority, followed by mute, with all other playback techniques having the same, lower fallback priority;
  • If not, then Dorico looks for an explicit fallback technique (again, from a currently hard-coded list of fallbacks);
  • If not, then Dorico finally falls back on the “natural” playing technique, i.e. it will play whatever it would play if no explicit playback techniques were present.

In the project you uploaded, because Dorico prioritises mute above flutter-tongue, when there is no mute+flutter-tongue combination defined in your expression map, Dorico will choose mute in preference to flutter-tongue (using the fourth of the six rules detailed above).

General guidelines for producing a workable expression map:

  • Define explicit combinations using base switches for the techniques that are achieved by using e.g. different key switches or different patches in your sound library.
  • Use add-on switches for those techniques that can be layered on top of a particular base sound, i.e. one key switch or one patch.
  • Extend the basic mutual exclusion groups that are provided by default to help Dorico understand that one sound cannot be produced at the same time as another.

Daniel, I just want to mention how useful these types of posts are. Thank you for taking the time to write them. And in particular, your openness to explain the context and how things work in Dorico is very helpful and much appreciated!


Completely agree with ebrooks. Explaining the decision tree is most helpful.

1 Like

Wow, @dspreadbury, thank you so much for the detailed reply! That helps a lot!

Just to clarify, the Playing Techniques lane doesn’t really represent the complete timeline of Playback Techniques you mention. It shows only Active techniques at the moments of switch changes. So when rolling over a box in that lane, we’re shown switches which refer to the entire box, and Active techniques which refer only to the beginning of the box (which was a factor in the attached example). Please let me know if this is incorrect.

Thanks again!

Yes, the playing techniques lane in the Key Editor shows the resolved timeline, i.e. the result of the decision-making process I described above, rather than the requested timeline.

Does this mean there’s a limit to how many add-ons can be layered onto a base sound?

I don’t believe so, but I would have to go through the code again to be sure.

I’d like to make a #feature-request for expression map switches, a toggle say in the form of a -1, 0, 1 setting for each keyswitch to direct such action: (-1) initiate keyswitch 1 beat before the note, (0) initiate keyswitch in unison with the note which is your default behavior, and (1) initiate keyswitch 1 beat before the end of the note… As an example, I have numerous instruments of which a legato slide is initiated by: slide in = keyswitch first and then note which to slide into, and slide out = play note first then same keyswitch as above… And I’m puzzling as to how I’m going to approach this dilemma…

1 Like

Yes, keyswitch timing could be made more flexible indeed…