]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/numbers-as-easy-note-heads.ly
Merge branch 'master' into lilypond/translation
[lilypond.git] / Documentation / snippets / numbers-as-easy-note-heads.ly
1 % DO NOT EDIT this file manually; it is automatically
2 % generated from Documentation/snippets/new
3 % Make any changes in Documentation/snippets/new/
4 % and then run scripts/auxiliar/makelsr.py
5 %
6 % This file is in the public domain.
7 %% Note: this file works from version 2.14.0
8 \version "2.14.0"
9
10 \header {
11 %% Translation of GIT committish: 6977ddc9a3b63ea810eaecb864269c7d847ccf98
12   texidoces = "
13
14 Las cabezas de nota de notación fácil utilizan la propiedad
15 @code{note-names} del objeto @code{NoteHead} para determinar lo que
16 aparece dentro de la cabeza.  Mediante la sobreescritura de esta
17 propiedad, es posible imprimir números que representen el grado de la
18 escala.
19
20 Se puede crear un grabador simple que haga esto para la cabeza de cada
21 nota que ve.
22
23 "
24
25   doctitlees = "Números como notas de notación fácil"
26
27 %% Translation of GIT committish: d9d1da30361a0bcaea1ae058eb1bc8dd3a5b2e4c
28   texidocfr = "
29 En mode @qq{easy play}, les têtes de note utilisent la propriété
30 @code{note-names} attachée à l'objet @code{NoteHead} pour déterminer ce
31 qui apparaîtra dans la tête.  Intervenir sur cette propriété permet
32 d'imprimer un chiffre correspondant au degré dans la gamme.
33
34 La création d'un graveur dédié permet de traiter toutes les notes.
35 "
36   doctitlefr = "Easy play -- chiffre en lieu et place des lettres"
37
38   lsrtags = "pitches"
39   texidoc = "
40 Easy notation note heads use the @code{note-names} property
41 of the @code{NoteHead} object to determine what appears inside
42 the note head.  By overriding this property, it is possible
43 to print numbers representing the scale-degree.
44
45 A simple engraver can be created to do this for every note head
46 object it sees.
47 "
48   doctitle = "Numbers as easy note heads"
49 } % begin verbatim
50
51
52 #(define Ez_numbers_engraver
53    (list
54     (cons 'acknowledgers
55           (list
56            (cons 'note-head-interface
57                  (lambda (engraver grob source-engraver)
58                    (let* ((context (ly:translator-context engraver))
59                           (tonic-pitch (ly:context-property context 'tonic))
60                           (tonic-name (ly:pitch-notename tonic-pitch))
61                           (grob-pitch
62                            (ly:event-property (event-cause grob) 'pitch))
63                           (grob-name (ly:pitch-notename grob-pitch))
64                           (delta (modulo (- grob-name tonic-name) 7))
65                           (note-names
66                            (make-vector 7 (number->string (1+ delta)))))
67                      (ly:grob-set-property! grob 'note-names note-names))))))))
68
69 #(set-global-staff-size 26)
70
71 \layout {
72   ragged-right = ##t
73   \context {
74     \Voice
75     \consists \Ez_numbers_engraver
76   }
77 }
78
79 \relative c' {
80   \easyHeadsOn
81   c4 d e f
82   g4 a b c \break
83
84   \key a \major
85   a,4 b cis d
86   e4 fis gis a \break
87
88   \key d \dorian
89   d,4 e f g
90   a4 b c d
91 }