"Peter Gentry" <peter.gen...@sunscales.co.uk> 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 _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user