kastdeur / lilydrum

Set up a lilydrum file in the same way as there is a bagpipe.ly. Main focus is on pipeband (snare) drumming.
https://deboone.nl/lilydrum
MIT License
9 stars 3 forks source link

detect if music is in `\repeat volta` #17

Open kastdeur opened 2 years ago

kastdeur commented 2 years ago

Not really something that should be in this package, but a function that detects whether the current environment is in a \repeat volta (or instead in a \repeat unfold) would be really cool to have. \ This could allow music to transform itself depending on the context.

kastdeur commented 2 years ago

One use is to switch between slurs and laissezVibrer at the end of a repeat. \ e.g. In the following the unfolded repeats work nicely, but doesn't work in volta correctly.

nice unfolded

\version "2.20.0"
\include "lilydrum.ly"

music = \drummode {
    \repeat volta 2  {
        d4 d |
    } \alternative {
      { d4:32( d4:32)( <>)}
      { d4:32( d4:32) }
    }
}

\score {
    \new PipeBandDrumStaff {
        \time 2/4
        \unfoldRepeats \music
    }
}

unfolded: (nice) repeat preview

volta: (ugly, and wrong) repeat preview

nice volta

\version "2.20.0"
\include "lilydrum.ly"

music = \drummode {
    \repeat volta 2  {
        d4 d |
    } \alternative {
      { d4:32( d4:32) \laissezVibrer}
      { d4:32( d4:32) }
    }
}

\score {
    \new PipeBandDrumStaff {
        \time 2/4
        \unfoldRepeats \music
    }
}

unfolded: (ugly, and wrong) repeat preview

volta: (semi-nice) repeat preview