]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/adding-extra-fingering-with-scheme.ly
Update snippets from today's LSR with changed makelsr.py
[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.dsi.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.14.2"
8
9 \header {
10   lsrtags = "scheme-language"
11
12   texidoc = "
13 You can add various stuff to notes using @code{make-music}. In this
14 example, an extra fingering is attached to a note.
15
16
17 In general, first do a @code{display} of the music you want to create,
18 then write a function that will structure the music for you.
19
20
21
22 "
23   doctitle = "Adding extra fingering with scheme"
24 } % begin verbatim
25
26
27 #(define (make-text-script x)
28    (make-music 'TextScriptEvent
29                'direction DOWN
30                'text (make-simple-markup x)))
31
32 #(define (add-text-script m x)
33    (if (equal? (ly:music-property m 'name) 'EventChord)
34        (set! (ly:music-property m 'elements)
35              (cons (make-text-script x)
36                   (ly:music-property m 'elements)))
37        (let ((es (ly:music-property m 'elements))
38              (e (ly:music-property m 'element)))
39          (map (lambda (y) (add-text-script y x)) es)
40          (if (ly:music? e)
41              (add-text-script e x))))
42    m)
43
44 addScript =
45 #(define-music-function (parser location script music )
46                                         ( string? ly:music? )
47                 (add-text-script music script))
48
49 \score {
50   {
51     \addScript "6" { c'4-3 }
52   }
53 }