Jump to content

How to change fret diagram position: Difference between revisions

From LilyPond wiki
m New category
mNo edit summary
 
Line 1: Line 1:
If you want to move the position of a fret diagram, for example, to avoid collision, or to place it between two notes, you have various possibilities:
If you want to move the position of a fret diagram, for example, to avoid collision, or to place it between two notes, you have various possibilities.


1) modify #'padding or #'extra-offset values (as shown in the first snippet)
1) Modify the value of the <code>padding</code> or <code>extra-offset</code> property (as shown in the first line).


2) you can add an invisible voice and attach the fret diagrams to the invisible notes in that voice (as shown in the second example).
2) You can add an invisible voice and attach the fret diagrams to the invisible notes in that voice (as shown in the second line).


If you need to move the fret according with a rythmic position inside the bar (in the example, the third beat of the measure) the second example is better, because the fret is aligned with the third beat itself.
If you need to move the fret according with a rythmic position inside the bar (in the example, the third beat of the measure) the second example is better, because the fret is aligned with the third beat itself.


<lilypond version="2.24" full>
<lilypond version="2.24">
\header { tagline = ##f }
 
harmonies = \chordmode
harmonies = \chordmode
{
{
   a8:13
   a8:13
% THE FOLLOWING IS THE COMMAND TO MOVE THE CHORD NAME
   \once \override ChordNames.ChordName.extra-offset = #'(10 . 0)
   \once \override ChordNames.ChordName.extra-offset = #'(10 . 0)
   b8:13 s2.
   b8:13 s4. |
% THIS LINE IS THE SECOND METHOD
  s2 b2:13
    s4 s4  b4:13
}
}


\score
\score {
{
   <<
   <<
     \new ChordNames \harmonies
     \new ChordNames \harmonies
     \new Staff
     \new Staff {
    {a8^\markup { \fret-diagram "6-x;5-0;4-2;3-0;2-0;1-2;" }
      % Method 1.
% THE FOLLOWING IS THE COMMAND TO MOVE THE FRET DIAGRAM
      a8^\markup \fret-diagram "6-x;5-0;4-2;3-0;2-0;1-2;"
    \once \override TextScript.extra-offset = #'(10 . 0)
      \once \override TextScript.extra-offset = #'(10 . 0)
    b4.~^\markup { \fret-diagram "6-x;5-2;4-4;3-2;2-2;1-4;" } b4. a8\break
      b4.~^\markup \fret-diagram "6-x;5-2;4-4;3-2;2-2;1-4;"
% HERE IS THE SECOND METHOD
        b4. a8 | \break
    <<
 
      { a8 b4.~ b4. a8}
      % Method 2.
      { s4 s4 s4^\markup { \fret-diagram  "6-x;5-2;4-4;3-2;2-2;1-4;" }
      <<
      }
        { a8 b4.~ b4. a8 }
    >>
        { s2 s2^\markup \fret-diagram  "6-x;5-2;4-4;3-2;2-2;1-4;" }
  }
      >> |
    }
   >>
   >>
}
}
Line 41: Line 37:


[[Category:Fretted strings]]
[[Category:Fretted strings]]
[[Category:Specific notation]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Specific notation]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Snippet]]
[[Category:Snippet]]

Latest revision as of 21:35, 14 December 2025

If you want to move the position of a fret diagram, for example, to avoid collision, or to place it between two notes, you have various possibilities.

1) Modify the value of the padding or extra-offset property (as shown in the first line).

2) You can add an invisible voice and attach the fret diagrams to the invisible notes in that voice (as shown in the second line).

If you need to move the fret according with a rythmic position inside the bar (in the example, the third beat of the measure) the second example is better, because the fret is aligned with the third beat itself.

\version "2.24"

harmonies = \chordmode
{
  a8:13
  \once \override ChordNames.ChordName.extra-offset = #'(10 . 0)
  b8:13 s4. |
  s2 b2:13
}

\score {
  <<
    \new ChordNames \harmonies
    \new Staff {
      % Method 1.
      a8^\markup \fret-diagram "6-x;5-0;4-2;3-0;2-0;1-2;"
      \once \override TextScript.extra-offset = #'(10 . 0)
      b4.~^\markup \fret-diagram "6-x;5-2;4-4;3-2;2-2;1-4;"
        b4. a8 | \break

      % Method 2.
      <<
        { a8 b4.~ b4. a8 }
        { s2 s2^\markup \fret-diagram  "6-x;5-2;4-4;3-2;2-2;1-4;" }
      >> |
    }
  >>
}