Thank you.
This works perfectly. I had a feeling it would be a rather involved
solution that I would never have been able to figure out myself. I had
to tweak a fermata that got moved, but a single tweak certainly beats
tweaking each pedal mark!
I suppose it's one of those time when insisting on something that goes
against LilyPond's standards and "best practice" becomes rather
complicated. I'm sure I'm not the first to discover that leaning back
and just accepting what is produced (unless it's plain erroneous
obviously) is by far the easiest.
I have attached the score in case anyone would like to see a chorale
from the Danish hymnal with pedal marks for a struggling organ student.
Best wishes,
Jakob
On 22.04.2023 00.21, Jean Abou Samra wrote:
Le vendredi 21 avril 2023 à 20:27 +0200, Jakob Pedersen a écrit :
Greetings!
First time poster, long time (basic) lilypond user.
I'm writing a hymn/chorale setting for organ. It's a basic piano
staff with two voice for each staff, and lyrics above system aligned
with the soprano line.
I've added pedal marks, which looks something like this:
I think that's a little clumsy looking. I would prefer the pedal
marks to be aligned, like this:
(I aligned these by editing the PDF in Inkscape, which is entirely
unsatisfactory of course!)
I've tried aligning them with tweaks, but that a bit fiddly and not
particularly accurate.
Is there a more elegant solution to aligning the pedal marks?
Perhaps try a callback like this:
|\version "2.24.1" \language "deutsch" \score { \new PianoStaff <<
\new Staff = "venstre" << \clef bass \new Voice = "tenor" { \voiceOne
<< \relative c' { \key d \major \time 4/4 a h e, a } >> } \new Voice =
"bas" { \voiceTwo << \relative c { \key d \major \time 4/4 \override
Script.Y-offset = #(lambda (grob) (+ -6.0
(ly:self-alignment-interface::y-aligned-on-self grob))) \override
Script.self-alignment-Y = #CENTER d\rtoe h\lheel a\ltoe a } >> } >> >> } |
Y-offset sets the absolute position relative to the staff, and the
self-alignment-interface correction is to align the centers of the
scripts together (otherwise it aligns their reference points).
You will need to adjust the 6.0 value to your liking.
Best,
Jean
\version "2.24.1"
\language "deutsch"
\header {
title = "442. Op, min sjæl, thi sol er oppe"
composer = \markup { \vspace #1.3 Freylinghausen 1704 }
tagline = ##f
}
\paper {
#(set-paper-size "a4landscape")
top-margin = 1.5\cm
left-margin = 1\cm
right-margin = 1\cm
system-system-spacing.basic-distance = #18
markup-system-spacing.basic-distance = #20
markup-markup-spacing.basic-distance = #12
}
\layout {
\context {
\Voice
\consists "Melody_engraver"
\override Stem.neutral-direction = #'()
}
}
global = {
\key d \major
\time 4/4
}
tekst = \lyricmode {
\override LyricText.font-size = #-0.5 Op, min sjæl, thi sol er op -- "pe, /" strå -- ler -- ne på hu -- set
"ler! /"
}
linjeto = \lyricmode {
\override LyricText.font-size = #-0.5 Tænk, at du på Zi -- ons top -- "pe /" Her -- rens nå -- de -- strå -- ler
"ser, /" som dit hjer -- te skal op -- ly -- "se, /" kla -- re op for -- nuf -- tens "mørk, /" al -- le
sor -- te trol -- de ky -- "se /" til den fæ -- le Hel -- veds -- ørk!
}
rightOne = \relative c' {
\global
% Music follows here.
\repeat volta 2 { d4 e fis e | fis g a a | d d cis cis | h h a2 } d4 a h h | a4. g8 fis4 d |
fis g a a | g fis e2 | a4 a g4. fis8 | g4 a fis d | e fis g fis | e e d2\fermata \bar "|."
}
rightTwo = \relative c' {
\global
% Music follows here.
a4 a d cis | d d~ d cis | d fis e e | e e cis2 | d4 d d e | e cis a a | d d cis d | d d cis2 |
e4 d h d | d cis a a | c c d d~ | d cis a2
}
leftOne = \relative c {
\global
% Music follows here.
fis4 a a a | a h e, a | fis h h a~ | a gis e2 | a4 fis g g | e e d fis | a d, e a | h a a2 |
e4 fis g a | h e, d fis | g a h a | a a fis2
}
leftTwo = \relative c {
\global \voiceTwo
\override Script.Y-offset =
#(lambda (grob)
(+ -6.5 (ly:self-alignment-interface::y-aligned-on-self grob)))
\override Script.self-alignment-Y = #CENTER
d4 cis d a | d\rtoe h\lheel a\ltoe a | h\ltoe h cis4.\rtoe d8\ltoe | e4\rtoe e a,2 | fis'4 d g\rtoe e\ltoe |
cis\rtoe a\ltoe d d | d\rtoe h\ltoe a\rtoe fis\ltoe | g\lheel d' a2 | cis4\ltoe d\lheel e\rtoe d\rheel |
h\lheel a\ltoe d d | c\rtoe a\lheel g\ltoe d' | a a\rtoe d,2 \tweak Y-offset #-7.3 \fermata
}
\score {
\new PianoStaff <<
\new Lyrics = "melodi" \with {
\override VerticalAxisGroup.staff-affinity = #DOWN
}
\new Lyrics = "melodi2" \with {
\override VerticalAxisGroup.staff-affinity = #DOWN
}
\new Staff = "højre" <<
\new Voice = "sopran" {
\voiceOne
<< \rightOne >>
}
\new Voice = "alt" {
\voiceTwo
<< \rightTwo >>
}
>>
\new Staff = "venstre" <<
\clef bass
\new Voice = "tenor" {
\voiceOne
<< \leftOne >>
}
\new Voice = "basses" {
\voiceTwo << \leftTwo >>
}
>>
\context Lyrics = "melodi" \lyricsto "sopran" \tekst
\context Lyrics = "melodi2" \lyricsto "sopran" \linjeto
>>
\layout { indent = 0.0
\context {
\Score \remove "Bar_number_engraver"
}
#(layout-set-staff-size 22)
}
\midi {
\tempo 4=90
}
}