lilypond-user
[Top][All Lists]
Advanced

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

Re: drawing a range reguardless of transposition


From: Malte Meyn
Subject: Re: drawing a range reguardless of transposition
Date: Fri, 15 Nov 2019 10:09:06 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1



Am 14.11.19 um 18:09 schrieb Aaron Hill:
On 2019-11-14 8:53 am, Sandro Santilli wrote:
In order to determine if I'm writing something that can
be played by an instrument, is there a way to display
on the score the supported range by that instrument ?

I'd like to have something that doesn't change when I
transpose, so to know if transpositions are possible
at all...

You could do something like this:

%%%%
\version "2.19.83"

highlightOutOfRange = #(define-scheme-function
   (color lower upper)
   ((color? red) ly:pitch? ly:pitch?)
   (grob-transformer 'color (lambda (grob orig)
     (let* ((cause (ly:grob-property grob 'cause))
             (pitch (ly:event-property cause 'pitch)))
       (if (or (ly:pitch<? pitch lower) (ly:pitch<? upper pitch))
         color orig)))))

\layout {
   \context { \Voice
     \override NoteHead.color = \highlightOutOfRange c' c''
   }
}

{
   \transpose c g, \fixed c' { c d e f g a b c' }
   \transpose c f \fixed c' { c d e f g a b c' }
}
%%%%

Nice! This should be added at least to the snippet repository if not to vanilla LilyPond. I don’t know whether many people would use it but it’s a small addition and AFAIK this feature is present in every other engraving software I know …



reply via email to

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