tabr (version 0.3.5)

keys: Key signatures

Description

Helper functions for key signature information.

Usage

keys(type = c("all", "sharp", "flat"))

key_is_natural(key)

key_is_sharp(key)

key_is_flat(key)

key_n_sharps(key)

key_n_flats(key)

key_is_major(key)

key_is_minor(key)

Arguments

type

character, defaults to "all".

key

character, key signature.

Value

character vector.

Details

The keys function returns a vector of valid key signature IDs. These IDs are how key signatures are specified throughout tabr, including in the other helper functions here via key. Like the other functions here, key_is_sharp and key_is_flat are for key signatures, not single pitches whose sharp or flat status is always self-evident from their notation. Major and minor keys are also self-evident from their notation, but key_is_major and key_is_minor can still be useful when programming.

Examples

Run this code
# NOT RUN {
keys()
key_is_natural(c("c", "am", "c#"))
x <- c("a", "e_")
key_is_sharp(x)
key_is_flat(x)
key_n_sharps(x)
key_n_flats(x)
# }

Run the code above in your browser using DataCamp Workspace