Hi,
I'm trying to define a music function as below, however I've faced difficulties with parameter predicates, visibility of the Staff object, and flexibility of the solution ideally without code duplication
Desired music function (the code is not working)
momentBeat = #(define-music-function (moment beat scope)
(fraction? list? (what? Staff))
#{
\set #scope.beamExceptions = #'()
\set #scope.baseMoment = #(ly:make-moment moment)
\set #scope.beatStructure = #beat
#})
Usage
\momentBeat 1/2 #'(1)
\momentBeat 1/4 1,1,1,1 Voice
Questions
- It seems that Staff is not available to Guile at that moment. I tried to use "Staff" string and 'Staff symbol for the scope parameter with a cond _expression_ and code replication for Staff and Voice, but I did not manage to get it to work due to incorrect predicates errors
- How would it look like an idiomatic and working implementation of the above music function?
Thank you,
Vlad