lilypond-user
[Top][All Lists]
Advanced

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

Re: Need help displaying note names in 2.22


From: Michael Werner
Subject: Re: Need help displaying note names in 2.22
Date: Sun, 6 Aug 2023 11:46:11 -0400

Hi Victor,

On Sat, Aug 5, 2023 at 7:12 PM Viktor Mastoridis <viktor.mastoridis@gmail.com> wrote:
Hello,

I have been using the syntax below for several years; the last code update I did was in December 2022, and it worked well since. 
Today I noticed that I can't get the sharp/flat note names properly.
C# & Eb are not displayed.
Can you please help?
-------------------


\version "2.22.1"
chimenames =
#`(
    ("c" . "C")
    ("cis" . "C♯")
   ("d" . "D")
      ("es" . "E♭")
   )

ChimeNoteNames =
#(lambda (grob)
    (let* ((default-name (markup->string (ly:grob-property grob 'text)))
           (new-name (assoc-get default-name chimenames)))
          (ly:grob-set-property! grob 'text new-name)
    (ly:text-interface::print grob)))

Is the main idea here to just get the note names displayed in uppercase? If so, I've been doing basically the same thing with this:

\version "2.25.6"

music = \relative c { c, cis d es }

\score
{
  <<
    \new TabStaff
    \with {
      stringTunings = #bass-tuning
    }          
    { \music  }
   
    \new NoteNames {
      \set noteNameFunction = #(lambda (pitch ctx)
         (markup #:sans (note-name->markup pitch #f))
         )

      \music
    }
  >>
  \layout { }  \midi { }
}

It might not be perfect but it gets the job done. For reference, the note-name->markup function reference is:

Function: note-name->markup pitch lowercase?

Return pitch markup for pitch, including accidentals printed as glyphs. If lowercase? is set to false, the note names are capitalized.

-- 
Michael

reply via email to

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