]> git.donarmstrong.com Git - lilypond.git/commitdiff
Docs: Added snippet for numbers as easy note heads.
authorDavid Pounder <pounderd@lineone.net>
Wed, 13 Jan 2010 18:14:53 +0000 (18:14 +0000)
committerNeil Puttock <n.puttock@gmail.com>
Fri, 15 Jan 2010 00:21:11 +0000 (00:21 +0000)
Documentation/snippets/new/numbers-as-easy-note-heads.ly [new file with mode: 0644]
Documentation/snippets/numbers-as-easy-note-heads.ly [new file with mode: 0644]
Documentation/snippets/pitches.snippet-list

diff --git a/Documentation/snippets/new/numbers-as-easy-note-heads.ly b/Documentation/snippets/new/numbers-as-easy-note-heads.ly
new file mode 100644 (file)
index 0000000..2df46c5
--- /dev/null
@@ -0,0 +1,51 @@
+\version "2.13.11"
+
+\header {
+  lsrtags = "pitches"
+  texidoc = "
+Easy notation note heads use the @code{note-names} property
+of the @code{NoteHead} object to determine what appears inside
+the note head.  By overriding this property, it is possible
+to print numbers representing the scale-degree.
+
+A simple engraver can be created to do this for every note head
+object it sees.
+"
+  doctitle = "Numbers as easy note heads"
+}
+
+#(define Ez_numbers_engraver (list
+  (cons 'acknowledgers
+   (list
+     (cons 'note-head-interface
+       (lambda (engraver grob source-engraver)
+         (let* (
+           (context (ly:translator-context engraver))
+           (tonic-pitch (ly:context-property context 'tonic))
+           (tonic-name (ly:pitch-notename tonic-pitch))
+           (grob-pitch (ly:event-property (event-cause grob) 'pitch))
+           (grob-name (ly:pitch-notename grob-pitch))
+           (delta (modulo (- grob-name tonic-name) 7))
+           (note-names (make-vector 7 (number->string (+ 1 delta)))))
+        (ly:grob-set-property! grob 'note-names note-names))))))))
+
+\layout {
+  \context {
+    \Voice
+    \consists \Ez_numbers_engraver
+  }
+}
+
+\relative c' {
+  \easyHeadsOn
+  c4 d e f
+  g4 a b c \break
+
+  \key a \major
+  a,4 b cis d
+  e4 fis gis a \break
+
+  \key d \dorian
+  d,4 e f g
+  a4 b c d
+}
diff --git a/Documentation/snippets/numbers-as-easy-note-heads.ly b/Documentation/snippets/numbers-as-easy-note-heads.ly
new file mode 100644 (file)
index 0000000..9ccb261
--- /dev/null
@@ -0,0 +1,56 @@
+% Do not edit this file; it is automatically
+% generated from Documentation/snippets/new
+% This file is in the public domain.
+%% Note: this file works from version 2.13.11
+\version "2.13.11"
+
+\header {
+  lsrtags = "pitches"
+  texidoc = "
+Easy notation note heads use the @code{note-names} property
+of the @code{NoteHead} object to determine what appears inside
+the note head.  By overriding this property, it is possible
+to print numbers representing the scale-degree.
+
+A simple engraver can be created to do this for every note head
+object it sees.
+"
+  doctitle = "Numbers as easy note heads"
+} % begin verbatim
+
+
+#(define Ez_numbers_engraver (list
+  (cons 'acknowledgers
+   (list
+     (cons 'note-head-interface
+       (lambda (engraver grob source-engraver)
+         (let* (
+           (context (ly:translator-context engraver))
+           (tonic-pitch (ly:context-property context 'tonic))
+           (tonic-name (ly:pitch-notename tonic-pitch))
+           (grob-pitch (ly:event-property (event-cause grob) 'pitch))
+           (grob-name (ly:pitch-notename grob-pitch))
+           (delta (modulo (- grob-name tonic-name) 7))
+           (note-names (make-vector 7 (number->string (+ 1 delta)))))
+        (ly:grob-set-property! grob 'note-names note-names))))))))
+
+\layout {
+  \context {
+    \Voice
+    \consists \Ez_numbers_engraver
+  }
+}
+
+\relative c' {
+  \easyHeadsOn
+  c4 d e f
+  g4 a b c \break
+
+  \key a \major
+  a,4 b cis d
+  e4 fis gis a \break
+
+  \key d \dorian
+  d,4 e f g
+  a4 b c d
+}
index d6f021742812de8dc297c9f02b5c74a3bf33d602..496bd050c5ab80f24e419bed732043a5d51e161b 100644 (file)
@@ -8,6 +8,7 @@ dodecaphonic-style-accidentals-for-each-note-including-naturals.ly
 generating-random-notes.ly
 makam-example.ly
 non-traditional-key-signatures.ly
+numbers-as-easy-note-heads.ly
 ottava-text.ly
 preventing-extra-naturals-from-being-automatically-added.ly
 preventing-natural-signs-from-being-printed-when-the-key-signature-changes.ly