]> git.donarmstrong.com Git - lilypond.git/blob - input/test/add-staccato.ly
* lily/stem.cc (get_default_stem_end_position): use beam_count - 1
[lilypond.git] / input / test / add-staccato.ly
1 \version "1.5.68"
2 \header {
3
4 texidoc= "Using make-music, you can add various stuff to notes. Here
5 is an example how to add staccato dots.  Note: for this simple case
6 one would not use scm constructs.  See separate-staccato.ly first."
7
8
9
10 #(define (make-script x)
11    (let ((m (ly-make-music "Articulation_req")))
12      (ly-set-mus-property!! m 'articulation-type x)
13      (ly-set-mus-property!! m 'script x)
14      m))
15     
16 #(define (add-script m x)
17    (if (equal? (ly-music-name m) "Request_chord")
18        (ly-set-mus-property!! m 'elements
19                             (cons (make-script x)
20                                   (ly-get-mus-property m 'elements)))
21
22        (let ((es (ly-get-mus-property m 'elements))
23              (e (ly-get-mus-property m 'element)) )
24          (map (lambda (y) (add-script y x)) es)
25          (if (music? e)
26              (add-script e x))))
27    m)
28
29 #(define (add-staccato m)
30    (add-script m "staccato"))
31
32 \score {
33   \notes\relative c'' {
34     a b \apply #add-staccato { c c } 
35     a b \apply #add-staccato { c c } 
36   }
37 }
38