6.1.2 Funciones de sustitución sencillas

He aquí un ejemplo sencillo:

textoRelleno = #(define-music-function (parser location padding) (number?)
  #{
    \once \override TextScript #'padding = #$padding
  #})

\relative c''' {
  c4^"piu mosso" b a b
  \textoRelleno #1.8
  c4^"piu mosso" d e f
  \textoRelleno #2.6
  c4^"piu mosso" fis a g
}

[image of music]

También se pueden sustituir las expresiones musicales:

notaCustos = #(define-music-function (parser location note)
                                     (ly:music?)
  #{
    \once \override Voice.NoteHead #'stencil =
      #ly:text-interface::print
    \once \override Voice.NoteHead #'text =
      \markup \musicglyph #"custodes.mensural.u0"
    \once \override Voice.Stem #'stencil = ##f
    $note
  #})

{ c' d' e' f' \notaCustos g' }

[image of music]

Se pueden usar más de una variable:

marcaDeTempo = #(define-music-function (parser location padding marktext)
                                    (number? string?)
#{
  \once \override Score . RehearsalMark #'padding = $padding
  \once \override Score . RehearsalMark #'extra-spacing-width = #'(+inf.0 . -inf.0)
  \mark \markup { \bold $marktext }
#})

\relative c'' {
c2 e
\marcaDeTempo #3.0 #"Allegro"
g c
}

[image of music]


Otros idiomas: English.

Manual de referencia de la notación