chord_set: Generate a chord set

View source: R/tracks.R

chord_setR Documentation

Generate a chord set

Description

Generate a chord set for a music score.

Usage

chord_set(x, id = NULL, n = 6)

Arguments

x

character, n-string chord description from lowest to highest pitch, strings n through 1. E.g., "xo221o". You can use spaces or semicolons when 2-digit fret numbers are present, e.g., "8 10 10 9 o". Do not mix formats. Leading x are inferred if the number of entries is less than n.

id

character, the name of the chord in LilyPond readable format, e.g., "a:m". Ignored if x is already a named vector.

n

number of instrument strings.

Details

The chord set list returned by chord_set() is only used for top center placement of a full set of chord fretboard diagrams for a music score. chord_set() returns a named list. The names are the chords and the list elements are strings defining string and fret fingering readable by LilyPond. Multiple chord positions can be defined for the same chord name. Instruments with a number of strings other than six are not currently supported.

When defining chords, you may also wish to define rests or silent rests for chords that are to be added to a score for placement above the staff in time, where no chord is to be played or explicitly written. Therefore, there are occasions where you may pass chord names and positions that happen to include entries r and/or s as NA as shown in the example. These two special cases are passed through by chord_set() but are ignored when the chord chart is generated.

Value

a named list.

Examples

chord_names <- c("e:m", "c", "d", "e:m", "d", "r", "s")
chord_position <- c("997x", "5553x", "7775x", "ooo22o", "232oxx", NA, NA)
chord_set(chord_position, chord_names)

tabr documentation built on Sept. 21, 2023, 5:06 p.m.