j {musicMCT} | R Documentation |
Convenient just-intonation intervals and scales
Description
It's not hard to define a just interval from a frequency ratio: it only
requires an input like 12*log2(freq_ratio)
. That gets pretty tiresome
if you're doing this a lot, though, so for convenience musicMCT
includes a j()
function (not related to Clough and Douthett's J function
but it wishes it was). j()
is designed to behave a lot like base R's c()
in the way that you'd use it to define a scale (see the examples below).
The inputs that this can take are limited and hard-coded, since there's no
systematic way to define short hands for every potential just interval.
In general, the logic is that individual digits refer to major intervals up from
the tonic in the 5-limit just diatonic scale. The prefix "m" to a number (e.g. "m3")
gives the equivalent minor version of the interval. If you
just want the entire 5-limit diatonic, you can enter dia
.
Usage
j(..., edo = 12)
Arguments
... |
One or more names that will be matched to just intervals. You can enter these as strings, but for convenience sake you needn't. Here are the currently accepted inputs, their meaning, and their return value:
|
edo |
Number of unit steps in an octave. Defaults to |
Value
Numeric vector representing the input just intervals converted to edo
unit steps per octave
See Also
z()
as a shortcut for 12*log2(x) when a just interval you need isn't
defined for j()
.
Examples
major_triad <- j(1,3,5)
isTRUE(all.equal(major_triad, j(u, M3, "5")))
isTRUE(all.equal(j(dia), j(1,2,3,4,5,6,7)))
# How far is the twelve-equal major scale from the 5-limit just diatonic?
dist(rbind(c(0,2,4,5,7,9,11), j(dia)))
# Is 53-equal temperament a good approximation of the 5-limit just diatonic?
j(dia, edo=53)