This section covers differently strung guitars and string instruments as well as non-standard tunings. Different tunings can be associated with individual music staves and are therefore specified when calling track().

Predefined tunings

The tuning argument to track accepts a variety of predefined commonly used string tunings, defaulting to standard. A table of 32 predefined tunings for various instruments is available.

head(tunings)
#>         id        value
#> 1 standard    e,a,dgbe'
#> 2    seven b,,e,a,dgbe'
#> 3    dropD    d,a,dgbe'
#> 4    dropC    c,g,cfad'
#> 5    openG    d,g,dgbd'
#> 6    openD   d,a,df#ad'

Arbitrary tunings

More importantly, track tuning can also be expressed using explicit pitch for completely arbitrary tunings with any number of strings (tabr technically supports up to seven strings as a general rule). While the predefined set is convenient, it is not necessary to use and this is where the use of alternate tunings really shines.

Any of the explicit tunings shown in the tunings table can be supplied to track() exactly as shown instead of using the given names, or any other explicit tuning. Tuning can be provided using tick or integer octave numbering style.

When providing a tuning, names are checked first against the IDs in tunings. If there is no match, it is assumed to be an explicit tuning already. Some additional checks are performed to catch common user errors in entering a tuning.

Tuning for a track defaults to standard tuning on a six string guitar. The following calls are equivalent and result in the same explicit tuning stored in each of the the track tables.

p1 <- p("a", 1)
track(p1, tuning = "standard")
#> # A tibble: 1 × 7
#>   phrase       clef     key   tab   tuning    voice lyrics
#>   <list>       <chr>    <chr> <lgl> <chr>     <int> <chr> 
#> 1 <phrase [1]> treble_8 NA    TRUE  e,a,dgbe'     1 NA
track(p1, tuning = "e2 a2 d g b e4")
#> # A tibble: 1 × 7
#>   phrase       clef     key   tab   tuning    voice lyrics
#>   <list>       <chr>    <chr> <lgl> <chr>     <int> <chr> 
#> 1 <phrase [1]> treble_8 NA    TRUE  e,a,dgbe'     1 NA
track(p1, tuning = "e, a, d g b e'")
#> # A tibble: 1 × 7
#>   phrase       clef     key   tab   tuning    voice lyrics
#>   <list>       <chr>    <chr> <lgl> <chr>     <int> <chr> 
#> 1 <phrase [1]> treble_8 NA    TRUE  e,a,dgbe'     1 NA

Number of strings

While tabr has a focus on guitar tablature, it does offer some built in support for string instruments more generally.

A convenient approach taken by tabr is that the number of strings an instrument has, and in turn the number of horizontal lines in a rendered tablature staff, is inferred directly from the explicit tuning.

Take the predefined bass tuning (standard bass tuning) or the explicit tuning it is converted to by track(), which is e,, a,, d, g,. This is a tuning that specifies four strings. This is all tabr needs to know and pass along to LilyPond to yield a tablature staff with four staff lines as opposed to the standard six line staff used for typical guitar tabs.

The next example shows three different tablature staves: six string guitar in standard tuning, four string bass in standard tuning, and just for illustration, a one string instrument tuning to the fourth octave C note.

guitar <- tuplet("e, a, d g b e'", 4)
bass <- p("e,, a,, d, g,", 4)
one_string <- p("c' d' e' f'", 4)
tracks <- trackbind(
  track(guitar, clef = NA), 
  track(bass, clef = NA, tuning = "bass"), 
  track(one_string, clef = NA, tuning = "c'")
)
tracks
#> # A tibble: 3 × 8
#>   phrase       clef  key   tab   tuning     voice lyrics    id
#>   <list>       <chr> <chr> <lgl> <chr>      <int> <chr>  <int>
#> 1 <phrase [1]> NA    NA    TRUE  e,a,dgbe'      1 NA         1
#> 2 <phrase [1]> NA    NA    TRUE  e,,a,,d,g,     1 NA         2
#> 3 <phrase [1]> NA    NA    TRUE  c'             1 NA         3
score(tracks) |> tab("out.pdf")

Notice that for tunings other than standard guitar, the default is to show the note each string is tuned to at the start of the tablature staff. These can be turning off in score() using string_names = FALSE. For example, when making a pure bass tab in standard tuning, you might opt to exclude this. There must still be some familiarity with the instrument of course. In the case of the made up one string instrument, no one would know which octave the open C belongs to, but the person with such an instrument would surely know what to expect.

Take another look at the same example, but this time including music staves. Because of the different octave ranges of the different instruments, it is best to use an appropriate clef. Recall the default (used for guitar) is treble_8 because guitar is a transposing instrument. Compare this with treble used for the third instrument that is in a higher octave. These different notations help prevent difficult to read transcriptions where the notes go far above or below the staff lines.

tracks <- trackbind(
  track(guitar), 
  track(bass, clef = "bass_8", tuning = "bass"), 
  track(one_string, clef = "treble", tuning = "c'")
)
tracks
#> # A tibble: 3 × 8
#>   phrase       clef     key   tab   tuning     voice lyrics    id
#>   <list>       <chr>    <chr> <lgl> <chr>      <int> <chr>  <int>
#> 1 <phrase [1]> treble_8 NA    TRUE  e,a,dgbe'      1 NA         1
#> 2 <phrase [1]> bass_8   NA    TRUE  e,,a,,d,g,     1 NA         2
#> 3 <phrase [1]> treble   NA    TRUE  c'             1 NA         3
score(tracks) |> tab("out.pdf")

Current limitations

Although tabr infers an instrument’s number of strings from its tuning, there are limitations. Chord fretboard diagrams are only supported for guitar, six string guitar specifically. If attempting to pass four or five strings of information to chord_set() for bass, ukulele or banjo for example, this will incompletely fill in a six string guitar fretboard diagram in the chord chart of the output. Similarly, if attempting to provide seven strings for a seven string guitar, the chord chart will show the additional note, but it will be floating to the side of the chart. A seventh string line is not added to the diagram. Number of strings inferred from instrument tuning displays in the tablature staff, but does not generalize to fretboard diagrams.