]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/numbers-as-easy-note-heads.ly
8edd187f59d5155a87597f685197478f564dd414
[lilypond.git] / Documentation / snippets / numbers-as-easy-note-heads.ly
1 % Do not edit this file; it is automatically
2 % generated from Documentation/snippets/new
3 % This file is in the public domain.
4 %% Note: this file works from version 2.13.36
5 \version "2.13.40"
6
7 \header {
8 %% Translation of GIT committish: 67e7cb93611fa389c7e86c6e47e894ff30a8395c
9   texidoces = "
10
11 Las cabezas de nota de notación fácil utilizan la propiedad
12 @code{note-names} del objeto @code{NoteHead} para determinar lo que
13 aparece dentro de la cabeza.  Mediante la sobreescritura de esta
14 propiedad, es posible imprimir números que representen el grado de la
15 escala.
16
17 Se puede crear un grabador simple que haga esto para la cabeza de cada
18 nota que ve.
19
20 "
21
22   doctitlees = "Números como notas de notación fácil"
23
24   lsrtags = "pitches"
25   texidoc = "
26 Easy notation note heads use the @code{note-names} property
27 of the @code{NoteHead} object to determine what appears inside
28 the note head.  By overriding this property, it is possible
29 to print numbers representing the scale-degree.
30
31 A simple engraver can be created to do this for every note head
32 object it sees.
33 "
34   doctitle = "Numbers as easy note heads"
35 } % begin verbatim
36
37
38 #(define Ez_numbers_engraver
39    (list
40     (cons 'acknowledgers
41           (list
42            (cons 'note-head-interface
43                  (lambda (engraver grob source-engraver)
44                    (let* ((context (ly:translator-context engraver))
45                           (tonic-pitch (ly:context-property context 'tonic))
46                           (tonic-name (ly:pitch-notename tonic-pitch))
47                           (grob-pitch
48                            (ly:event-property (event-cause grob) 'pitch))
49                           (grob-name (ly:pitch-notename grob-pitch))
50                           (delta (modulo (- grob-name tonic-name) 7))
51                           (note-names
52                            (make-vector 7 (number->string (1+ delta)))))
53                      (ly:grob-set-property! grob 'note-names note-names))))))))
54
55 #(set-global-staff-size 26)
56
57 \layout {
58   ragged-right = ##t
59   \context {
60     \Voice
61     \consists \Ez_numbers_engraver
62   }
63 }
64
65 \relative c' {
66   \easyHeadsOn
67   c4 d e f
68   g4 a b c \break
69
70   \key a \major
71   a,4 b cis d
72   e4 fis gis a \break
73
74   \key d \dorian
75   d,4 e f g
76   a4 b c d
77 }