lilypond-user
[Top][All Lists]
Advanced

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

Re: Defining custom MIDI dynamics


From: Simon Albrecht
Subject: Re: Defining custom MIDI dynamics
Date: Tue, 09 Sep 2014 22:56:44 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.1.0

Hello Knute,

perhaps its just an unusual topic few have experience with?
At least I don’t; yet after a look in the NR section on the topic I think you’re on the right path with the cond approach. After all, you want to define a single function to pass it on as dynamicAbsoluteVolumeFunction. And to do this, you tell Lily what she will do with some exceptional values (like pTresDouxMarkup and the like in your example) and to resort to the usual procedure (default-dynamic-absolute-volume) in all other cases.
Only there are some brackets missing, see below.

Am 09.09.2014 um 20:55 schrieb Knute Snortum:
I'm wondering why I have gotten no responses.  Did I frame the question poorly?  Did it get to the list?


Knute Snortum
(via Gmail)

On Mon, Sep 8, 2014 at 9:48 AM, Knute Snortum <address@hidden> wrote:
I know how to set a single custom dynamic:
(“how to define the absolute midi volume for a single custom dynamic” would have hit the nail on the head)

#(define (myDynamics dynamic)
   (if (equal? dynamic pTresDouxMarkup )
         0.55
          (default-dynamic-absolute-volume dynamic))))

..but how do I set two or more dynamics like this:

#(define (myDynamics dynamic)
   (cond (equal? dynamic pTresDouxMarkup )
         0.55
         (equal? dynamic pLegerMarkup)
         0.77
         (else
          (default-dynamic-absolute-volume dynamic))))
This should be
#(define (myDynamics dynamic)
   (cond
     ;;
each (<test> <_expression_> …) sequence must be wrapped
     ;; into brackets
     ((equal? dynamic pTresDouxMarkup)
      0.55)
     ((equal? dynamic pLegerMarkup)
      0.77)
     ;; and so forth: insert as many as you like
     (else
      (default-dynamic-absolute-volume dynamic))))

See <http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-7.html#%_sec_4.1.5> for more information on syntax and semantics of (cond …).
(which document is the first place for delving deeper into scheme)

If instead of this approach you use multiple defines, the latter ones will override the former IIUC, so that’s no good idea.

I may encourage you to do some trial and error – it can’t do any harm and it will help in posting more specific questions.

HTH, Simon


reply via email to

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