lilypond-user
[Top][All Lists]
Advanced

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

Scheme: default values?


From: Graham King
Subject: Scheme: default values?
Date: Wed, 29 Jan 2014 05:41:10 +0000

To generate MIDI output, I use a piece of boilerplate lilypond code, containing:
    \midi { \context { \Score tempoWholesPerMinute = #currentTempo }}
where it is expected that:
    currentTempo = #(ly:make-moment TACTUS RF)

I would like to generalise the boilerplate code so that it works with suitable defaults even when these variables have not been defined.  Something like this pseudocode:

if defined(currentTempo)
    currentTempo
else {
    if NOT defined(TACTUS)
        TACTUS = 50
    if NOT defined(RF)
        RF = 1
    currentTempo = #(ly:make-moment TACTUS RF)
}

I've been experimenting with Scheme functions and optional, named, arguments.  The results vary between embarrassing and null.  Please could someone point me in the right direction, or tell me authoritatively that the quest is futile?
reply via email to

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