]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/adding-extra-fingering-with-scheme.ly
5fda87ea144c7f8105d65a263445f073214b8eab
[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 %% Translation of GIT committish: 1cda7b7b8219cb97399b8e7b56c1115aaf82c002
13   texidocfr = "
14 Il est possible, à l'aide de la fonction @code{make-music}, d'ajouter
15 divers éléments à des notes.  Voici comment attacher un doigté
16 supplémentaire à une note.
17
18 En règle générale, réaliser préalablement un @code{display} (affichage)
19 de la musique que vous souhaitez créer vous aidera à écrire la fonction
20 chargée de structurer votre musique.
21
22 "
23   doctitlefr = "Ajout d'un doigté supplémentaire avec scheme"
24
25   texidoc = "
26 You can add various stuff to notes using @code{make-music}. In this
27 example, an extra fingering is attached to a note.
28
29
30 In general, first do a @code{display} of the music you want to create,
31 then write a function that will structure the music for you.
32
33
34
35 "
36   doctitle = "Adding extra fingering with scheme"
37 } % begin verbatim
38
39
40 #(define (make-text-script x)
41    (make-music 'TextScriptEvent
42                'direction DOWN
43                'text (make-simple-markup x)))
44
45 #(define (add-text-script m x)
46    (if (equal? (ly:music-property m 'name) 'EventChord)
47        (set! (ly:music-property m 'elements)
48              (cons (make-text-script x)
49                   (ly:music-property m 'elements)))
50        (let ((es (ly:music-property m 'elements))
51              (e (ly:music-property m 'element)))
52          (map (lambda (y) (add-text-script y x)) es)
53          (if (ly:music? e)
54              (add-text-script e x))))
55    m)
56
57 addScript =
58 #(define-music-function (parser location script music )
59                                         ( string? ly:music? )
60                 (add-text-script music script))
61
62 \score {
63   {
64     \addScript "6" { c'4-3 }
65   }
66 }