]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/new/adding-extra-fingering-with-scheme.ly
Imported Upstream version 2.18.0
[lilypond.git] / Documentation / snippets / new / adding-extra-fingering-with-scheme.ly
1 \version "2.16.0"
2
3 \header {
4   lsrtags = "scheme-language"
5
6   texidoc = "
7 You can add additional elements to notes using @code{map-some-music}. In this
8 example, an extra script is attached to a note.
9
10 In general, first do a @code{\\displayMusic} of the music you want to
11 create, then write a function that will work on the appropriate parts
12 of the music for you.
13 "
14   doctitle = "Adding extra fingering with scheme"
15 }
16
17 addScript =
18 #(define-music-function (parser location script music)
19    (ly:event? ly:music?)
20    (map-some-music
21     (lambda (mus)
22       (define (append-script-at! prop)
23         (set! (ly:music-property mus prop)
24               (append (ly:music-property mus prop)
25                       (list (ly:music-deep-copy script))))
26         mus)
27       (case (ly:music-property mus 'name)
28         ((EventChord)
29          (append-script-at! 'elements))
30         ((NoteEvent)
31          (append-script-at! 'articulations))
32         (else #f)))
33     music))
34
35 \score {
36   {
37     \addScript _6 { c'4-3 <c' e' g'> }
38   }
39 }