lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Numbers as easy note heads with RhythmicStaff


From: Gianmaria Lari
Subject: Numbers as easy note heads with RhythmicStaff
Date: Fri, 15 Jun 2018 14:27:17 +0200

This code 

\version "2.19.81"
\new RhythmicStaff { \easyHeadsOn a4 b8 a }

generate this score:

image.png
That's great. 

Now instead of the note name, I would like to write the numbers representing the scale-degree inside the note head. So I tried adding to the previous code the snippet I found in the documentation but it doesn't compile. This is code..

\version "2.19.81"
#(define Ez_numbers_engraver
   (make-engraver
    (acknowledgers
     ((note-head-interface 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 {
  ragged-right = ##t
  \context {
    \Voice
    \consists \Ez_numbers_engraver
  }
}

\new RhythmicStaff { a4 b8 a }

and this is the error I get

Interpreting music..document.ly:8:26: In procedure ly:pitch-notename in _expression_ (ly:pitch-notename tonic-pitch):

..document.ly:8:26: Wrong type argument in position 1 (expecting Pitch): ()


Any suggestion to fix it?
Thank you, g.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]