summaryrefslogtreecommitdiff
path: root/Documentation/snippets/adding-extra-fingering-with-scheme.ly
blob: 5fda87ea144c7f8105d65a263445f073214b8eab (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
%% DO NOT EDIT this file manually; it is automatically
%% generated from LSR http://lsr.dsi.unimi.it
%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
%% and then run scripts/auxiliar/makelsr.py
%%
%% This file is in the public domain.
\version "2.14.2"

\header {
  lsrtags = "scheme-language"

%% Translation of GIT committish: 1cda7b7b8219cb97399b8e7b56c1115aaf82c002
  texidocfr = "
Il est possible, à l'aide de la fonction @code{make-music}, d'ajouter
divers éléments à des notes.  Voici comment attacher un doigté
supplémentaire à une note.

En règle générale, réaliser préalablement un @code{display} (affichage)
de la musique que vous souhaitez créer vous aidera à écrire la fonction
chargée de structurer votre musique.

"
  doctitlefr = "Ajout d'un doigté supplémentaire avec scheme"

  texidoc = "
You can add various stuff to notes using @code{make-music}. In this
example, an extra fingering is attached to a note.


In general, first do a @code{display} of the music you want to create,
then write a function that will structure the music for you.



"
  doctitle = "Adding extra fingering with scheme"
} % begin verbatim


#(define (make-text-script x)
   (make-music 'TextScriptEvent
               'direction DOWN
               'text (make-simple-markup x)))

#(define (add-text-script m x)
   (if (equal? (ly:music-property m 'name) 'EventChord)
       (set! (ly:music-property m 'elements)
             (cons (make-text-script x)
                  (ly:music-property m 'elements)))
       (let ((es (ly:music-property m 'elements))
	     (e (ly:music-property m 'element)))
	 (map (lambda (y) (add-text-script y x)) es)
	 (if (ly:music? e)
	     (add-text-script e x))))
   m)

addScript =
#(define-music-function (parser location script music )
					( string? ly:music? )
		(add-text-script music script))

\score {
  {
    \addScript "6" { c'4-3 }
  }
}