lilypond-user
[Top][All Lists]
Advanced

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

Re: Tweaking in an engraver


From: David Kastrup
Subject: Re: Tweaking in an engraver
Date: Sun, 19 Jul 2015 20:57:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

"Peter Gentry" <address@hidden> writes:

> My instrumentranges.ly examines note pitch an based on a suplied criterion 
> changes notehead colour and style - is this the sort of
> thing you had in mind.
>
> \version "2.19.15"
> % 
> -------------------------------------------------------------------------------------------------
> % include function file instrument_ranges.ly
> % usuage include --> \include "./ranges/instrument_ranges.ly"
> % usuage call -->       \naturalizeInstrumentRange "instrument" music
> % this function will confine all pitches to the individual instruments range
> % Note the ranges refer to music transposed for each instrument not the true 
> pitches.
> % use % for comment outside scheme function -  use ; inside scheme functions
> % 
> -------------------------------------------------------------------------------------------------
>
> #(define (naturalize-instrument-range p instrument ) 
>   (let ((o (ly:pitch-octave p))
>   (a (* 4 (ly:pitch-alteration p)))
> ;; alteration, a, in quarter tone steps, for historical reasons
>   (n (ly:pitch-notename p)))
> (define np 0)
> (define op (+ (+ (+ (* 14 o) ) (* n 2) ) (/ a 2)))

Uh, (define op (+ (* 14 o) (* n 2) (/ a 2)))


> ;; clarinet range e to f'  -1 2 0  to 1 3 0  (-11 to 20)
> (cond
>    ((equal? instrument "clarinet" )
>    (if   (< op -38)  (begin (set! o (+ o 1))) )

Why `begin' here? (if (< op -38) (set! o (1+ o)))

> % this function rebuilds the music object optionally changing pitch and 
> notehead color
> % 
> -------------------------------------------------------------------------------------------------
> #(define (instrumentrange music instrument ) 
>    (  ly:music? string? ) 

Interesting.  This calls ly:music? on string? which unsurpringly returns
#f since string? is not a music expression.  #f is subsequently ignored.


-- 
David Kastrup



reply via email to

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