Lilypond repeat symbol vanishes next line uses: \bar ".|" - lilypond

I am creating a chord chart where the first 8 bars are repeated using \repeat volta 2 {}; no problem. I use \bar ".|" to force bar lines on the left side. Not conventional, but, that's what I want.
The next line starts with the above mentioned \bar ".|". That adds the next line correctly, however, the repeat symbol at the end of the repeat section is not rendered.
Here's my snippet:
\version "2.18.2"
\score {
\chordmode {
\repeat volta 2 {
\bar ".|" c1 | c |
\break
\bar ".|" d1 | d |
\break
}
% uncomment one of the following two lines only
%This first one adds a new line correctly, but the bar line is wrong.
\bar "|" c1 |
%This one add a new line, but the above repeat section has no ending repeat symbol
%\bar ".|" c1 |
}
}

You hit a known problem: see Issue #3688 Manual barlines overwrite repeat barlines.
Anyway, your snippet will compile fine as long as you avoid manual bars (you need it only in the first measure) and use \repeat commands instead for each repetition.
Also, you probably want to use \bar ".|:, as explained in the documentation.
\version "2.18.2"
\score {
\chordmode {
\repeat volta 2 {
\bar ".|:"
c1 | c |
\break
}
\repeat volta 2 {
d1 | d |
\break
}
c1 d |
}
}

Related

How can I include ossia without creating a blank space?

I am trying to add an ossia staff above the upper staff of a grand
staff. Working from this mailing list post, I have
constructed a minimal example that almost does what I want. The
problem is that the entire score contains a blank space for the ossia
staff, even in systems that have no ossia.
Here is the example (truly, a melodious composition):
\version "2.18.2"
ossia = \new Staff = "ossia" \with {
\remove "Time_signature_engraver"
fontSize = #-2
\override StaffSymbol #'staff-space = #(magstep -2)
\override Clef #'transparent = ##t
\override KeySignature #'stencil = ##f
} {
\key b \major
\override Staff.BarLine #'allow-span-bar = ##f
\stopStaff
s2.*100 % ???
}
treble = \new Staff = "treble" {
\clef treble
\key b \major
\relative c' {
\repeat unfold 10 { b8 cis dis fis dis cis }
b4 dis fis |
b4
<<
{ dis, fis }
\context Staff = "ossia" {
\startStaff \tuplet 3/2 { dis8 b dis } fis4 \stopStaff
}
>> |
b2. |
}
}
bass = \new Staff = "bass" {
\clef bass
\key b \major
\relative c {
\repeat unfold 12 { fis,4 fis4 fis4 | }
b2.
}
}
pianoStaff = \new PianoStaff {
\compressFullBarRests
\time 3/4
<<
\ossia
\treble
\bass
>>
}
\paper {
#(set-paper-size "letter")
indent = 25\mm
short-indent = 5\mm
}
\score {
<< \pianoStaff >>
% This changes nothing:
% \layout { \context { \Staff \RemoveEmptyStaves } }
}
Here is the output (PNG image, 85 KB).
Some interesting things to note:
If I remove the s2.*100 at line 13 (marked % ???), or change the
value to anything smaller than 12, the ossia staff renders
completely incorrectly. It appears below the bass clef, includes the
clef and time signature, and is in the key of C (i.e., the rendered
notes include accidentals). Basically, it looks like it's failed to
notice that the ossia staff exists and has constructed a brand new
one. I suspect that this is because the ossia staff is supposed to
extend past each point where it is used—i.e., when switching staff
contexts, one can go "back in time" but not forward. I don't really
understand this, but I can live with it, as it doesn't seem to have
an intrinsic effect as long as \compressFullBarRests is enabled.
I have included the paper size in the MWE to force consistent
dimensions on different systems.
As I noted in the score, adding \RemoveEmptyStaves does not remove
the empty staves.
My question is: how can I keep the ossia staff rendered as it does in
this example (small and above the treble clef) without adding the
empty space on all previous systems?
\RemoveEmptyStaves is not working because the staves are within a PianoStaff, so you must add \remove "Keep_alive_together_engraver" to the \layout block. Here's a minimal example of a documentation snippet slightly modified:
\version "2.18.2"
\new PianoStaff
<<
\new Staff = "ossia" \with {
\remove "Time_signature_engraver"
\hide Clef
fontSize = #-3
\override StaffSymbol.staff-space = #(magstep -3)
\override StaffSymbol.thickness = #(magstep -3)
} \relative c'' {
R1*3
c4 e8 d c2
}
\new Staff \relative c' {
c4 b c2
e4 f e2
g4 a g2 \break
c4 b c2
g4 a g2
e4 d c2
}
>>
\layout {
\context {
\Staff \RemoveEmptyStaves
\override VerticalAxisGroup.remove-first = ##t
}
\context {
\PianoStaff
\remove "Keep_alive_together_engraver"
}
}
Your example is quite big, not a real MWE. s2.*100 doesn't make any sense to me. I suggest that you submit a smaller example.

Lilypond: manually print a key signature (or cancellation)

