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?