]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/marking-notes-of-spoken-parts-with-a-cross-on-the-stem.ly
Web-hu: updated Easier editing
[lilypond.git] / Documentation / snippets / marking-notes-of-spoken-parts-with-a-cross-on-the-stem.ly
1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
4 \version "2.13.20"
5
6 \header {
7   lsrtags = "editorial-annotations, vocal-music"
8
9   texidoc = "
10 This example shows how to put crosses on stems.  Mark the beginning of
11 a spoken section with the @code{\\speakOn} keyword, and end it with the
12 @code{\\speakOff} keyword.
13
14 "
15   doctitle = "Marking notes of spoken parts with a cross on the stem"
16 } % begin verbatim
17
18 speakOn = {
19   \override Stem #'stencil = #(lambda (grob)
20     (let* ((x-parent (ly:grob-parent grob X))
21            (is-rest? (ly:grob? (ly:grob-object x-parent 'rest))))
22       (if is-rest?
23         empty-stencil
24         (ly:stencil-combine-at-edge
25           (ly:stem::print grob)
26           Y
27           (- (ly:grob-property grob 'direction))
28           (grob-interpret-markup grob
29             (markup #:hspace -1.025 #:fontsize -4
30               #:musicglyph "noteheads.s2cross"))
31           -2.3 0))))
32 }
33
34 speakOff = {
35   \revert Stem #'stencil
36 }
37
38 \score {
39   \new Staff {
40     \relative c'' {
41       a4 b a c
42       \speakOn
43       g4 f r g
44       b4 r d e
45       \speakOff
46       c4 a g f
47     }
48   }
49 }
50