Two cue voices: Difference between revisions
Appearance
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
No edit summary |
||
| Line 47: | Line 47: | ||
[[Category:Simultaneous notes]] | [[Category:Simultaneous notes]] | ||
[[Category:Staff notation]] | [[Category:Staff notation]] | ||
[[Category:Preparing parts]] | [[Category:Preparing parts]][[Category:Snippet]] | ||
Revision as of 23:02, 21 November 2025
By default, LilyPond directs all simultaneous cues into a single voice. Here is a solution that uses two voices for two different cues.
\version "2.24"
cueDuringAlt =
#(define-music-function (what dir main-music)
(string? ly:dir? ly:music?)
(_i "Create a cue.
This function inserts the contents of quote @var{what} corresponding to
@var{main-music}, in a @code{CueVoice} context called @code{cueAlt} oriented by
@var{dir}.")
(make-music 'QuoteMusic
'element main-music
'quoted-context-type 'CueVoice
'quoted-context-id "cueAlt"
'quoted-music-name what
'quoted-voice-direction dir))
sop =
\new Voice = "sop" \relative c''' {
\repeat unfold 8 g4
}
bass =
\new Voice = "bass" \relative c' {
\repeat unfold 8 b4
}
first =
\new Voice \relative c' {
c4 d c d
\cueDuring #"sop" #UP
\cueDuringAlt #"bass" #DOWN
{ \override MultiMeasureRest.staff-position = 0
R1 }
}
\addQuote #"sop" \sop
\addQuote #"bass" \bass
{ \first }
{ \second }