Calculate the classic operations on pitch-class sets \(T_n\) and
\(T_n I\). That is, tn
adds a constant to all elements in a set
modulo the octave, and tni
essentially multiplies a set by -1
(modulo
the octave) and then adds a constant (modulo the octave). If sorted
is
TRUE
(as is default), the resulting set is listed in ascending order,
but sometimes it can be useful to track transformational voice leadings,
in which case you should set sorted
to FALSE
.
startzero
transposes a set so that its first element is 0
.
(Note that this is different from tnprime()
because it doesn't attempt
to find the most compact form of the set. See examples for the contrast.)
Sometimes you just want to invert a set and you don't care what the
index is. charm
is a quick way to do this, giving a name to
the transposition-class of \(T_0 I\) of the set.
(The name charm
is a reference to "strange" and "charm" quarks in
particle physics: I like these as names for the "a" and "b" forms of
a set class, i.e. the strange common triad is 3-11a = (0, 3, 7)
and the charm common triad is 3-11b = (0, 4, 7). The name of the function
charm
means that if you input a strange set, you get out a charm set,
but NB also vice versa.)
Usage
tn(set, n, sorted = TRUE, edo = 12, rounder = 10)
tni(set, n, edo = 12, sorted = TRUE)
startzero(set, sorted = TRUE, edo = 12, rounder = 10)
charm(set, edo = 12, rounder = 10)
Arguments
- set
Numeric vector of pitch-classes in the set
- n
Numeric value (not necessarily an integer!) representing the index of transposition or inversion.
- sorted
Do you want the result to be in ascending order? Boolean, defaults to
TRUE
.- edo
Number of unit steps in an octave. Defaults to
12
.- rounder
Numeric (expected integer), defaults to
10
: number of decimal places to round to when testing for equality.
Examples
c_major <- c(0, 4, 7)
tn(c_major, 2)
#> [1] 2 6 9
tn(c_major, -10)
#> [1] 2 6 9
tni(c_major, 7)
#> [1] 0 3 7
tni(c_major, 7, sorted=FALSE)
#> [1] 7 3 0
tn(c(0, 1, 6, 7), 6)
#> [1] 0 1 6 7
tn(c(0, 1, 6, 7), 6, sorted=FALSE)
#> [1] 6 7 0 1
##### Difference between startzero and tnprime
e_maj7 <- c(4, 8, 11, 3)
startzero(e_maj7)
#> [1] 0 4 7 11
tnprime(e_maj7)
#> [1] 0 1 5 8
isTRUE(all.equal(tnprime(e_maj7), charm(e_maj7))) # True because inversionally symmetrical
#> [1] TRUE
##### Derive minimal voice leading from ionian to lydian
ionian <- c(0, 2, 4, 5, 7, 9, 11)
lydian <- rotate(tn(ionian, 7, sorted=FALSE), 3)
lydian - ionian
#> [1] 0 0 0 1 0 0 0