chord_def: Define chords

View source: R/chord_mapping.R

chord_defR Documentation

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().

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 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.

Value

a data frame

Examples

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"))

tabr documentation built on Sept. 12, 2024, 6:18 a.m.