Customizing the chord grid style: Difference between revisions
No edit summary |
mNo edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
Custom divisions of chord squares can be defined through the <code>measure-division-lines-alist</code> and <code>measure-division-chord-placement-alist</code> properties of <code>ChordSquare</code>. These are both alists. Their keys are measure divisions, namely lists which give the fraction of the measure that each chord (or rest, or skip) represents. More precisely, a measure division alist is made of positive, exact numbers adding up to 1, for example: <code>'(1/2 1/4 1/4)</code>. The exactness requirement means that, e.g., <code>1/2</code> is valid but not <code>0.5</code>. | Custom divisions of chord squares can be defined through the <code>measure-division-lines-alist</code> and <code>measure-division-chord-placement-alist</code> properties of <code>ChordSquare</code>. These are both alists. Their keys are measure divisions, namely lists which give the fraction of the measure that each chord (or rest, or skip) represents. More precisely, a measure division alist is made of positive, exact numbers adding up to 1, for example: <code>'(1/2 1/4 1/4)</code>. The exactness requirement means that, e.g., <code>1/2</code> is valid but not <code>0.5</code>. | ||
The values in <code>measure-division-lines-alist</code> are lists of lines, which are represented as <code>(<var>x1</var> <var>y1</var> <var>x2</var> <var>y2</var>)</code>. The line starts at the point <code>(<var>x1</var> . <var>y1</var>)</code> and ends at <code>(<var>x2</var> . <var>y2</var>)</code>. Coordinates are expressed in the [-1, | The values in <code>measure-division-lines-alist</code> are lists of lines, which are represented as <code>(<var>x1</var> <var>y1</var> <var>x2</var> <var>y2</var>)</code>. The line starts at the point <code>(<var>x1</var> . <var>y1</var>)</code> and ends at <code>(<var>x2</var> . <var>y2</var>)</code>. Coordinates are expressed in the [-1, 1] scale relative to the extent of the square. | ||
The values in <code>measure-division-chord-placement-alist</code> are lists of <code>(<var>x</var> . <var>y</var>)</code> pairs giving the placement of the respective chords. | The values in <code>measure-division-chord-placement-alist</code> are lists of <code>(<var>x</var> . <var>y</var>)</code> pairs giving the placement of the respective chords. | ||
This example defines a peculiar chord grid style that has a rule for measures divided in three equal parts. | This example defines a peculiar chord grid style that has a rule for measures divided in three equal parts. | ||
| Line 29: | Line 29: | ||
[[Category:Chords]] | [[Category:Chords]] | ||
[[Category:Included in the official documentation]][[Category:Snippet]] | [[Category:Included in the official documentation]] | ||
[[Category:Snippet]] | |||
Latest revision as of 13:17, 16 December 2025
Custom divisions of chord squares can be defined through the measure-division-lines-alist and measure-division-chord-placement-alist properties of ChordSquare. These are both alists. Their keys are measure divisions, namely lists which give the fraction of the measure that each chord (or rest, or skip) represents. More precisely, a measure division alist is made of positive, exact numbers adding up to 1, for example: '(1/2 1/4 1/4). The exactness requirement means that, e.g., 1/2 is valid but not 0.5.
The values in measure-division-lines-alist are lists of lines, which are represented as (x1 y1 x2 y2). The line starts at the point (x1 . y1) and ends at (x2 . y2). Coordinates are expressed in the [-1, 1] scale relative to the extent of the square.
The values in measure-division-chord-placement-alist are lists of (x . y) pairs giving the placement of the respective chords.
This example defines a peculiar chord grid style that has a rule for measures divided in three equal parts.
\version "2.24"
\paper {
line-width = 10\cm
ragged-right = ##f
}
\new ChordGrid \with {
\override ChordSquare.measure-division-lines-alist =
#'(((1) . ())
((1/3 1/3 1/3) . ((-1 -0.4 0 1) (0 -1 1 0.4))))
\override ChordSquare.measure-division-chord-placement-alist =
#'(((1) . ((0 . 0)))
((1/3 1/3 1/3) . ((-0.7 . 0.5) (0 . 0) (0.7 . -0.5))))
}
\chordmode {
\time 3/4
c2.
c4 c4 c4
}