[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with alternate endings
From: |
Cameron Hall |
Subject: |
Problems with alternate endings |
Date: |
Mon, 30 Sep 2024 13:53:15 -0500 |
I am experimenting some more with Lilypond, and I've run into a few
problems trying to use the volta repeat with alternate endings. I've
decided to put all of the dynamics and structure of the piece into a
variable called common. This example is in 3/8 time with an eighth note
pickup. Because of this, the first ending needs to be a partial bar,
and the second ending (which continues on) needs to be a full bar. When
I try to do that, it complains about the barcheck failing in the
second ending, though it is aware of the partial bar for the first
ending, and that one passes. Additionally, it refuses to end the slur
to the A at the beginning of the second ending and gives me a warning
about that. Also, the MIDI file completely ignores the repeat, despite
using the unfoldRepeats function.
%%% BEGIN EXAMPLE %%%
\version "2.24.4"
\language "english"
\header {
title = "Für Elise"
composer = "Ludwig van Beethoven"
}
common = { % dynamics and structure of the piece
\tempo "Poco moto"
\time 3/8
\repeat volta 2 {
\partial 8 s8\pp |
s8\< s4\> | s4.*3\! |
s8\< s4\> | s4.*2\! |
\alternative {
\volta 1 { \partial 4 s4 | }
\volta 2 { s8. s8.\< <>\! | }
}
}
\break
s4.*4\mf |
\bar "|."
}
top = \fixed c' {
e'16( ds' |
e' ds' e' b d' c' | a8) r16 c( e a | b8) r16 e( gs b | c'8) r16 e( e'
ds' | e' ds' e' b d' c' | a8) r16 c( e a | b8) r16 e( c' b |
a8) r8 | % 1st ending
a8) r16 b( c' d' | % 2nd ending
e'8.) g16( f' e' | d8.) f16( e' d' | c'8.) e16( d' c' | b8) r16 e(
e') r | }
bottom = {
\clef bass
r8 |
R4. | a,16( e a) r r8 | e,16( e gs) r r8 | a,16( e a) r r8 |
R4. | a,16( e a) r r8 | e,16( e gs) r r8 |
a,16( e a) r | % 1st ending
a,16( e a) r r8 | % 2nd ending
c16( g c') r r8 | g,16( g b) r r8 | a,16( e a) r r8 | e,16-. e( e') r
r8 | }
\score { % Sheet music
\new PianoStaff
<<
\new Staff = "upper" \top
\new Dynamics \common
\new Staff = "lower" \bottom
>>
\layout {}
}
\score { % MIDI file
\unfoldRepeats <<
\new Staff \new Voice << \top \common >>
\new Staff \new Voice << \bottom \common >>
>>
\midi {}
}
%%% END EXAMPLE %%%
If I duplicate the whole repeat volta thing in each staff like this:
%%% BEGIN EXAMPLE %%%
top = \fixed c' {
\repeat volta 2 {
e'16( ds' |
e' ds' e' b d' c' | a8) r16 c( e a | b8) r16 e( gs b | c'8) r16 e(
e' ds' | e' ds' e' b d' c' | a8) r16 c( e a | b8) r16 e( c' b |
\alternative {
\volta 1 { a8) r8 | } % 1st ending
\volta 2 { a8) r16 b( c' d' | } % 2nd ending
}
}
e'8.) g16( f' e' | d8.) f16( e' d' | c'8.) e16( d' c' | b8) r16 e(
e') r | }
bottom = {
\clef bass
\repeat volta 2 {
r8 |
R4. | a,16( e a) r r8 | e,16( e gs) r r8 | a,16( e a) r r8 |
R4. | a,16( e a) r r8 | e,16( e gs) r r8 |
\alternative {
\volta 1 { a,16( e a) r | } % 1st ending
\volta 2 { a,16( e a) r r8 | } % 2nd ending
}
}
c16( g c') r r8 | g,16( g b) r r8 | a,16( e a) r r8 | e,16-. e( e') r
r8 | }
%%% END EXAMPLE %%%
then the barcheck warnings go away and the MIDI file plays the
repeats (the programmer in me would like to not duplicate that code in
every staff). However, I still can't get the slur to work.
- Problems with alternate endings,
Cameron Hall <=