My piece involves a D.S. al coda repeat across a key signature change, like:
\mark \markup { \musicglyph #"scripts.segno" }
\key a \minor
a b c' d'
% more music in a minor
\key a \major
a b cis' d'
% more music in a major
\once \override Score.RehearsalMark #'break-visibility = #end-of-line-visible
\once \override Score.RehearsalMark #'self-alignment-X = #RIGHT
\mark "D.S. al coda"
\bar "||"
% coda in a major follows
To help the player make the transition back from a major to a minor at the dal segno I'd like to print a key cancellation just before the double bar. The bars of the coda that follows, should remain in a major.
How would I accomplish that in Lilypond 2.14 or higher?
Append to your code
\key a \minor % change key back from a-major to a-minor
s1 % enforce output of key cancellation with a hidden rest
\bar "" % suppress trailing bar

How do I limit the Staff.NoteHead overrides?

I often have a string of harmonics, so I decided to use a music function (the function is a tangent; if I place the override directly with the notes I get the same problem. The issue is the override itself):
harmonics =
#(define-music-function
(parser location notes)
(ly:music?)
#{
%\harmonicsOn
\override Staff.NoteHead #'style = #'harmonic-mixed
$notes
\revert Staff.NoteHead #'style
%\harmonicsOff
#}
)
\harmonicsOn and \harmonicsOff works, but they're always hollow notes so I don't want to use them. Overriding the notehead allows me to have solid heads on quarter notes.
My problem is that the note heads are overridden for all notes in the duration, not only the notes supplied to the function (see m. 2, 3 in the image below the following code):
melody = \relative c' { \stemUp
\repeat unfold 4 { r8 b g b e' b, | }
\bar "|."
}
harmony = \relative c' { \stemDown
e,2. |
\harmonics { e } |
\harmonics { e4 e } s |
e2. |
}
\score {
\new Staff {
\time 3/4 \clef "treble_8"
\key g \major
<<
\new Voice { \melody} \new Voice { \harmony}
>>
}
}
I'm looking for a way to modify only the notes I want (in this case, in \harmony), leaving the other notes within that duration untouched.
Edit: I tried with lilypond 2.17 using the new \temporary command, but I get the same result.
Full code | NoteHead Internals Documentation
Your problem is that your function uses the \override command, which affects all simultaneous grobs in a given context, and thus it is changing all noteheads in the Staff context (which contains both melody and harmony music). If you change the noteheads only in the Voice context, then your problem is solved:
harmonics =
#(define-music-function
(parser location notes)
(ly:music?)
#{
%\harmonicsOn
\override Voice.NoteHead #'style = #'harmonic-mixed
$notes
\revert Voice.NoteHead #'style
%\harmonicsOff
#}
)

LilyPond: Can a double barline follow a multi-measure rest?

I have a multi-measure rest at the end of a piece, and I cannot get a final "|." barline to print. The regular single barline is used instead.
Minimal example:
\score {
\new Staff <<
\compressFullBarRests
R1*62
\bar "|."
>>
}
I'm using version 2.16; the problem exists with 2.17 as well.
This doesn't have anything to do with multi-measure rests. It doesn't work because you had used << >> (which indicate simultaneous music) instead of { } (which indicate sequential music). With << >>, all three commands (\compressFullBarRests, R1*62 and \bar "|.") are processed simultaneously, which means that \bar "|." takes place at moment 0 (at the very beginning of music), not after rests. This will work:
\score {
\new Staff {
\compressFullBarRests
R1*62
\bar "|."
}
}
This does not seem to have anything to do with the multi-measure rest - the |. bar is not printed even if you use a note instead of the multi-measure rest.
Not sure why, but this seems to do the job:
melody =
{
R1*62
\bar "|."
}
\score {
<<
\compressFullBarRests
\new Voice = "one" { \autoBeamOff \melody }
>>
}

In these Lilypond diads and triads, why do the final chords contain the wrong notes in the bass?

Why does the last chord in both of the following \score blocks not display the correct note in the bass? In the dyad, the last chord should have D in the bass. In the triad, the last chord should have F in the bass. Instead, both chords are displaying the same as the first chord in their respective \score blocks.
\version "2.14.2"
\book {
\header {
title = \markup \center-column {"Dyad, Triad Permutations"}
arranger = \markup \center-column { "Sean O'Donnell" }
}
\score {
\relative {
<bes d>1
<d bes>
}
}
\score {
\relative {
<bes d f>1
<bes f d>
<d bes f>
<d f bes>
<f bes d>
<f d bes>
}
}
}
You have to specify the octave relative to current notes. You can do so by using the comma (,) (to go lower) and an apostrophe (') (to go higher). So, in the first example, relative to the chord before you need to drop the D down an octave (and then bring the Bb back up). Likewise in the other chord, drop the F and bring the D back up. See the follow code to achieve what you want...
\version "2.14.2"
\book {
\header {
title = \markup \center-column {"Dyad, Triad Permutations"}
arranger = \markup \center-column { "Sean O'Donnell" }
}
\score {
\relative {
<bes d>1
<d, bes'>
}
}
\score {
\relative {
<bes d f>1
<bes f d>
<d bes f>
<d f bes>
<f bes d>
<f, d' bes>
}
}
}
To fully understand how note positioning works in \relative mode, please see the Pitches section of the manual here:
http://lilypond.org/doc/v2.12/Documentation/user/lilypond-learning/Simple-notation#Simple-notation
which states:
The easiest way to enter notes is by using \relative mode. In this
mode, the octave is chosen automatically by assuming the following
note is always to be placed closest to the previous note, i.e., it is
to be placed in the octave which is within three staff spaces of the
previous note.
[...]
By adding (or removing) quotes ' or commas , from the \relative c' {
command, we can change the starting octave
[...]
Relative mode can be confusing initially, but is the easiest way to
enter most melodies.
The manual page also shows code examples of working in \relative mode.