lilypond-user
[Top][All Lists]
Advanced

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

Re: Solfege Syllables Easy Notes


From: Lukas-Fabian Moser
Subject: Re: Solfege Syllables Easy Notes
Date: Sat, 8 Oct 2022 10:01:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

Hi,

Am 08.10.22 um 02:36 schrieb Valentin Petzel:
note that easy notes heads will make use of the note heads note-names property
if set. This allows us to make an arbitrary NoteHead use arbitrary names.

So to achieve what you intend to do you could simply rewrite the key music
function to also override this property on a Staff level (key affects the whole
staff) as you can see in the appended file.

A different option would be to write an engraver that acknowledges NoteHeads,
derives the tonic from the context and sets the note-names property.

... which probably is the "cleaner" solution, as it does not require re-defining standard functions.

One can take the example engraver given in https://lilypond.org/doc/v2.23/Documentation/notation/note-heads#easy-notation-note-heads as a basis:

\version "2.23.6"

#(define solfeggio-list (list "do" "re" "mi" "fa" "so" "la" "ti"))

#(define sharp-vowel #\i)
#(define flat-vowel #\e)

Solfeggio_engraver =
#(lambda (context)
   (make-engraver
    (acknowledgers
     ((note-head-interface engraver grob source-engraver)
      (let* (
         (tonic-pitch (ly:context-property context 'tonic))
         (tonic-name (ly:pitch-notename tonic-pitch))
         (grob-pitch
          (ly:event-property (event-cause grob) 'pitch))
         (delta (ly:pitch-diff grob-pitch tonic-pitch))
         (syllable
          ; use string-copy because of later in-place modification
          (string-copy
           (list-ref solfeggio-list (ly:pitch-notename delta)))))
        (case (ly:pitch-alteration delta)
          ((0) (noop))
          ((1/2) (string-set! syllable 1 sharp-vowel))
          ((-1/2) (string-set! syllable 1 flat-vowel))
          (else (string-set! syllable 1 #\?)))
    (ly:grob-set-property! grob 'note-names (make-vector 7 syllable)))))))

#(set-global-staff-size 26)

\layout {
  ragged-right = ##t
  \context {
    \Voice
    \consists \Solfeggio_engraver
  }
}

\relative c' {
  \easyHeadsOn
  c4 d e f
  g4 a b c
  c b bes a
  fis g as g
  \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
}

This uses "do" for the tonic (and -i for raised and -e for flat notes), regardless of the mode (major/minor etc.)

For la-based minor, one would need to take a different approach: Currently LilyPond (to my knowledge) only saves the tonic in the context (and a list of alterations). I have been thinking for a while that \key should store more explicit information in the context.

Lukas




reply via email to

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