]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/numbers-as-easy-note-heads.ly
a2aa19778ca52fa363da58657d9784fd573cb65b
[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.13.36
8 \version "2.13.36"
9
10 \header {
11 %% Translation of GIT committish: 59caa3adce63114ca7972d18f95d4aadc528ec3d
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   lsrtags = "pitches"
28   texidoc = "
29 Easy notation note heads use the @code{note-names} property
30 of the @code{NoteHead} object to determine what appears inside
31 the note head.  By overriding this property, it is possible
32 to print numbers representing the scale-degree.
33
34 A simple engraver can be created to do this for every note head
35 object it sees.
36 "
37   doctitle = "Numbers as easy note heads"
38 } % begin verbatim
39
40
41 #(define Ez_numbers_engraver
42    (list
43     (cons 'acknowledgers
44           (list
45            (cons 'note-head-interface
46                  (lambda (engraver grob source-engraver)
47                    (let* ((context (ly:translator-context engraver))
48                           (tonic-pitch (ly:context-property context 'tonic))
49                           (tonic-name (ly:pitch-notename tonic-pitch))
50                           (grob-pitch
51                            (ly:event-property (event-cause grob) 'pitch))
52                           (grob-name (ly:pitch-notename grob-pitch))
53                           (delta (modulo (- grob-name tonic-name) 7))
54                           (note-names
55                            (make-vector 7 (number->string (1+ delta)))))
56                      (ly:grob-set-property! grob 'note-names note-names))))))))
57
58 #(set-global-staff-size 26)
59
60 \layout {
61   ragged-right = ##t
62   \context {
63     \Voice
64     \consists \Ez_numbers_engraver
65   }
66 }
67
68 \relative c' {
69   \easyHeadsOn
70   c4 d e f
71   g4 a b c \break
72
73   \key a \major
74   a,4 b cis d
75   e4 fis gis a \break
76
77   \key d \dorian
78   d,4 e f g
79   a4 b c d
80 }