]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/creating-custom-dynamics-in-midi-output.ly
Doc: NR section 3.5.x MIDI file creation tidy up
[lilypond.git] / Documentation / snippets / new / creating-custom-dynamics-in-midi-output.ly
1 \version "2.18.0"
2
3 \header {
4
5   lsrtags = "scheme-language, midi"
6
7   texidoc = "The following example shows how to create a dynamic
8   marking, not included in the default list, and assign it a specific
9   value so that it can be used to affect MIDI output.
10
11   The dynamic mark @code{\rfz} (@notation{rinforzando}) is assigned a
12   value of @code{0.9}."
13
14   doctitle = "Creating custom dynamics in MIDI output"
15 }
16
17 #(define (myDynamics dynamic)
18     (if (equal? dynamic "rfz")
19       0.9
20       (default-dynamic-absolute-volume dynamic)))
21
22 \score {
23   \new Staff {
24     \set Staff.midiInstrument = #"cello"
25     \set Score.dynamicAbsoluteVolumeFunction = #myDynamics
26     \new Voice {
27       \relative c'' {
28         a4\pp b c-\rfz
29       }
30     }
31   }
32   \layout {}
33   \midi {}
34 }