Rank, order and sort chords and notes by various definitions.

chord_rank(notes, pitch = c("min", "mean", "max"), ...)

chord_order(notes, pitch = c("min", "mean", "max"), ...)

chord_sort(notes, pitch = c("min", "mean", "max"), decreasing = FALSE, ...)

Arguments

notes

character, a noteworthy string.

pitch

character, how ranking of chords is determined; lowest pitch, mean pitch, or highest pitch.

...

additional arguments passed to rank() or order().

decreasing

logical, sort in decreasing order.

Value

integer for rank and order, character for sort

Details

There are three options for comparing the relative pitch position of chords provided: comparison of the lowest or root note of each chord, the highest pitch note, or taking the mean of all notes in a chord.

Examples

x <- "a2 c a2 ceg ce_g cea"
chord_rank(x, "min")
#> [1] 1.5 4.5 1.5 4.5 4.5 4.5
chord_rank(x, "max")
#> [1] 1.5 3.0 1.5 4.5 4.5 6.0
chord_rank(x, "mean")
#> [1] 1.5 3.0 1.5 5.0 4.0 6.0

chord_order(x)
#> [1] 1 3 2 4 5 6
chord_order(x, "mean")
#> [1] 1 3 2 5 4 6
chord_sort(x, "mean")
#> <Noteworthy string>
#>   Format: space-delimited time
#>   Values: a2 a2 c <ce_g> <ceg> <cea>