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