ifunc {musicMCT} | R Documentation |
All intervals from one set to another
Description
David Lewin's interval function (IFUNC) calculates all the intervals
from some source set x
to some goal set y
. See Lewin, Generalized
Musical Intervals and Transformations (New Haven, CT: Yale University Press,
1987), 88. Lewin's definition of the IFUNC depends on the GIS it applies to,
but this package's ifunc()
is less flexible. It uses only ordered pitch-class
intervals as the group of IVLS to be measured. Its intervals can, however,
be any continuous value and are not restricted to integers mod edo
. The
format of the result depends on whether non-integer intervals occur.
Usage
ifunc(
x,
y = NULL,
edo = 12,
rounder = 10,
display_digits = 2,
show_zeroes = TRUE
)
Arguments
x |
The source set from which the intervals originate |
y |
The goal set to which the intervals lead. Defaults to |
edo |
Number of unit steps in an octave. Defaults to |
rounder |
Numeric (expected integer), defaults to |
display_digits |
Integer: how many digits to display when naming any non-integral interval sizes. Defaults to 2. |
show_zeroes |
Boolean: if |
Value
Numeric vector counting the number of occurrences of each interval.
The names()
of the result indicate which interval size is counted by
each entry. If x
and y
both belong to a single mod edo
universe (and
show_zeroes=TRUE
), the result is a vector of length edo
and includes
explicit 0
results for missing intervals. If x
and y
must be measured
in continuous pitch-class space, no missing intervals are identified
(since there would be infinitely many to list).
Examples
ifunc(c(0, 3, 7))
ifunc(c(0, 3, 7), c(0, 4, 7))
ifunc(c(0, 4, 7), c(0, 3, 7))
ifunc(c(0, 2, 4, 7, 9), show_zeroes=FALSE)
just_dia <- j(dia)
ifunc(just_dia)
ifunc(just_dia, display_digits=4)
# See Lewin, GMIT p. 89:
lewin_x <- c(4, 10)
lewin_y1 <- c(9, 1, 5)
lewin_y2 <- c(7, 11, 9)
isTRUE(all.equal(ifunc(lewin_x, lewin_y1), ifunc(lewin_x, lewin_y2)))
apply(cbind(lewin_y1, lewin_y2), 2, fortenum)