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' }
}
%%%%
-- Aaron Hill