lilypond-user
[Top][All Lists]
Advanced

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

Re: LSR snippet "Controlling of the pitch range in a score" broken at2.1


From: Phil Holmes
Subject: Re: LSR snippet "Controlling of the pitch range in a score" broken at2.15.40
Date: Fri, 6 Jul 2012 17:22:55 +0100

----- Original Message ----- From: "Patrick or Cynthia Karl" <address@hidden>
To: <address@hidden>
Sent: Friday, July 06, 2012 5:07 PM
Subject: LSR snippet "Controlling of the pitch range in a score" broken at2.15.40



The LSR snippet "Controlling of the pitch range in a score" contains the code for a function, colorizeOutOfRange. This function works at 2.14.2, but doesn't at 2.15.40.

This can be demonstrated by compiling the following:

\include "./colorize.ly"

music = \relative c' { c d e f g a b }

\new Staff { \colorizeOutOfRange d' a' \music }

where the file colorize.ly contains the following code from the cited snippet:

colorizeOutOfRange = #(define-music-function (parser location
low-note high-note music )(ly:music? ly:music? ly:music?)
"Colorizes in red notes out of range `low-note `high-note"
(let* (
  (low-elts (ly:music-property low-note 'elements))
  (high-elts (ly:music-property high-note 'elements))
  (low-pitch (and (pair? low-elts)
                  (ly:music-property (car low-elts) 'pitch)))
  (high-pitch (and (pair? high-elts)
                   (ly:music-property (car high-elts) 'pitch))))
 (if (and (ly:pitch? low-pitch)
          (ly:pitch? high-pitch)
          (ly:pitch<? low-pitch high-pitch))
    (music-map
      (lambda (evt)
        (let ((p (ly:music-property evt 'pitch)))
          (if (and (ly:pitch? p)
                   (or (ly:pitch<? p low-pitch)
                       (ly:pitch<? high-pitch p)))
            (let ((tweaks (ly:music-property evt 'tweaks)))
                (ly:music-set-property! evt 'tweaks
                    (acons 'color red tweaks))))
          evt))
      music)
    music)))

When compiled with lilypond 2.14.2 the notes c and b are colored red. When compiled with lilypond 2.15.40, all notes are black.

Does anyone know a fix for colorizeOutOfRange?


Have you tried updating it with convert-ly?

http://lilypond.org/doc/v2.15/Documentation/usage/invoking-convert_002dly

--
Phil Holmes



reply via email to

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