Obtain frequency ratios data frame.
freq_ratio(x, ...)
a tibble data frame
This generic function returns a data frame of frequency ratios from a vector or list of frequencies, a noteworthy object, or a music object. For frequency inputs, a list can be used to represent multiple timesteps. Octave numbering and accidentals are inferred from noteworthy and music objects, but can be specified for frequency. See examples.
By default ratios are returned for all combinations of intervals in each
chord (ratios = "all"
). ratios = "root"
filters the result to only
include chord ratios with respect to the root note of each chord.
ratios = "range"
filters to only the chord ratio between the root and
highest note.
x <- as_music("c4 e_ g ce_g")
(fr <- freq_ratio(x))
#> # A tibble: 6 × 5
#> timestep notes freq1 freq2 ratio
#> <int> <notwrthy> <dbl> <dbl> <dbl>
#> 1 1 c 131. NA NA
#> 2 2 e_ 156. NA NA
#> 3 3 g 196. NA NA
#> 4 4 ce_ 131. 156. 1.19
#> 5 4 cg 131. 196. 1.50
#> 6 4 e_g 156. 196. 1.26
x <- music_notes(x)
identical(fr, freq_ratio(x))
#> [1] TRUE
x <- chord_freq(x)
identical(fr, freq_ratio(x))
#> [1] TRUE
freq_ratio(x, accidentals = "sharp")
#> # A tibble: 6 × 5
#> timestep notes freq1 freq2 ratio
#> <int> <notwrthy> <dbl> <dbl> <dbl>
#> 1 1 c 131. NA NA
#> 2 2 d# 156. NA NA
#> 3 3 g 196. NA NA
#> 4 4 cd# 131. 156. 1.19
#> 5 4 cg 131. 196. 1.50
#> 6 4 d#g 156. 196. 1.26
freq_ratio(x, ratios = "root")
#> # A tibble: 5 × 5
#> timestep notes freq1 freq2 ratio
#> <int> <notwrthy> <dbl> <dbl> <dbl>
#> 1 1 c 131. NA NA
#> 2 2 e_ 156. NA NA
#> 3 3 g 196. NA NA
#> 4 4 ce_ 131. 156. 1.19
#> 5 4 cg 131. 196. 1.50
freq_ratio(x, ratios = "range")
#> # A tibble: 4 × 5
#> timestep notes freq1 freq2 ratio
#> <int> <notwrthy> <dbl> <dbl> <dbl>
#> 1 1 c 131. NA NA
#> 2 2 e_ 156. NA NA
#> 3 3 g 196. NA NA
#> 4 4 cg 131. 196. 1.50