speakOn = { \override Stem.stencil = #(lambda (grob) (let* ((x-parent (ly:grob-parent grob X)) (is-rest? (ly:grob? (ly:grob-object x-parent 'rest)))) (if is-rest? empty-stencil (ly:stencil-combine-at-edge (ly:stem::print grob) Y (- (ly:grob-property grob 'direction)) (grob-interpret-markup grob (markup #:center-align #:fontsize -4 #:musicglyph "noteheads.s2cross")) -2.3)))) } speakOff = { \revert Stem.stencil \revert Flag.stencil } \score { \new Staff { \relative c'' { a4 b a c \speakOn g4 f r g b4 r d e \speakOff c4 a g f } } }