]> git.donarmstrong.com Git - lilypond.git/blob - input/tricks/add-text-script.ly
43ef4c68451bf5b87fb65f647afad87e3cf4d73b
[lilypond.git] / input / tricks / add-text-script.ly
1 \header {
2 texidoc= "Using make-music, you can add
3 various stuff to notes. Here is an example
4 how to add an extra fingering. 
5
6 In general, first do a display of the music you want ot
7 create, then write a function that will build the structure for you.";
8
9
10 #(define (make-script x) 
11      (let* (  (m (ly-make-music "Text_script_req"))
12      )
13      
14      (ly-set-mus-property m 'text-type 'finger)
15      (ly-set-mus-property m 'text x)
16      m
17      ))
18      
19 #(define (add-script m x)
20   (if (equal? (ly-music-name m) "Request_chord")
21     (ly-set-mus-property m 'elements
22       (cons (make-script x) (ly-get-mus-property m 'elements)))
23
24     (let* ( (es (ly-get-mus-property m 'elements))
25             (e (ly-get-mus-property m 'element)) )
26      (map (lambda (y) (add-script y x)) es)
27      (if (music? e)
28        (add-script e x))
29     )
30   )
31   m
32 )
33
34 \score {  \apply #(lambda (x) (add-script x "6") (display x) x ) \notes { c4-3 } }
35