lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble hiding NullVoice


From: Lukas-Fabian Moser
Subject: Re: Trouble hiding NullVoice
Date: Sun, 27 Mar 2022 12:47:24 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0

Hi Samanth,

(Please keep the list in your replies, so future readers can follow the discussion.)

When I put in the \new Staff, it does indeed prevent the nullVoice from producing a staff ... however the chords now appear in the wrong line ... almost as if they are being put above where the NullVoice score would have been.

It's easier to define the "correct" order of contexts once and for all, so I took the liberty of re-organizing your score a bit.

While doing , I noticed something else that I missed before: If you enter the durations of your Lyrics words explicitly, you do not need a (Null)Voice to align the lyrics to. There are two fundamentally different ways of writing Lyrics in LilyPond:

- with explicit lengths (as you did: "When8. I16" etc.)
- without explicit lengths, but aligned to a Voice or NullVoice

So one can reduce to:

% When I'm Sixty Four - Bass Song Sheet
\version "2.22.2"
\language english

\header {
  title = "When I'm Sixty Four"
  subtitle = Bass
  composer = "McCartney/Lennon"
}

% Setup variables for Chords, Notes, Rhythm and Lyrics
introChords = \chordmode {
  c1 c1 f2 g2 |
  c1 c1 c1 |
}

verseChords = \chordmode {
  c1 c1 c1 g1:7 |
}

introNotes = \relative c, {
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  f4 r4 g4 r4 |
  \break
  c4 g4 c4 r4 |
  c4 r4 g4 r8 a16 b16 |
  c4 r4 g4 r4 |
  \bar "||"
  \break
}

verseNotes = \relative c, {
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  g4 r4 d'4\3 r4 |
  \break
}

verseOneLyrics = \lyricmode
{
  \set stanza = "1. "
  When8. I16 get4 old4 -- er4
  losing4 my4 hair2
  Many4 years4 from4 now4 "___"1
}

<<
  \new ChordNames {
    \introChords
    \verseChords
  }
  \new Staff \with {
    \easyHeadsOn
    \clef "bass_8"
  } {
    \introNotes
    \verseNotes
  }
  \new Lyrics {
    #(skip-of-length introNotes)
    \verseOneLyrics
  }
>>

But it's often easier to actually use a (Null)Voice for this, since that way we don't have to clutter the lyrics with durations. The way I'd personally do it would be (as I often need the actual melody as well, I went ahead and entered it with pitches - but these might also be omitted):

% When I'm Sixty Four - Bass Song Sheet
\version "2.22.2"
\language english

\header {
  title = "When I'm Sixty Four"
  subtitle = Bass
  composer = "McCartney/Lennon"
}

% Setup variables for Chords, Notes, Rhythm and Lyrics
introChords = \chordmode {
  c1 c1 f2 g2 |
  c1 c1 c1 |
}

verseChords = \chordmode {
  c1 c1 c1 g1:7 |
}

introNotes = \relative c, {
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  f4 r4 g4 r4 |
  \break
  c4 g4 c4 r4 |
  c4 r4 g4 r8 a16 b16 |
  c4 r4 g4 r4 |
  \bar "||"
  \break
}

verseNotes = \relative c, {
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  c4 r4 g4 r4 |
  g4 r4 d'4\3 r4 |
  \break
}

melody = \relative {
  R1*6
  e'8 ds e8 g4. e4 % If we're not interested in the pitches, we can simply write 8 8 8 4. 4 etc.
  g8 a g c4. r4
  c8 e4. c4 a8 d8~
  d2 r
}

verseOneLyrics = \lyricmode
{
  \set stanza = "1. "
  When I get old -- er
  lo -- sing my hair
  Ma -- ny years from now __
}

<<
  \new ChordNames {
    \introChords
    \verseChords
  }
  \new Staff \with {
    \easyHeadsOn
    \clef "bass_8"
  }
  <<
    {
      \introNotes
      \verseNotes
    }
    \new NullVoice = mel \melody
  >>
  \new Lyrics \lyricsto mel {
    \verseOneLyrics
  }
>>

\new StaffGroup <<
  \new ChordNames {
    \introChords
    \verseChords
  }
  \new Staff \with { \autoBeamOff }
  \new Voice = "mel" \melody
  \new Lyrics \lyricsto mel {
    \verseOneLyrics
  }
  \new Staff \with {
    \easyHeadsOn
    \clef "bass_8"
  }
  {
    \introNotes
    \verseNotes
  }
>>

As you can see, this way one can generate different versions of the score from the same variables, which is one of the main strengths of LilyPond.

For the construct

\new Voice = someName { ... }
\new Lyrics \lyricsTo someName { ... }

there is the shorthand

\new Voice { ... } \addlyrics { ... }

but in my experience this is only really helpful in the simplest of use cases, so I didn't use it here.

Lukas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]