MusicXML note attribute dynamics
[This started as a bug report, but as I found out more, it turned more into an "observation". Sorry it's in the wrong forum section for that.]
The MusicXML syntax includes, as an optional attribute to a note element, the attribute dynamics. This is seemingly intended to convey the note property we speak of in MuseScore as velocity.
If MuseScore imports a MusicXML file in which one or more notes carries the attribute dynamics, then MuseScore dutifully makes the velocity property of the reconstructed note(s) as given by the dynamics attribute in the file.
But in the direction of the export of a MusicXML file, the situation is a bit complicated. If the velocity type for a note is "offset", then its velocity is not encoded into a MusicXML file. If the velocity type is "user", then the velocity is encoded into a MusicXML file. ("Offset" velocities are susceptible to MuseScore setting them for us automatically based on various things. "User" velocities are static.)
If we import a MusicXML file in which some or all notes have dynamics attributes, and (as described above) the velocity properties of the reconstructed notes are set as defined by these dynamics attributes, those notes are initially set with the velocity type as "user."
Thus, if we wish our notes' velocities encoded into a MusicXML file about to be exported, we must select all the notes and then, in Inspector, set the velocity type to "user". (To select all the notes, select the entire score, summon Inspector, and press the "Notes" button at "Select" area at the bottom.
Note that if this is done too early in the evolution of a score, it may spoil some of MuseScore's ways of automatically setting note velocities for us.