View source: R/chord_mapping.R
chord_def | R Documentation |
Function for creating new chord definition tables.
chord_def(fret, id, optional = NA, tuning = "standard", ...)
fret |
integer vector defining fretted chord. See details. |
id |
character, the chord type. See details. |
optional |
|
tuning |
character, string tuning. See |
... |
additional arguments passed to |
This function creates a tibble data frame containing information defining
various attributes of chords.
It is used to create the guitarChords
dataset, but can be used to create
other pre-defined chord collections.
The tibble has only one row, providing all information for the defined chord.
The user can decide which arguments to vectorize over when creating a chord
collection. See examples.
This function uses a vector of fret integers (NA
for muted string) to
define a chord, in conjunction with a string tuning
(defaults to standard
tuning, six-string guitar). fret
is from lowest to highest pitch strings,
e.g., strings six through one.
The id
is passed directly to the output. It represents the type of chord
and should conform to accepted tabr
notation. See id
column in
guitarChords
for examples.
Note that the semitones
column gives semitone intervals between chord
notes. These count from zero as the lowest pitch based on the tuning of the
instrument, e.g., zero is E2 with standard guitar tuning. To convert these
semitone intervals to standard semitone values assigned to pitches, use
e.g., pitch_semitones("e2")
(40) if that is the lowest pitch and add
that value to the instrument semitone interval values.
This is the explanation, but doing this is not necessary. You can use
chord_semitones()
to compute semitones directly on pitches in a
chord.
a data frame
frets <- c(NA, 0, 2, 2, 1, 0)
chord_def(frets, "m")
chord_def(frets, "m", 6)
purrr::map_dfr(c(0, 2, 3), ~chord_def(frets + .x, "m"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.