Search code examples
lilypond

Lilypond: adding arrows between cells of a chord grid


I filled a chord grid in LilyPond which you can see the output here. I want to add some arrows to write a syncope.

enter image description here

I thought about adding slurs:

grille = \chordmode {
  \bar "[|:"
  d1(
  g1)
 ...

But it doesn't modify anything.

Here is the code:

% LilyBin
\version "2.19.55"


#(set-global-staff-size 18)
% si cette valeur change modifier la valeur de rlineto ci-dessous

\paper {
  page-breaking = #ly:page-turn-breaking
}

\header {
  tagline = ##f
  composer = "The Cure"
  title = "Friday I'm in Love"
}
  \paper {
    #(set-paper-size "a4")
    page-count = #1 % forçage du nombre de pages
    page-breaking = #ly:page-turn-breaking
  }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% La fonction pour diviser une case en 2 %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

"\\/" =
#(define-music-function
  (parser location mus1 mus2) ( ly:music? ly:music? )
  #{
    \stopStaff
    \once \override Staff.StaffSymbol.stencil =
    $(lambda (grob)
       (let* ((staff (ly:staff-symbol::print grob))
              (X-ext (ly:stencil-extent staff X))
              (Y-ext (ly:stencil-extent staff Y)))
         (ly:grob-set-property! grob 'layer -10)
         (ly:stencil-add
          (make-line-stencil
           (ly:staff-symbol-line-thickness grob)
           (car X-ext) (car Y-ext) (cdr X-ext) (cdr Y-ext))
          staff)))
    \startStaff
    \once \override ChordName.extra-offset = #'(1 . .5)
    $mus1
    \once \override ChordName.extra-offset = #'(3 . -3)
    $mus2
    \stopStaff
    \startStaff
  #})
%%%%%%%%%%%%%%%%%

grille = \chordmode {
  \bar "[|:"
  d1
  g1
  d1
  a1 
  \break
  b1:m
  g1
  d1
  a1
  \bar ":|]"
  \break
  \bar "[|:"
  d1
  g1
  d1
  a1  
  \break
  b1:m
  g1
  d1
  a1
  \bar ":|]"
  \break
  g1
  a1
  b1:m
  g1
  \break
  d1
  a1
  \stopStaff
  \bar "" s \bar "" s 
  \break
  \startStaff
  d1
  g1
  d1
  a1  
  \break
  b1:m
  g1
  d1
  a1
  \break
  d1
  g1
  d1
  a1  
  \break
  b1:m
  g1
  d1
  a1
  \break
  d1
  g1
  d1
  a1  
  \break
  b1:m
  g1
  d1
  a1
  \pageBreak
  \break
  g1
  a1
  b1:m
  g1
  \break
  d1
  a1
  \stopStaff
  \bar "" s \bar "" s 
  \break
  \startStaff
  \set Score.repeatCommands = #'((volta "4 X"))
  \bar "[|:"
  b1:m
  c:9
  d1
  a1
  \set Score.repeatCommands = #'((volta "#f"))
  \bar ":|]"
}

marques = \relative c' { 
  s1 ^\markup \bold \box \fontsize #7 Intro s1*7 
  s1 ^\markup \bold \box \fontsize #7 VerseI s1*7 
  s1 ^\markup \bold \box \fontsize #7 Chorus s1*7
  s1 ^\markup \bold \box \fontsize #7 VerseII s1*7
  s1 ^\markup \bold \box \fontsize #7 Solo s1*7
  s1 ^\markup \bold \box \fontsize #7 VerseIII s1*7
  s1 ^\markup \bold \box \fontsize #7 ChorusII s1*7
  s1 ^\markup \bold \box \fontsize #7 Bridge s1*7
}

\score{
      \layout {
        indent = 0 % pas de décalage même à la première ligne
        \context {
          \Score
          \omit Clef % Cacher la clef
          \omit TimeSignature % cacher la métrique
          \omit BarNumber % cacher les numéros de mesures            
          \override SpacingSpanner.strict-note-spacing = ##t % permet d’avoir toutes les mesures de même longueur
          proportionalNotationDuration = #(ly:make-moment 1/16) % durée de référence pour espacer la musique
        }
      }
      <<
        \new Staff \with { % la portée qui recevra les repères
          \remove "Staff_symbol_engraver" % cacher la portée 
        }    
        \marques % la variable contenant les repères
        \new ChordNames \with { % la portée qui recevra la grille harmonique
          \override ChordName.extra-offset = #'(10 . -1 ) % déplacer les noms des accords        
          \override BarLine.bar-extent = #'(-5 . 5) % définir la taille des barres de mesures
          \consists "Bar_engraver" % afficher les barres de mesures
          \override StaffSymbol.line-positions = #'( -10 10 ) % definir une portée de 2 lignnes
          \consists "Staff_symbol_engraver" % afficher la portée
          \consists "Percent_repeat_engraver" % afficher le signe "%" pour les mesures répétées
        }
        \grille % la variable contenant la grille harmonique proprement dite
      >>
}

Solution

  • I'm new to Lilypond myself, but I was able to get the arrow by creating a custom shape in the markup of a measure /mark.

    See this example (based on your original output): http://lilybin.com/k7kykq/142

    enter image description here

    Please forgive the fact that I hard-coded the shape. I don't yet know of an easier way of drawing it.

    Idea inspired by: http://lsr.di.unimi.it/LSR/Item?id=1050