lilypond-user
[Top][All Lists]
Advanced

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

Re: Move chord name down onto staff?


From: Flaming Hakama by Elaine
Subject: Re: Move chord name down onto staff?
Date: Mon, 12 Jul 2021 16:54:03 -0700






---------- Forwarded message ----------
From: Jean Abou Samra <jean@abou-samra.fr>
To: Werner LEMBERG <wl@gnu.org>, lilypond@hillvisions.com
Cc: mark@archsys.net, lilypond-user@gnu.org
Bcc: 
Date: Mon, 12 Jul 2021 15:01:32 +0200 (CEST)
Subject: Re: Move chord name down onto staff?

> Le 11/07/2021 06:33, Werner LEMBERG <wl@gnu.org> a écrit :
>
>
> >> I'm not sure how to move the chord names down so they are centered
> >> on the staff. Essentially I want the changes on an empty stave but
> >> I'm unclear on how to do that. [...]
> > Here's one way to do this:
> >
> > %%%%
> > \version "2.20"
> >
> > harmony = \chordmode { a1:m s1 f1:m7 s1 }
> > tune = { s1 s1 s1 s1 }
> >
> > chordsOnStaff = \with {
> > % Force the baselines to match.
> > \override VerticalAxisGroup.nonstaff-relatedstaff-spacing =
> > #'((basic-distance . 0) (minimum-distance . 0)
> > (padding . -inf.0) (stretchability . 0))
> > % Adjust to one staff space lower.
> > \override ChordName.extra-offset = #'(0 . -1)
> > }
> >
> > \score {
> > <<
> > \new ChordNames \with \chordsOnStaff \harmony
> > \new Staff \tune
> > >>
> > }
> > %%%%
> Aaron, this is such a useful snippet IMHO that it deserves to be added
> to the LSR in case it isn't there (which I can hardly believe since it
> looks like being needed a lot). So please do that :-)
>
>
> Werner


As a matter of style, I'd do it slightly differently:

\version "2.23.4"

\layout {
  \context {
    \Staff
    \accepts ChordNames
    \override ChordName.Y-offset = #self-alignment-interface::y-aligned-on-self
    \override ChordName.self-alignment-Y = #CENTER
  }
}

harmony =  \chordmode { a1:m s1 f1:m7 s1 }
tune = { s1 s1 s1 s1 }


\new Staff <<
  \tune
  \new ChordNames \harmony
>>

Regards,
Jean




I'd like to understand if I can use this layout-based approach on a per-score basis.

This example, based on the previous approach, has in-staff chords for the first  score, but normal, above-the-staff chords for the second score.


How would one go about using the layout approach to do that?


Thanks, 


\version "2.19.81"

melodyHead = \relative c'' { c1 d e f }
melodyFours = \relative c'' { g8 a r g r a r4 | b8 8 r4 r2 | g8 a r g r a r4 | bes8 8 r4 r2 }
headChords = \chordmode {
    c1:maj7 | b2:m7.5- e:7 | a:m7 d:7 | g:m7 c:7 |
}
foursChords = \chordmode {
    c1:maj7 | b2:m7.5- e:7 | a:m7 d:7 | g:m7 c:7 |
}

chordsOnStaff = \with {
   \override VerticalAxisGroup.nonstaff-relatedstaff-spacing =
   #'((basic-distance . 0)
      (minimum-distance . 0)
      (padding . -inf.0)
      (stretchability . 0))
   \override ChordName.extra-offset = #'(0 . -1)
}

\book {
    \score {
        \new StaffGroup <<
            \new Staff \melodyHead
            \new ChordNames \with \chordsOnStaff { \headChords }
            \new Staff s1*4
        >>
    }
    \score {
        <<
            \new ChordNames  { \foursChords }
            \new Staff \melodyFours
        >>
    }
}


Elaine Alt
415 . 341 .4954                                           "Confusion is highly underrated"
elaine@flaminghakama.com
Producer ~ Composer ~ Instrumentalist ~ Educator
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


reply via email to

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