4

I'm typesetting music (a set of versicles and responses), some of which are accompanied and some of which aren't, and I'm using some custom Scheme functions to collect pieces in parallel (and automatically insert common elements).

For the unaccompanied versicles, I wanted to write a Scheme function that would generate a rest of the same length as the block of vocal music (to keep everything aligned in the accompaniment later on), but I can't figure out how to do that. I'm trying make-music 'RestEvent, but nothing I've tried will work for the duration parameter:

  • a block of music doesn't have a duration property to get
  • the example in the documentation (just passing a note directly to the constructor) doesn't work for a block (this is probably the same thing as above)
  • ly:music-length returns a moment, and I can't find any way to convert a moment to a duration

Is there any manageable way to create a rest that is the same length as a generic ly:music? object?

1

2 Answers 2

4

Try Scheme functions mmrest-of-length or more likely skip-of-length which take music as argument and return a music expression that is a multimeasure rest or a plain skip, respectively.

You can write something like $(skip-of-length myMusic) inside of a music expression, assuming that myMusic is a music variable with the desired length.

1
  • 1
    That's what I needed! It's tucked away under the "cadenza" docs, and I'm not setting a cadenza, but it's the same situation (drop out a part while something else is going on). Jan 9, 2018 at 17:10
4

As of version 2.23.6, you can just write

\skip \music

One difference compared to

$(skip-of-length music)

is that it will work in the context of \unfoldRepeats.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.