Horizontal spacing of notes with multiple staves
I created this minimal example :
version "2.21.0"
include "italiano.ly"
soprano_notes = relative do' {
fad fad16 sold8 la16 re4 re16 re8 re16
re4 re16 dod8 si16 dod2
}
alto_notes = relative do' {
re2 re mi2. mi4
}
tenor_notes = relative do {
clef "G_8"
la2 fad sol2. ( fad4 ~ fad2)
}
bass_notes = relative do {
clef bass
re4 dod si lad
si2 lad
}
score {
new ChoirStaff <<
new Staff
<<
new Voice = "soprano" {
soprano_notes
}
>>
new Staff
<<
new Voice = "alto" {
alto_notes
}
>>
new Staff
<<
new Voice = "bass" {
bass_notes
}
>>
>>
}
And here is the result I have :
As you can see in the third stave, the 4 notes have the same duration but the spacing is incorrect (and the same kind of problem appears in the second measure). I want to have all the notes with the same duration to take the same horizontal space, is that possible?
1 Comments
Sorted by latest first Latest Oldest Best
LilyPond calls this "proportional duration," and you can find it in the manual here.
Within your score block, you'll want to add a layout block:
layout {
context {
Score
proportionalNotationDuration = #(ly:make-moment 1/20)
}
}
You can adjust the ly:make-moment 1/20 to be 1/16, 1/8, etc. That number tells LilyPond "use this fraction of a whole note as the unit of spacing." It can be any fraction, so experiment to see what works best for you.
The entire code would thus be:
version "2.21.0"
include "italiano.ly"
soprano_notes = relative do' {
fad fad16 sold8 la16 re4 re16 re8 re16
re4 re16 dod8 si16 dod2
}
alto_notes = relative do' {
re2 re mi2. mi4
}
tenor_notes = relative do {
clef "G_8"
la2 fad sol2. ( fad4 ~ fad2)
}
bass_notes = relative do {
clef bass
re4 dod si lad
si2 lad
}
score {
new ChoirStaff <<
new Staff
<<
new Voice = "soprano" {
soprano_notes
}
>>
new Staff
<<
new Voice = "alto" {
alto_notes
}
>>
new Staff
<<
new Voice = "bass" {
bass_notes
}
>>
>>
layout {
context {
Score
proportionalNotationDuration = #(ly:make-moment 1/20)
}
}
}
Which creates:
Terms of Use Privacy policy Contact About Cancellation policy © freshhoot.com2025 All Rights reserved.