Dynamic marks in MIDI

Only the dynamic markings from ppppp to fffff, including mp, mf and sf have values assigned to them. This value is then applied to the value of the overall MIDI volume range to obtain the final volume included in the MIDI output for that particular dynamic marking. The default fractions range from 0.25 for ppppp to 0.95 for fffff. The complete set of dynamic marks and their associated fractions can be found in scm/midi.scm.

Selected Snippets

Creating custom dynamics in MIDI output

The following example shows how to create a dynamic marking, not included in the default list, and assign a specific value to it so that it affects MIDI output.

The dynamic mark \rfz gets value 0.9.

#(define (myDynamics dynamic)
    (if (equal? dynamic "rfz")
      0.9
      (default-dynamic-absolute-volume dynamic)))

\score {
  \new Staff {
    \set Staff.midiInstrument = "cello"
    \set Score.dynamicAbsoluteVolumeFunction = #myDynamics
    \new Voice {
      \relative {
        a'4\pp b c-\rfz
      }
    }
  }
  \layout {}
  \midi {}
}

[image of music]

Installed Files: ly/script-init.ly scm/midi.scm.

Snippets: MIDI.

Internals Reference: Dynamic_performer.


LilyPond Notation Reference v2.25.14 (development-branch).