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: Aaron Hill
Subject: Re: drawing a range reguardless of transposition
Date: Thu, 14 Nov 2019 09:09:16 -0800
User-agent: Roundcube Webmail/1.3.8

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

Attachment: out-of-range.cropped.png
Description: PNG image


reply via email to

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