\version "2.13.2" #(define-markup-command (pitchedtexttrill layout props alter) (number?) (interpret-markup layout props (markup #:lower 1 ;#:halign -1.4 #:musicglyph "scripts.trill" #:hspace -0.5 #:fontsize -1 #:musicglyph (assoc-get alter standard-alteration-glyph-name-alist "" )))) \markuplines \justified-lines {pitched trill as a simple markup} \relative c' { c^\markup{\pitchedtexttrill #SHARP }} % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ flatTrillI = #(let ((m (make-music 'ArticulationEvent 'articulation-type "trill"))) (ly:music-set-property! m 'tweaks (acons 'stencil (make-pitchedtexttrill-markup FLAT) (ly:music-property m 'tweaks))) m) \markuplines \justified-lines {pitched trill as an articulation with stencil tweak (every second note)} \relative c' { c4\flatTrillI c-\flatTrillI c4^\flatTrillI c_\flatTrillI } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ pitchedtrill = #(define-music-function (parser location alter) (number?) (let ((m (make-music 'ArticulationEvent 'articulation-type "trill"))) (ly:music-set-property! m 'tweaks (acons 'stencil (make-pitchedtexttrill-markup alter) (ly:music-property m 'tweaks))) m)) flatTrill = -\pitchedtrill #FLAT sharpTrill = -\pitchedtrill #SHARP \markuplines \justified-lines {pitched trill as an articulation with stencil tweak as music-function} \relative c' { c4\pitchedtrill #FLAT c4-\pitchedtrill #FLAT c4\flatTrill c4\sharpTrill } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ flatTrillI = -\tweak #'stencil #(make-pitchedtexttrill-markup FLAT ) \trill sharpTrillI = -\tweak #'stencil #(make-pitchedtexttrill-markup SHARP ) \trill \markuplines \justified-lines {Tweaking a trill stencil using a simple definition, stencil set to (make-pitchedtexttrill-markup XXX)} \relative c' { c4\flatTrillI c4\sharpTrillI c4-\flatTrillI c4-\sharpTrillI } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % (stencil . ,ly:text-interface::print) % (text . ,(make-musicglyph-markup "scripts.rcomma")) flatTrillII = -\tweak #'stencil #ly:text-interface::print -\tweak #'text #(make-pitchedtexttrill-markup FLAT ) \trill sharpTrillII = -\tweak #'stencil #ly:text-interface::print -\tweak #'text #(make-pitchedtexttrill-markup SHARP ) \trill pitchedtrillII = #(define-music-function (parser location alter) (number?) (let ((m (make-music 'ArticulationEvent 'articulation-type "trill"))) (ly:music-set-property! m 'tweaks (acons 'stencil ly:text-interface::print (acons 'text (make-pitchedtexttrill-markup alter) (ly:music-property m 'tweaks)))) m)) \markuplines \justified-lines { The same, using the text-interface::print stencil and the text property; Usine a music-function only works with - prepended } \relative c' { c4\flatTrillII c4\sharpTrillII c4-\flatTrillII c4-\sharpTrillII c4\pitchedtrillII #FLAT c4-\pitchedtrillII #FLAT c4\pitchedtrillII #NATURAL c4-\pitchedtrillII #NATURAL } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \markuplines \justified-lines { Tweaking trill spanners. Default text, but extra-offset } \relative c' { c4-\tweak #'extra-offset #'(2 . -5) \startTrillSpan c c c\stopTrillSpan } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ % tWF = -\tweak #'bound-details #'left #'text = \markup{\pitchedtexttrill #FLAT } % -\tweak #'extra-offset = #'(0 . -0.5) \startTrillSpan trillWithFlat = { \once \override TrillSpanner #'bound-details #'left #'text = \markup{\pitchedtexttrill #FLAT } \once \override TrillSpanner #'extra-offset = #'(0 . -0.5) } trillWithNatural = { \once \override TrillSpanner #'bound-details #'left #'text = \markup{\pitchedtexttrill #NATURAL } \once \override TrillSpanner #'extra-offset = #'(0 . -0.5) } trillWithSharp = { \once \override TrillSpanner #'bound-details #'left #'text = \markup{\pitchedtexttrill #SHARP } \once \override TrillSpanner #'extra-offset = #'(0 . -0.5) } \markuplines \justified-lines { Changing text of trill spanner using "\override" before the note, text created by "\markup{\pitchedtexttrill #XXX}" } \relative c' { c4\startTrillSpan c4 c4 c4\stopTrillSpan | \trillWithFlat c4\startTrillSpan c4 c4 c4\stopTrillSpan | \trillWithSharp c4\startTrillSpan c4 c4 c4\stopTrillSpan | \trillWithNatural c4\startTrillSpan c4 c4 c4\stopTrillSpan | } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \markuplines \justified-lines {Trying to set the values using tweaks for the spanner. Apparently, tweaking the bound-details -> left -> text is not so easy!!!} startSharpTrillSpan = -\tweak #'extra-offset #'(0 . -0.5) -\tweak #'bound-details #'((left . ((text . ,(make-translate-scaled-markup '(0.0 . -1.0) (make-pitchedtexttrill-markup SHARP )))))) \startTrillSpan startFlatTrillSpan = -\tweak #'extra-offset #'(0 . -0.5) \startTrillSpan \relative c' { c4\startSharpTrillSpan c4 c4 c4\stopTrillSpan | c4\startFlatTrillSpan c4 c4 c4\stopTrillSpan | } % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~