]> git.donarmstrong.com Git - lilypond.git/blob - input/test/add-text-script.ly
* lily/my-lily-lexer.cc (start_main_input): define input-file-name
[lilypond.git] / input / test / add-text-script.ly
1 \version "1.9.1"
2
3 \header {
4 texidoc= "@cindex make-music Fingering
5 You can add various stuff to notes using make-music.
6 Here is an example of how to add an extra fingering. 
7
8 In general, first do a display of the music you want to
9 create, then write a function that will build the structure for you.
10 "
11
12
13 #(define (make-text-script x) 
14    (let ((m (make-music-by-name 'TextScriptEvent)))
15     (ly:set-mus-property! m 'direction DOWN) 
16      (ly:set-mus-property! m 'text (make-simple-markup x))
17      m))
18      
19 #(define (add-text-script m x)
20    (if (equal? (ly:get-mus-property m 'name) 'EventChord)
21        (ly:set-mus-property! m 'elements
22                             (cons (make-text-script x)
23                                   (ly:get-mus-property m 'elements)))
24        
25        (let ((es (ly:get-mus-property m 'elements))
26              (e (ly:get-mus-property m 'element)) )
27          (map (lambda (y) (add-text-script y x)) es)
28          (if (ly:music? e)
29              (add-text-script e x))))
30    m)
31
32 \score {
33   \apply #(lambda (x)  (add-text-script x "6") (display-music x) x ) \notes { c'4-3 }
34         \paper{ raggedright = ##t }
35 }
36
37