Frequency ratios to logarithmic pitch intervals (e.g. semitones)
Source:R/intervals_and_scales.R
z.Rd
Simple convenience function for converting frequency ratios to
semitones. Useful to have in addition to j()
because j()
is only
defined for specific common values. Defaults to 12-tone equal temperament
but edo
parameter allows other units.
Details
The name z()
doesn't make a lot of sense but has the virtue of being
a letter that isn't otherwise very common. r
(for ratio) and q
(for
the rationals) were both avoided because they're already used for other
functions.
See also
j()
is a more convenient input method for the most common frequency
ratios.
Examples
z(81/80) == j(synt)
#> [1] TRUE
mod_jdia <- z(1, 10/9, 5/4, 4/3, 3/2, 5/3, 15/8)
minimize_vl(j(dia), mod_jdia)
#> [1] 0.0000000 -0.2150629 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000
z(1, 5/4, 3/2, edo=53)
#> [1] 0.00000 17.06219 31.00301