lilypond-user
[Top][All Lists]
Advanced

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

scheme --> (define-music-function ...)


From: Paul
Subject: scheme --> (define-music-function ...)
Date: Sat, 23 Nov 2013 23:38:28 +1100
User-agent: Mutt/1.5.21 (2010-09-15)

I am having syntactic difficulties creating a macro.

The end game is to notate "\midiOctaveCheck 4 c d e" and know that the
notes (c, d, and e) are in the octave starting from Middle C.

Here is the skeleton of what I planned to do:
    midiOctaveCheck =
        #(define-music-function (parser location oct-n) (integer?)
            #{ ...music... #})

This is the Scheme I want to apply:
    (define midi-octave-check
      (lambda (oct-n)
        (string-append
         "\\octaveCheck c"
         (cond ((= oct-n 3) "")
               ((< oct-n 3) (make-string (- 3 oct-n) #\,))
               ((> oct-n 3) (make-string (- oct-n 3) #\'))))))

Would somebody combine the two and put me out of my misery?  (I'm on
version 2.16.1 here.)

--
P.



reply via email to

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