ultraGentle
ultraGentle

Reputation: 6349

Using <sound dynamics="XX"> in MusicXML to specify MIDI velocity

tl;dr: How can I use the <sound dynamics="YOUR_VOLUME" /> element so that the MIDI velocity of a given note is affected?

Background:

MusicXML has a MIDI-compatible part (see w3.org specification), for specifying MIDI values (e.g. velocity) when MusicXML is converted to MIDI.

Specifically, there is a <sound> element which has the attribute dynamics, that should convert into a MIDI velocity as explained at the bottom of the spec page linked above.

However, no matter where I put the <sound> element, it has no affect on MIDI velocity when I open such a MusicXML file in a program that can convert it to MIDI.

Example programs that can read MusicXML and playback and export to MIDI are musescore.org (for notation) and reaper.fm (a DAW), both of which can be downloaded for free, for anyone interested in testing.

Example MusicXML files for testing: https://www.musicxml.com/music-in-musicxml/example-set/ (none use the element)

I've tried...

Can anyone demonstrate a successful example of using the <sound> element in a MusicXML file to affect a given note when played back as MIDI?

Upvotes: 1

Views: 210

Answers (1)

Linzan Ye
Linzan Ye

Reputation: 31

I am not sure why but this works for me in musescore. I placed this code after a <note> block and the velocity of subsequent pitches change accordingly.

<direction placement="below">
   <direction-type>
      <dynamics>
         <other-dynamics/>
      </dynamics>
   </direction-type>
   <staff>1</staff>
   <sound dynamics="THE_DYNAMIC_YOU_WANT"/>
</direction>

It seems that in order to correctly parse the musicXML file, <dynamics> block is necessary together with some content inside. using <other-dynamics> will not display the marking on the score.

This is the example xml I worked with: https://www.w3.org/2021/06/musicxml40/musicxml-reference/examples/tutorial-apres-un-reve/

Upvotes: 0

Related Questions