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