[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scheme --> (define-music-function ...)
From: |
Paul |
Subject: |
Re: scheme --> (define-music-function ...) |
Date: |
Sun, 24 Nov 2013 14:03:10 +1100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
> > Would somebody combine the two and put me out of my misery?
>
> The former? No. The latter:
You propose a good solution - thank you.
> If you are really talking about the octave _starting_ from middle C,
> you'd write 3 instead of 0 as the second argument of ly:make-pitch.
I really do mean the octave /starting/ from middle C, such that the
notes on a keyboard ascending from middle C are:
c4 d4 e4 f4 g4 a4 b4 c5
(Those numbers are the octave, not note lengths.)
I simply wanted a blunt way to say "make sure this note is in /this/
octave" - in a way that makes unambiguous sense to me. I usually
remove superfluous checks after the music compiles successfully.
Here's the final snippet:
midiOctaveCheckPreviousNote =
#(define-music-function (parser location oct-n) (integer?)
#{ \octaveCheck $(ly:make-pitch (- oct-n 4) 3) #})
And the last three notes in the scale mentioned above:
a \midiOctaveCheckPreviousNote 4
b \midiOctaveCheckPreviousNote 4
c \midiOctaveCheckPreviousNote 5
--
P.