I'm trying to create a rhythm chart for guitarists that have specific voicings 
shown in fret diagrams. It's mostly correct, except I have two measures on the 
first line and three on the remaining. What I want is four measures per line.

I'll fess up to being a beginner with Lilypond and not a musician, so I may be 
approaching this the wrong way.

I tried using \noBreak; that sort of worked, but it flowed off the right side 
of the page.
overriding the fretboard size; didn't affect the horizontal spacing
using the fret diagram markup string; minor changes to positioning, but not 
what I wanted
looked at annotate spacing; too green to make sense of what it's telling me.

I'm running out of ammo for my shotgun approach. Could someone with a clue give 
me a nudge in the right direction?

I attached a ly file I've been using for testing.
\version "2.22.1"

%{
based on a file stolen from a post by Urs Liska
in answer to "number of measures per staff"
%}

% adding two random chords shapes
#(define fretboard-table_1 (make-fretboard-table)) 

% Adding chord shape_2
\addChordShape #'shape_2 #guitar-tuning #"h:1;8-2;x;8-3;8-3;x;x;"
\storePredefinedDiagram #fretboard-table_1
\chordmode {c:m7}
#guitar-tuning
#(chord-shape 'shape_2 guitar-tuning)

% Adding chord shape_3
\addChordShape #'shape_3 #guitar-tuning #"h:1;10-2;x;10-3;10-3;x;x;"
\storePredefinedDiagram #fretboard-table_1
\chordmode {d:m7}
#guitar-tuning
#(chord-shape 'shape_3 guitar-tuning)

mychords = \chordmode
{
  \repeat unfold 64 
  {
    c4:m7 d4:m7 
  }
}	

%{
  Put some music in a variable.
  If you don't understand this please read
  http://www.lilypond.org/doc/v2.16/Documentation/learning/organizing-pieces-with-variables
%}
myMusic = \relative c' {
  \repeat unfold 64 {
    c8 e g e
  }
}

%{
  This is a variable containing our line break structure
  but no music. Note the use of spacer rests.
  We have four invisible whole measure rests (in 4/4)
  followed by a line break.
  This is repeated 9 times so we have nine lines of four measures each.
  (This is intentionally longer than \myMusic)
  
  Of course you can adapt the contents of this variable to the real
  structure of your piece (also containing time signature changes of course).
  
  And this variable could also be a place to put other general
  information such as rehearsal marks, tempo changes etc.
%}
myBreaks = {
  \repeat unfold 9 {
    s1*4
    \break
  }
}

%{
  In the score we have one Staff context.
  The '<< >>' signals that we have parallel musical expressions
  so \myMusic and \myBreaks are interpreted as two
  parallel voices in one Staff (with one of them containing 
  no visual music but only the breaks).
  
  You can see that the remaining measures in myBreaks keep
  the Staff alive after myMusic finishes
%}
\markup "1) Two voices in one Staff"
\score {
  \new Staff 
  <<
    \myMusic
    \myBreaks
  >>
  \layout{}
}

%{
  In this score we put the two variables in two contexts:
  one Staff for the music and one Dynamics context for the breaks.
  The difference for the current example is that the remaining measures 
  in myBreaks don't keep the Staff alive.
  But from the measure number 33 you can see that the Dynamics context is still alive.
  
  You should prefer this approach in a score with more than one Staff.
  Or if you put general information in it that you don't want to be printed
  within a single Staff (I use such a construct for performance indications, for example)
%}

% add fretboard details
myfretboards =
{
  \override FretBoard.fret-diagram-details.fret-label-vertical-offset = #'-0.5
  \override FretBoard.fret-diagram-details.number-type = #' arabic
  \override FretBoard fret-diagram-details.fret-distance = 1.0	% default value
  \override FretBoard fret-diagram-details.fret-label-horizontal-offset = 0.1	% default = 0
  \override FretBoard #'extra-offset = #'(1 . 0)
  % \override FretBoard #'size = #'.7
  \set predefinedDiagramTable = #fretboard-table_1
  \repeat unfold 32 
  {
    \chordmode {c4:m7 }
    \chordmode {d4:m7 }
    \chordmode {c4:m7 }
    \chordmode {d4:m7 }
    \noBreak
  }
}

\markup "2) Two individual contexts"
\score 
{
  <<
    \new ChordNames \mychords
    \new FretBoards \myfretboards
    \new Dynamics \myBreaks
    \new Staff \myMusic
  >>  
  \layout{}
}

Reply via email to