project_onto {musicMCT} | R Documentation |
Closest point on a given flat
Description
Projects a scale onto the nearest point that lies on a target flat
of the hyperplane arrangement. project_onto()
determines the target
flat from a list of linearly independent rows in ineqmat
which define
the flat. match_flat()
determines the target by extrapolating from a
given scale on that flat. Note that while the projection lies on
the desired flat (i.e. it will have all of the necessary 0
s in its
sign vector), it will not necessarily belong to any particular color.
(That is, projection doesn't give you control over the 1
s and -1
s of
the sign vector.)
Usage
project_onto(
set,
target_rows,
ineqmat = NULL,
start_zero = TRUE,
edo = 12,
rounder = 10
)
match_flat(
set,
target_scale,
start_zero = TRUE,
ineqmat = NULL,
edo = 12,
rounder = 10
)
Arguments
set |
Numeric vector of pitch-classes in the set |
target_rows |
An integer vector: each integer specifies a row
of |
ineqmat |
Specifies which hyperplane arrangement to consider. By default (or by
explicitly entering "mct") it supplies the standard "Modal Color Theory" arrangements
of |
start_zero |
Boolean: should the result be transposed so that its pitch
initial is zero? Defaults to |
edo |
Number of unit steps in an octave. Defaults to |
rounder |
Numeric (expected integer), defaults to |
target_scale |
A numeric vector which represents a scale on the target flat. |
Value
A numeric vector of same length as set
, representing
the projection of set
onto the flat determined by target_rows
or
target_scale
.
Examples
minor_triad <- c(0, 3, 7)
project_onto(minor_triad, 3)
project_onto(minor_triad, 1)
project_onto(minor_triad, c(1, 3))
# This last projection results in the perfectly even scale
# because that's the only scale on both hyperplanes 1 and 3.
major_scale <- c(0, 2, 4, 5, 7, 9, 11)
projected_just_dia <- match_flat(j(dia), major_scale)
print(projected_just_dia)
# This is very close to fifth-comma meantone:
fifth_comma_meantone <- sim(sort(((0:6) * meantone_fifth(1/5))%%12))[,5]
vl_dist(projected_just_dia, fifth_comma_meantone)