]> git.donarmstrong.com Git - lilypond.git/blob - input/test/add-staccato.ly
* scripts/convert-ly.py: Add rule.
[lilypond.git] / input / test / add-staccato.ly
1 \version "1.7.0"  %% or actually: 1.7.1 ...
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 (make-music-by-name "Articulation_req")))
12      (ly-set-mus-property! m 'articulation-type x)
13      m))
14     
15 #(define (add-script m x)
16    (if (equal? (make-music-by-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