Hello Knute,
so you are using books to allow specification of the midi filename. This is
probably a fine usecase, but it still seems like a bit of an abuse of the book
mechanic to me. Rather I’d adapt the midi output name logic itself.
This code adapts the internal function responsible for writing out the midi
performances (scm/midi.scm:write-performances-midis) in such a way that
#(set-current-module (resolve-module '(lily))) is true lock picking :-) I mean, sometimes you really can't avoid monkeypatching internals, but I'd reserve it for desperate cases.