Learn R Programming

tabr (version 0.3.0)

chord_def: Define chords

Description

Function for creating new chord definition tables.

Usage

chord_def(fret, id, optional = NA, tuning = "standard", ...)

Arguments

fret

integer vector defining fretted chord. See details.

id

character, the chord type. See details.

optional

NA when all notes required. Otherwise an integer vector giving the indices offret that are considered optional notes for the chord.

tuning

character, string tuning. See tunings for predefined tunings. Custom tunings are specified with a similar value string.

...

additional arguments passed to transpose. See examples.

Value

a data frame

Details

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 guitar Chords for examples.

Examples

Run this code
# NOT RUN {
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"))
# }

Run the code above in your browser using DataLab