]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/adding-extra-fingering-with-scheme.ly
Merge remote-tracking branch 'origin/master' into translation
[lilypond.git] / Documentation / snippets / adding-extra-fingering-with-scheme.ly
1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.di.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
5 %%
6 %% This file is in the public domain.
7 \version "2.18.0"
8
9 \header {
10   lsrtags = "scheme-language"
11
12   texidoc = "
13 You can add additional elements to notes using @code{map-some-music}.
14 In this example, an extra script is attached to a note.
15
16 In general, first do a @code{\\displayMusic} of the music you want to
17 create, then write a function that will work on the appropriate parts
18 of the music for you.
19
20 "
21   doctitle = "Adding extra fingering with scheme"
22 } % begin verbatim
23
24 addScript =
25 #(define-music-function (parser location script music)
26    (ly:event? ly:music?)
27    (map-some-music
28     (lambda (mus)
29       (define (append-script-at! prop)
30         (set! (ly:music-property mus prop)
31               (append (ly:music-property mus prop)
32                       (list (ly:music-deep-copy script))))
33         mus)
34       (case (ly:music-property mus 'name)
35         ((EventChord)
36          (append-script-at! 'elements))
37         ((NoteEvent)
38          (append-script-at! 'articulations))
39         (else #f)))
40     music))
41
42 \score {
43   {
44     \addScript _6 { c'4-3 <c' e' g'> }
45   }
46 }