This section introduces the use of chords in
tabr. All of the functionality surrounding individual notes in phrases generalizes to chords. Chords symbols can also be displayed above sheet music staves and chord diagrams can be included at the top of sheet music scores using a chord chart. These topics are covered in the subsequent section on tracks and scores. This section here focuses on using chords in
phrase where their notation will become part of the content engraved in the sheet music staves.
Like individual pitches, chords and other combinations of simultaneous pitches can be specified in multiple equivalent ways. The only difference is that there are no spaces between the notes. The following are equivalent ways to specify the same open C major chord.
phrase("cegc'e' c3e3g3c4e4 cegc4e4", 4)
#> <Musical phrase> #> <c e g c' e'>4 <c e g c' e'>4 <c e g c' e'>4
When the notes of a chord are tied over to the next, it is convenient to use
tie to avoid having to write the
~ explicitly for each note in the chord.
#> <Noteworthy string> #> Format: space-delimited time #> Values: <c3~e3~g3~c4~e4~>
notes, explicit string numbers passed to the
string argument also remove spaces between individual string numbers. Recall the inferred strings when only the first (lowest number) string is given, as well as the expansion operator. Recycling only works when it is a single value.
#>  TRUE
#>  TRUE
Chord diagrams refer to the fretboard diagrams commonly displayed in sheet music written for guitar. These chord diagram specifications are passed to
score, discussed in the next section that brings together the overall process of moving from phrases to tracks to a score. Here, the syntax used to specify chords for chord diagrams is introduced. Below are some chords that appear in a song.
Note that minor chord names, indicated by
m, are one of the available chord modifiers. These modifiers come after the separator
:. This is different from how key signatures can be expressed throughout most of
tabr, with just a
"dm" for example, but the modifiers that follow the colon have more general uses for chord diagrams. There will be more examples of this in a moment.
The chords also require position descriptions, because the same chord can be played many ways. This is the part that fully defines the chord diagram. As is standard,
x means a string is not played and
o refers to an open string. The numbers refer to the fret. The string is six characters representing strings six through one (low to high pitch) from left to right.
If the chord positions are a named vector, there is no need to pass both positions and names separately to
chord_set. It will check the first argument for names before looking to the second argument.
chords <- chord_set(chord_positions, chord_names) chords
#> d:m f g:m a #> "x;x;o;2;3;1;" "1;3;3;2;1;1;" "3;5;5;3;3;3;" "x;o;2;2;2;o;"
#>  TRUE
chord_set is a simple function that manipulates the input strings into a named character vector of chord entries in a format understood by LilyPond.
Next, to demonstrate the chord chart, make a dummy song and include the chord set. The output for the dummy song now contains a chord chart centered at the top of the first page of sheet music.
The next example highlights several facts about chord specification for fretboard diagrams and chord charts.
mthat follow the
:separator including chords such as suspended second and forth chords. See the first two chords below. Common modifiers include
/<note>. This is suffixed to the the chord regardless of whether that places it against an otherwise unmodified chord or after a chord modifier. See the next two chords below.
xis inferred. See below. Chords including 2-digit fret numbers require using spaces or semicolons as a delimiter. Do not mix the two. See the fifth chord below.
xis marked in the output, but no string appears. Similarly, if fewer strings are indicated by the fret positions provided, such as for an instrument with fewer than six strings, this results in erroneously applying them to a subset of the six guitar strings in the fretboard diagram. More general support may come later.
sentries for rests or silent rests, they are passed through by
chord_setbut ignored when generating chord charts.
You have already seen chord symbols, placed above the fretboard diagrams above. Chord symbols refer to the shorthand chord notation, or chord labels, often shown above chord diagrams as well as above a music staff at the beginning of measures or at each chord change. These are the familiar labels such as
C Dm F# F/C. The next use of chords is placement above the staff in time. This is the chord sequence.
In order to place chord symbols in time above a music staff, it is necessary to specify their sequence and the duration of each chord, just like is required for all the notes and chords shown inside the staff that are created from a sequence of phrase objects. The two examples below uses a simple melody of arpeggiated, broken chords played using the chords C, F and G. Those chord symbols are shown above the staff at the appropriate point in time based on the defined chord sequence.
notes <- "c e g c' e' c' g e g b d' g' f a c' f' c e g e c" info <- c("8*20 2", "4*20 1") strings <- pc(c(5:1, 2:4, 4:1, 4:1, 5:3, 4:5)) # almost not needed, but for 1st 2 notes of G chord p1 <- p(notes, info, strings) p2 <- p(notes, info, strings) chords <- chord_set(c(c = "32o1o", f = "3211", g = "5433", r = NA, s = NA))
In the first version, there is a chord change halfway through a measure. Assign beat duration information for each chord in the sequence just as you would with the
info argument to
phrase, e.g., half a measure is given with
2. The C chord is played for a full measure both times while the F and G chords each last half a measure. The chord sequence is named just like
chords above. This is how the correct chord symbol is applied above the staff at the correct time. Taking the names directly from
chords as a chord dictionary for the song is the suggested way to avoid having to type chord symbols repeatedly.
score takes a
chord_seq argument after the
chords argument. Building on the previous example, here both are passed to
Version two double the duration of all notes. Now the C chord lasts for two full measures while the F and G chords are played for one measure each. You can always specify a chord for every measure, in this case providing the C chord in the sequence twice in a row for one measure each. However, this example uses rests. Note the inclusion of
s in the current
To illustrate how rests factor into chord sequences, a silent rest is used for measure two. This avoids showing the C chord twice in a row without a chord change in between. Nothing is shown above the staff at this point in time. The final measure of the phrase uses a regular rest, which is not silent. This leads to the “no chord” symbol
N.C. being printed above the staff. You do not show a chord as lasting longer than a measure by providing values less than one. This example also shows a very simple but also very common case where a song does have every chord in its chord sequence last for exactly one measure.
Since the chord chart is included and was only shown in prior examples zoomed in, here is the result above showing the full sheet, which includes the staves and chord symbols, the chord chart positioned top center, and for perspective the page numbering in the top right corner.
To sum up, chords are used in
tabr in three ways. Using
phrase, they appear among other notes in staves as the core component of the music transcription. They are also used by
score to generate chord charts using fretboard diagrams that summarize all the chords that occur in a song. Finally, the same chord symbols can be listed in sequence with corresponding durations to be applied above a music staff, showing the chord progression throughout the song in proper time.