freq_ratio: Frequency ratios

View source: R/freq.R

freq_ratioR Documentation

Frequency ratios

Description

Obtain frequency ratios data frame.

Usage

freq_ratio(x, ...)

Arguments

x

noteworthy or music object, or a numeric vector or list of numeric vectors for frequencies.

...

additional arguments: ratios, which is one of "all" (default), "root", or "range" for filtering results. For frequency input, you may also specify octaves and accidentals. See details and examples.

Details

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.

Value

a tibble data frame

Examples

x <- as_music("c4 e_ g ce_g")
(fr <- freq_ratio(x))

x <- music_notes(x)
identical(fr, freq_ratio(x))

x <- chord_freq(x)
identical(fr, freq_ratio(x))

freq_ratio(x, accidentals = "sharp")

freq_ratio(x, ratios = "root")

freq_ratio(x, ratios = "range")

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