tabr (version 0.3.5)

chord-filter: Extract notes from chords

Description

Filter or slice chords to extract individual notes.

Usage

chord_root(chords)

chord_top(chords)

chord_slice(chords, index)

Arguments

chords

character, a noteworthy string, may include individual notes and chords.

index

integer, the order of a note in a chord by pitch (not scale degrees).

Value

a noteworthy string

Details

These functions extract notes from chords such as the root note, the highest pitch, specific position among the notes by pitch, or trim chords to simplify them. They operate based only on ordered pitches.

For chord_slice, any entry that is empty after slicing is dropped. An error is thrown is index is completely out of bounds for all chords.

Examples

Run this code
# NOT RUN {
x <- "a2 ceg e_gc egc,cc'"
chord_root(x)
chord_top(x)
identical(chord_slice(x, 1), chord_root(x))
chord_slice(x, 2)
chord_slice(x, 4)
chord_slice(x, 3:5)
# }

Run the code above in your browser using DataCamp Workspace