I apologize because I explained myself badly. I use the glissando to
indicate the sliding of the same finger of the left hand on the same
string of the guitar. The blue lines I drew with Gwenview. The score
posted as an example is a transcription of a "passemezzo" by VIncenzo
Galilei for Renaissance lute. I transcribed on two staves for greater
clarity of what I think is the polyphony of the piece. I am attaching
the two files as an example. The "gui.ly" file is a general
configuration file for my scores. Thank you!
Il 25/04/23 12:57, Andrew Bernard ha scritto:
My thoughts exactly, for musical reasons. The lower is not a gliss in
my opinion, but a voice follower. And I agree with Jean regarding the
top one also. I think that's also an indicator of voice leading. But
musicians can follow this sort of score without help. I'd leave them
out. Ant way, just see the NR re voice follower if you want.
Andrew
\version "2.24.0"
\language "english"
\include "gui.ly"
#(set-global-staff-size 20)
% \pointAndClickOff
dita = {
\override StringNumber.add-stem-support = ##t
\override StrokeFinger.avoid-slur = #'outside
\override StrokeFinger.add-stem-support = ##t
\override StrokeFinger.font-size = #0
\override StrokeFinger.text = #calc-custom-stroke-text
\override StringNumber.staff-padding = #'1.5
\override Staff.OttavaBracket.dash-period = #0.2
\override StringNumber.bound-details.down.padding = #2
\override Accidental.extra-offset = #'(0.22 . 0)
\override Fingering.extra-offset = #'(0.25 . 0)
\override Glissando.extra-offset = #'(0.25 . 0)
\override Glissando.bound-details.right.padding = #2
\override Glissando.minimum-length = #4
\override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
\override Glissando.thickness = #2
\override Score.Arpeggio.X-offset = #'-2.7
\override NoteColumn.ignore-collision = ##f
}
tempoMark = {
\once \override Score.RehearsalMark.self-alignment-X = #LEFT
\once \override Score.RehearsalMark.break-align-symbols = #'(time-signature key-signature)
\once \override Staff.TimeSignature.break-align-anchor-alignment = #LEFT
% \mark \markup \bold {\override #'(font-name . "Times")
% "Andantino"
% }
}
global = {
\tempoMark
\key e \minor
\time 4/4
\override Score.BarNumber.break-visibility = #'#(#f #f #t)
\override Score.BarNumber.stencil = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print)
\override Score.BarNumber.self-alignment-X = #LEFT
% \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4)
}
scoreAUpperClassicalGuitarI = \relative c {
\global \snl \tieNeutral
% Qui segue la musica.
<e g b e>4 e, e'' fs|
<e, b' g'> fs'8 e <ds, b' fs'>4 a'|
<e g b e>4 e, <g' b e> fs,|
<g g' b e> a <b g' b> cs|
<d\5 fs a d> a'' fs,8 g' fs e|
<d, a' fs'>4 d' <a e'>8 cs d16 cs b cs|
<d, a' d fs>4 a' d,8 g fs e|
<d fs>4 <b d g> <cs e> <ds fs>|
<e g b> <e, e''> <ds' b' fs'> a'|
<e b' g'> b'' <ds,, b' fs'> <fs a'>|
<e b' g'> <g b> <d a'> <b' fs'>|
<e, g c> b'8 d, <c e'> a'16 g a4|
<b, fs' ds'> fs'' g <b, fs'>|
<fs c'>8 e' <b ds> cs <b, fs' ds'>4 <cs e'>|
<ds b' fs'> fs g <b, fs'>|
<c e e'>8 fs g e <b e b' fs'>4 ds|
<e, e' b' g'> e'' g <ds, b' fs'>|
<e g b fs'> <a e'> <b, g' b e>8 fs'16 e <fs ds'>4|
<e g b e> <e, b''> <g b'> <fs a'>|
<e g' b e> <a cs'>8 b'16 cs <b, fs' d'>4 <cs a' e'>|
<d a' fs'> <fs d' a'> <e d' g> cs'|
<d, a' fs'> d' <a e'>8 cs16 d <a, cs'>4|
<d fs d'> e <d a' fs'> <cs g' e'>|
<b fs' d'> <a cs'> <g d' g b> <fs a'>|
<e e' b' g'>8 fs' g fs e d <cs e'> b|
<a e' a cs>4 ds' <a e'>8 g e fs'|
<b,, fs' ds'> cs' ds e <g,, g' fs'>4 <b' g'>|
<a, fs' c' fs>8 g'' e fs <b,, fs' ds'> a' fs a|
<e, b' a' e'>4 gs' fs8 <e> <cs a'>4|
<e, b' a' e'> ds'' <ds, b'>8 a' gs fs|
<e gs b>4 e' <e,, gs''> a'|
b <a fs'> <g b> fs|
\bar "||"
<e g b> e' <b g'> <ds, b' fs'>|
<e g b fs'> <a e'> <b, g' b e>8 fs'16 e <fs ds'>4|
<e g b e> <e, g''> <g' e'> <a fs'>|
<e b' g'> <g, g' b> <b d'> <cs g' e'>|
<d a' d fs>8 cs' d e fs g a g|
<d, a' d fs> e fs g a b a g|
<d fs>4 d' fs g|
<d, fs a'> <d' fs> <cs a'> <d fs>|
<e, b' g'> <e, c''> <g b'> <fs a'>|
<e g' b e> <e' b'> fs <ds fs b>|
<e g b> <e, g''> <b' e b' fs'> ds|
<e, e' b' g'>8 fs'' e ds <cs, e'> cs' ds e|
<b, ds b' fs'>4 fs' g e|
<ds fs b> fs' <e, g b> e'|
<b, fs' ds'> fs''8 e16 fs <b, g'>4 <g e'>|
<b, ds fs fs'>8 e ds cs <b fs' ds'> a <g e''> <fs fs''>|
<e e' b' g'>4 a' <g b> <fs a fs'>|
<e g b> <e, e''> <b' e b' fs'> ds|
<e b' g'> <fs a> <e, g' b> <fs a' fs'>|
<g g' b e> <a cs'>8 ds'16 cs <b, fs' d'>4 <cs g' e'>|
<d fs a fs'> d' <a c e> <cs a'>|
<d, a' fs'> d' e\2 <cs, a'>|
<d fs> fs' d <cs, e>|
<b fs' d'> cs' <b fs'> a,|
<g d' b' g'> fs'' <g, b e> d'|
<a, e' a cs> fs'' <b,, g' b> e'|
<fs, ds'> e <ds b' fs'> <b g''>|
<c e>8~ <c e fs'> <g' e'> a <b, b'\3 e\2 fs>4~ <b b' ds fs>|
<e gs b e> cs' e,,8 b'' a gs16 fs|
<e gs b e>8 ds e fs gs a b cs|
<gs b e>4 <fs a> <gs b> <a cs>|
<e gs b e> a g fs|
\bar "||"
<e g b> g' e <a, fs'>|
<e, b'' g'>8 cs'' b a g fs e fs|
<g b>4 g' <c, e> <a fs'>|
<e b' g'>8 fs g a <b g'> cs d e|
<d, d' fs>4 a' d, <fs d'>|
b, <cs e a a'> <d fs d'> fs'|
<b, g'> <cs a'> d8 g fs <cs e>|
<b d> cs d e fs a, g fs|
<e g b e>4 g' <ds, b' fs'> a'|
<e g b> e' <b, fs'>8 e <fs ds'>4|
<e b' e> g fs <ds b' fs'>|
<e g b> <e, g''> <g fs''> <a e''>|
<b fs' ds'> fs'' <b, g'> fs'|
<c, e e'> a'8 g <a e'>4 fs'|
<b,, ds b' g'> fs''8 e <b ds>4 e|
fs8 a, <g b e>4 <fs a e'> ds'8 cs16 ds|
<e, g b e>4 g' <d, a'> <b' fs'>|
<e, g b> <e, e''> <ds' b' fs'>8 a' fs4|
<e g b> <g, b'> <a' fs'> <fs, ds'>|
<e e' b' g'> <g' cs> <b, fs' d'> <cs e'\2>|
<d a' fs'> d' <a e'> <a, cs'>|
<d fs a> d' <e, e'\2> cs|
<d fs>~ <d fs d'> <a e'>~ <a e' cs'>|
<b d fs>~ <b d fs b> <fs cs' fs\4>~ <fs cs' fs as>|
<g g' b> e' fs <ds b' fs'>|
<e g b> <e, g''> <g e''> <a cs'>|
<b fs' ds'>8 cs' ds e <b fs'> g <a e'>4|
<b ds>8 a <g\4 b\3 e>4 <fs a e'>8 cs' <a ds>4|
<e gs b e> cs' <e,, b''>8 a' gs fs|
<e gs b>4 ds e fs|
<e, gs' b e> <a' fs'> <b gs'> <fs a'>|
<e, e' b' gs'>8 ds' e fs gs a b cs|
\bar "||"
<e, gs b>4 <a e'> <b g'> <a fs'>|
<g b e> <e g'> <ds b' fs'>8 a' fs4|
<e g b> <e, e''> <g b'> <fs a'>|
<e b'' g'> e' <b d g>8 fs' <cs e>4|
<d fs a fs'> d' fs <e, b' g'>|
<fs a a'> <d' b'> <e, b' g'> cs'|
<d, a' d fs> fs a b\3|
<d, fs a> fs' a <g,\4 b'>|
<e b' g'> c' b <fs a>|
<g b> <e g'> <ds b' fs'> a'|
<e g b>~ <e g b e> <fs a e'>~ <fs b ds e>|
<e c' e> b'8 d, <c e'> a'16 g a4|
<b, fs' ds'> fs''8 e16 fs <b, g'>4 fs'|
<fs,>8~ <fs e'> ds' cs <b ds>4 e|
<b,> <fs'\4 fs'>8 e16 fs\4 <g b>4 fs|
b,8 e <ds b'> cs <b e b' fs'>4 ds|
<e, e' b' g'> e'' g <a, c>|
<e, b''> <a' fs'> <g e'> <fs ds'>|
<e g b> <c' e> <b g'> <fs\4 a'>|
<g\4 d' b'> g, <b d g> <cs e>|
<d fs a> a'' <b, g'> <cs e>|
<d fs> d, <a' e'> <cs, e>|
<d fs a> b' <a fs'> <e g>|
<d fs a> <b d g> <cs e e'> <ds fs>|
<e g b> <e, b' g' e'> <g e' b'> <a cs'>|
<b fs' ds'> <b' fs'> g8 fs' <a, e'>4|
<b ds> b, <cs a' e'>8 ds <e b' g'>4|
<ds fs'>8 a' <e g b e>4 <b fs'>8 e <fs ds'>4|
<e, gs' b e>1|
\bar "|."
}
scoreALowerClassicalGuitarI = \relative c' {
}
scoreAUpperClassicalGuitarII = \relative c' {
\global \dita \sfou \fol \snd \gt
\override Tie.minimum-length = #5
% Qui segue la musica.
% \override NoteColumn.force-hshift = #0
<fs-3>2 <ds-3-\dmn-\dan>4 <e-0-\di>8 <fs-1-\dm>--^II|
<g-42>2.^\markup {\box"13"} <fs-2-\dmn-\dan>4|
\bar "|."
}
scoreALowerClassicalGuitarII = \relative c' {
\global \dita \fol \sfod \snd \gt
\override Tie.minimum-length = #5
% Qui segue la musica.
<fs,-0>2 fs|
<b-0>4 <a-3-\din> <b-0-\dmn> <a-3>\gl|
}
scoreAUpperClassicalGuitarIII = \relative c {
\global \dita \fol \sfou \snd \gt
% Qui segue la musica.
<ds-1>8\gl <e-1-\dmn>\gl <ds-1-\din> \sfod <cs-4-\dpn> s2|
<e-2>2 <g-1>4 <fs-4>\gl|
}
scoreALowerClassicalGuitarIII = \relative c {
\global \dita \snd \sfod \fol \gt
\override Tie.minimum-length = #5
% Qui segue la musica.
% \override NoteColumn.force-hshift = #0
\sfod <b-2>2 <b-1-\dpn>8 <a-0> <g-2> <fs-1>|
e1~|
}
scoreAClassicalGuitarIPart = \new Staff \with {
midiInstrument = "acoustic guitar (nylon)"
% instrumentName = "Chitarra classica I"
} { \clef "treble_8" << \scoreAUpperClassicalGuitarI \\ \scoreALowerClassicalGuitarI >> }
scoreAClassicalGuitarIIPart = \new Staff \with {
midiInstrument = "acoustic guitar (nylon)"
% instrumentName = "Chitarra classica II"
} { \clef "treble_8" << \scoreAUpperClassicalGuitarII \\ \scoreALowerClassicalGuitarII >> }
scoreAClassicalGuitarIIIPart = \new Staff \with {
midiInstrument = "acoustic guitar (nylon)"
% instrumentName = "Chitarra classica III"
} { \clef "treble_8" << \scoreAUpperClassicalGuitarIII \\ \scoreALowerClassicalGuitarIII >> }
\score {
<<
% \scoreAClassicalGuitarIPart
\context GrandStaff <<
\scoreAClassicalGuitarIIPart
\scoreAClassicalGuitarIIIPart
>>
>>
\layout { }
\header {
title = \markup \column {\override #'(font-name . "URW Chancery L italic ")"PASSEMEZZO PRIMO" " "}
composer = \markup \column \right-align \override #'(font-name . "URW Chancery L italic ") {"VINCENZIO GALILEI" "(Santa Maria a Monte, 1520 circa" "Firenze, 2 luglio 1591)" " "}
% Elimina la tagline predefinita di LilyPond
tagline = ##f
% poet = \markup \column {"Diteggiatura di Mario Moles" " "}
}
\midi {
\tempo 2=60
}
}
\version "2.24.0"
gls = \once \override NoteColumn.glissando-skip = ##t
\paper {
% max-systems-per-page = 7
% min-systems-per-page = 7
print-page-number = ##t
% myStaffSize = #16
% #(define fonts
% (make-pango-font-tree "URW Palladio L"
% "URW Palladio L"
% "URW Palladio L"
% (/ myStaffSize 16)))
between-system-spacing = #'((basic-distance . 12) (minimum-distance . 8) (padding . 1))
ragged-bottom=##f
ragged-last = ##f
ragged-last-bottom=##f
% bottom-margin = 1\cm
left-margin = 1.75\cm
inner-margin = 0\cm
right-margin = 1.25\cm
print-all-headers = ##t
}
cred = {
\override Stem.color = #red
\override NoteHead.color = #red
}
cgreen = {
\override Stem.color = #green
\override NoteHead.color = #green
}
cblack = {
\override Stem.color = #black
\override NoteHead.color = #black
\override Beam.color = #black
}
cblue = {
\override Stem.color = #blue
\override NoteHead.color = #blue
}
#(define-markup-list-command (paragraph layout props args) (markup-list?)
(interpret-markup-list layout props
(make-justified-lines-markup-list (cons (make-hspace-markup 0) args))))
sn=\stemNeutral
su=\stemUp
sd=\stemDown
tn=\tieNeutral
chordGlissando =
#(define-music-function (parser location mus1 mus2) (ly:music? ly:music?)
"Make a glissando between the notes of triads @code{mus1} and @code{mus2}."
(define (add-glissando musChord)
(let ((els (ly:music-property musChord 'elements)))
(ly:music-set-property! musChord 'elements (append els (list (make-music 'GlissandoEvent))))
musChord))
(define (get-notes musicChord)
(filter (lambda(x) (eq? (ly:music-property x 'name) 'NoteEvent))
(ly:music-property musicChord 'elements)))
(define (select-note musChord index)
(let* ((notes (get-notes musChord))
(non-notes (filter (lambda (x)
(not (eq? (ly:music-property x 'name)
'NoteEvent)))
(ly:music-property musChord 'elements)))
(selected-note (list-ref notes index))
(new-els (cons selected-note non-notes))
(new-mus (ly:music-deep-copy musChord)))
(ly:music-set-property! new-mus 'elements new-els)
new-mus))
(define (add-glissando-line mus1 mus2 index)
(context-spec-music
(context-spec-music
(make-sequential-music
(list
hideNotes
(make-grob-property-set 'StringNumber 'transparent #t)
(make-grob-property-set 'NoteColumn 'ignore-collision #t)
;; obviously, this isn't equivalent to \once,
;; so could be changed if required
(make-grob-property-set 'Glissando 'thickness 2)
(add-glissando (select-note mus1 index))
(select-note mus2 index)))
'Bottom (symbol->string (gensym)))
'Staff))
(let* ((notes1 (get-notes mus1))
(notes2 (get-notes mus2))
(note-count (min (length notes1) (length notes2))))
#{
\once \override Glissando.minimum-length = #5
\once \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods
\once \override Glissando.thickness = #2
<<
\override NoteColumn.ignore-collision = ##t
{
$(add-glissando mus1)
$mus2
}
$(make-simultaneous-music
(map (lambda (x)
(add-glissando-line mus1 mus2 x))
(iota note-count)))
>>
\revert NoteColumn.ignore-collision
#}))
#(define (script x)
(make-music
'TextScriptEvent
'direction #'DOWN
'text (markup #:vcenter #:circle #:finger x))
)
#(define (add-script m x)
(if (equal? (ly:music-property m 'name) 'EventChord)
(set! (ly:music-property m 'elements)
(cons (script x)
(ly:music-property m 'elements)))
(let ((es (ly:music-property m 'elements))
(e (ly:music-property m 'element)))
(map (lambda (y) (add-script y x)) es)
(if (ly:music? e)
(add-script e x))))
m)
string = #(define-music-function (parser location stringnum dirn shorten
adjBreak adjEnd)
(string? number? pair? number? number?)
#{
\once \override TextSpanner.bound-details.left.text = \markup
\bold { \teeny \concat { \circle { \finger $stringnum } } }
\once \override TextSpanner.font-shape = #'upright
\once \override TextSpanner.direction = #dirn
\once \override TextSpanner.dash-period = #0.8
\once \override TextSpanner.dash-fraction = #1.6
\once \override TextSpanner.thickness = #0.8
\once \override TextSpanner.bound-details.right.text = \markup { \draw-line #(cons 0 (/ dirn -2)) }
\once \override TextSpanner.bound-details.left.stencil-align-dir-y = #CENTER
\once \override TextSpanner.bound-details.left.padding =
#(car shorten)
\once \override TextSpanner.bound-details.right.padding =
#(cdr shorten)
\once \override TextSpanner.bound-details.right-broken.padding = #adjEnd
\once \override TextSpanner.bound-details.left-broken.X =
#adjBreak
\once \override TextSpanner.bound-details.left-broken.text = ##f
\once \override TextSpanner.bound-details.right-broken.text = ##t
#})
cofon ={\cadenzaOff \bar "|"\cadenzaOn}
cofn ={\cadenzaOff \bar "|"\cadenzaOn}
snu = { \set stringNumberOrientations = #'(up) }
snd = { \set stringNumberOrientations = #'(down) }
snl = { \set stringNumberOrientations = #'(left) }
snr = { \set stringNumberOrientations = #'(right)}
fou = { \set fingeringOrientations = #'(up) }
fod = { \set fingeringOrientations = #'(down) }
fol = { \set fingeringOrientations = #'(left) }
for = { \set fingeringOrientations = #'(right) }
sfou = { \set strokeFingerOrientations = #'(up) }
sfod = { \set strokeFingerOrientations = #'(down) }
sfol = { \set strokeFingerOrientations = #'(left) }
sfor = { \set strokeFingerOrientations = #'(right) }
gt = \override Glissando.breakable = ##T
gl = \glissando
gT = \override Glissando.thickness = #2
ignore = \override NoteColumn.ignore-collision = ##t
nignore = \override NoteColumn.ignore-collision = ##f
manualBeam =
#(define-music-function (parser location beg-end)
(pair?)
#{
\once \override Beam.positions = #beg-end
#})
#(set-global-staff-size 20)
#(define (calc-custom-stroke-text grob)
(let ((text (ly:event-property (event-cause grob) 'text)))
(if (string? text)
(markup #:center-column (#:lower 2.5 "^" text))
(stroke-finger::calc-text grob))))
#(define (make-stroke-finger location finger)
(apply make-music
(append
(list
'StrokeFingerEvent
'origin location)
(if (string? finger)
(list 'text finger)
(list 'digit finger)))))
da = #(define-music-function (parser location) ()
(make-stroke-finger location "a"))
dm = #(define-music-function (parser location) ()
(make-stroke-finger location "m"))
di = #(define-music-function (parser location) ()
(make-stroke-finger location "i"))
dp = #(define-music-function (parser location) ()
(make-stroke-finger location "p"))
dan = #(define-music-function (parser location) ()
(make-stroke-finger location 4))
dmn = #(define-music-function (parser location) ()
(make-stroke-finger location 3))
din = #(define-music-function (parser location) ()
(make-stroke-finger location 2))
dpn = #(define-music-function (parser location) ()
(make-stroke-finger location 1))
#(set-global-staff-size 18)
barre = #(define-music-function (parser location padding text) (number?
string?)
#{
\once \override TextSpanner.font-size = #-2
\once \override TextSpanner.padding = #padding
\once \override TextSpanner.bound-details.left.text = #text
\once \override TextSpanner.bound-details.left.padding = #-0.5
\once \override TextSpanner.bound-details.left-broken.text = \markup
{ \null }
\once \override TextSpanner.bound-details.left-broken.padding = #0
\once \override TextSpanner.font-shape = #'upright
\once \override TextSpanner.style = #'line
%\once \override TextSpanner.style = #'dashed-line
%\once \override TextSpanner.dash-period = #0.8
%\once \override TextSpanner.dash-fraction = #0.2
\once \override TextSpanner.bound-details.left.stencil-align-dir-y =
#CENTER
\once \override TextSpanner.bound-details.right.text = \markup {
\draw-line #'(0 . -0.4)
}
\once \override TextSpanner.bound-details.right.padding = #-1.0
\once \override TextSpanner.bound-details.right-broken.text = \markup
{ \null }
\once \override TextSpanner.bound-details.right-broken.padding = #0
#})
startBarre = \startTextSpan
stopBarre = \stopTextSpan
csr = \change Staff = "right"
csl = \change Staff = "left"
sa = \startTextSpan
so = \stopTextSpan
br = \break
sld = \slurDown
slu = \slurUp
stu = {\string "1" #DOWN #'(0.25 . -0.75) #7 #0.5 }
std = {\string "2" #DOWN #'(0.25 . -0.75) #7 #0.5 }
stt = {\string "3" #DOWN #'(0.25 . -0.75) #7 #0.5 }
stq = {\string "4" #DOWN #'(0.25 . -0.75) #7 #0.5 }
stc = {\string "5" #DOWN #'(0.25 . -0.75) #7 #0.5 }
sts = {\string "6" #DOWN #'(0.25 . -0.75) #7 #0.5 }
stuu = {\string "1" #UP #'(0.25 . -0.75) #7 #0.5 }
stdu = {\string "2" #UP #'(0.25 . -0.75) #7 #0.5 }
sttu = {\string "3" #UP #'(0.25 . -0.75) #7 #0.5 }
stqu = {\string "4" #UP #'(0.25 . -0.75) #7 #0.5 }
stcu = {\string "5" #UP #'(0.25 . -0.75) #7 #0.5 }
stsu = {\string "6" #UP #'(0.25 . -0.75) #7 #0.5 }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%merge-rest%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%{
Based on http://lsr.dsi.unimi.it/LSR/Snippet?id=336
Merges rests and multi-measure rests that occur on the same moment inside a
staff with two voices.
Usage:
\include "merge-rests"
\layout {
\mergeRests
}
or inside the music:
\new Staff <<
\relative c' {
\mergeRestsOn %% in one of the voices is sufficient
c4 d e f g r r2
}
\\
\relative c' {
a4 b c d e r r2
}
>>
%}
#(define (rest-score r)
(let ((score 0)
(yoff (ly:grob-property-data r 'Y-offset))
(sp (ly:grob-property-data r 'staff-position)))
(if (number? yoff)
(set! score (+ score 2))
(if (eq? yoff 'calculation-in-progress)
(set! score (- score 3))))
(and (number? sp)
(<= 0 2 sp)
(set! score (+ score 2))
(set! score (- score (abs (- 1 sp)))))
score))
#(define (merge-rests-on-positioning grob)
(let* ((can-merge #f)
(elts (ly:grob-object grob 'elements))
(num-elts (and (ly:grob-array? elts)
(ly:grob-array-length elts)))
(two-voice? (= num-elts 2)))
(if two-voice?
(let* ((v1-grob (ly:grob-array-ref elts 0))
(v2-grob (ly:grob-array-ref elts 1))
(v1-rest (ly:grob-object v1-grob 'rest))
(v2-rest (ly:grob-object v2-grob 'rest)))
(and
(ly:grob? v1-rest)
(ly:grob? v2-rest)
(let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
(v2-duration-log (ly:grob-property v2-rest 'duration-log))
(v1-dot (ly:grob-object v1-rest 'dot))
(v2-dot (ly:grob-object v2-rest 'dot))
(v1-dot-count (and (ly:grob? v1-dot)
(ly:grob-property v1-dot 'dot-count -1)))
(v2-dot-count (and (ly:grob? v2-dot)
(ly:grob-property v2-dot 'dot-count -1))))
(set! can-merge
(and
(number? v1-duration-log)
(number? v2-duration-log)
(= v1-duration-log v2-duration-log)
(eq? v1-dot-count v2-dot-count)))
(if can-merge
;; keep the rest that looks best:
(let* ((keep-v1? (>= (rest-score v1-rest)
(rest-score v2-rest)))
(rest-to-keep (if keep-v1? v1-rest v2-rest))
(dot-to-kill (if keep-v1? v2-dot v1-dot)))
;; uncomment if you're curious of which rest was chosen:
;;(ly:grob-set-property! v1-rest 'color green)
;;(ly:grob-set-property! v2-rest 'color blue)
(ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
(if (ly:grob? dot-to-kill)
(ly:grob-suicide! dot-to-kill))
(ly:grob-set-property! rest-to-keep 'direction 0)
(ly:rest::y-offset-callback rest-to-keep)))))))
(if can-merge
#t
(ly:rest-collision::calc-positioning-done grob))))
#(define merge-multi-measure-rests-on-Y-offset
;; Call this to get the 'Y-offset of a MultiMeasureRest.
;; It keeps track of other MultiMeasureRests in the same NonMusicalPaperColumn
;; and StaffSymbol. If two are found, delete one and return 0 for Y-offset of
;; the other one.
(let ((table (make-weak-key-hash-table)))
(lambda (grob)
(let* ((ssymb (ly:grob-object grob 'staff-symbol))
(nmcol (ly:grob-parent grob X))
(ssymb-hash (or (hash-ref table ssymb)
(hash-set! table ssymb (make-hash-table))))
(othergrob (hash-ref ssymb-hash nmcol)))
(if (ly:grob? othergrob)
(begin
;; Found the other grob in this staff/column,
;; delete it and move ours.
(ly:grob-suicide! othergrob)
(hash-remove! ssymb-hash nmcol)
0)
(begin
;; Just save this grob and return the default value.
(hash-set! ssymb-hash nmcol grob)
(ly:staff-symbol-referencer::callback grob)))))))
mergeRestsOn = {
\override Staff.RestCollision.positioning-done = #merge-rests-on-positioning
\override Staff.MultiMeasureRest.Y-offset = #merge-multi-measure-rests-on-Y-offset
}
mergeRestsOff = {
\revert Staff.RestCollision.positioning-done
\revert Staff.MultiMeasureRest.Y-offset
}
mergeRests = \with {
\override RestCollision.positioning-done = #merge-rests-on-positioning
\override MultiMeasureRest.Y-offset = #merge-multi-measure-rests-on-Y-offset
}
%{
convert-ly (GNU LilyPond) 2.15.21 convert-ly: Processing `'...
Applying conversion: 2.15.7, 2.15.9, 2.15.10, 2.15.16, 2.15.17,
2.15.18, 2.15.19, 2.15.20
%}
%{
convert-ly (GNU LilyPond) 2.15.29 convert-ly: Elaborazione di «»...
Conversione in corso: 2.15.25
%}
%{
convert-ly (GNU LilyPond) 2.17.12 convert-ly: Processing `'...
Applying conversion: 2.15.32, 2.15.39, 2.15.40, 2.15.42, 2.15.43,
2.16.0, 2.17.0, 2.17.4, 2.17.5, 2.17.6, 2.17.11
%}
%{
convert-ly (GNU LilyPond) 2.19.0 convert-ly: Elaborazione di «»...
Conversione in corso: 2.17.14, 2.17.15, 2.17.18, 2.17.19, 2.17.20,
2.17.25, 2.17.27, 2.17.29, 2.17.97, 2.18.0
%}
%{
convert-ly (GNU LilyPond) 2.22.2 convert-ly: Elaborazione di «»...
Conversione in corso: Il documento non è stato modificato.
%}
%{
convert-ly (GNU LilyPond) 2.24.0 convert-ly: Processing `'...
Applying conversion: 2.23.1, 2.23.2, 2.23.3, 2.23.4, 2.23.5, 2.23.6,
2.23.7, 2.23.8, 2.23.9, 2.23.10, 2.23.11, 2.23.12, 2.23.13, 2.23.14,
2.24.0
%}