ExtensionA pitch interval can be represented as a vector, an n-tuple of integers in an n-dimensional lattice, also known as Harmonic Space. The base of the lattice consists of prime numbers up to the nth prime. These primes are fundamental intervals from which other, composite ones, derive. Every interval can be expressed as a vector of exponents to these primes, corresponding to the fundamental intervals that compose the ratio.
For example, with n = 3, the base is {2, 3, 5} (a 5-limit tuning, its fundamental intervals being octaves, fifths and thirds): <0,0,0>: 2^0, 3^0, 5^0 = 1/1
<-1, 1,0>: 2^{-1}, 3^1, 5^0 = 3/2
<-4, 4, -1>:2^{-4}, 3^4, 5^{-1} = 3^4/2^{4 \times 5} = 81/80
When created, HarmonicVectors calculate several representations of the interval. They are made from either ratios or directly as vectors. If the latter, it assumes that it is an octave reduced vector, that is, its first dimension is the prime 3 of fifths instead of 2, of octaves, which is calculated. This is called 'octave completion'. When creating HarmonicVectors from ratios, the full ratio is given and the octave reduced version is calculated.
A HarmonicVector has instance variables representing the interval both as a ratio and vector, plus the corresponding octave reduced versions. It also stores its pitch-distance magnitude (in cents), its several harmonic metrics and, for 7-limit configurations, its harmonic functions.
HarmonicVectors are the elements of a PitchSet. They are usefull for doing harmonic arithmetic and having multiple representations for a single harmonic interval. For more on harmonic space, see Tenney, J., "John Cage and the Theory of Harmony", 1983. https://www.plainsound.org/JTwork.html.
Makes an instance of HarmonicVector from an octave-reduced vector (whose starting prime is 3). A reduced interval is invariant with respect to octaves, corresponding to the psychoacoustic phenomenon of 'octave equivalence'. Ignoring octaves in harmonic arithmetic can be quite useful as fundamental intervals are considered independent of their register.
| reduced |
An array of powers of primes. The highest primes base defined is 43, far above what is musically useful. If nil is given as the argument, it returns an HarmonicVector of [0], which is the ratio 1/1. useful information: |
Makes an instance of HarmonicVector from a ratio.
| ratio |
The ratio should be in the form of a [p,q] array. |
See the helpfile for number extras. Example:
Magnitude of the vector in harmonic space. It is another kind of harmonic metric
Tenney's harmonic distance (see number extras and HarmonicMetric for more) of the interval.
Barlow's harmonicity of the interval (see number extras and HarmonicMetric for more). It is calculated from the complete, not the octave reduced ratio.
This method completes the octaves for a reduced ratio or vector. It is usually used under the hood when creating harmonic vectors.
Adding is an intervallic operation. The addition of two harmonic vectors is equivalent to the product of their ratios. The addition is performed on the vectors, not the ratios.
| that |
another harmonic vector. If both have different dimensions, they will be made of the same size before the operation. Example: |
Subtraction is performed on the vectors, it is equivalent to subtracting the intervals, that is, to dividing their ratios.
| that |
is another harmonic vector. If both have different dimensions, they will be made of the same size before the operation. Example: |
Experimental method, not sure what it means musically. It multiplies two vectors by multiplying each coordinate. This is not properly defined for vector spaces, so it be that as it may.
| that |
another harmonic vector. If both have different dimensions, they will be made of the same size before the operation. Example: |
The same as above, with the addition that the results of division are even more perplexing than those of multiplication. Many combinations produce Division by Zero errors.
| that |
another harmonic vector. If both have different dimensions, they will be made of the same size before the operation. Example: |
This one is useful: raising an interval to an integer power n means adding it to itself n number of times. If the scalar is real you can obtain interesting experimental results.
| scalar |
An integer, although you can obtain interesting experimental results with fractions. Example: |
Returns the cent value.
If true, returns the cent value of the reduced interval, otherwise the complete one.
This method returns a boolean stating whether the vector lies inside a periodicity block (as defined by a unisonmatrix). It is used by PitchSet to separate its intervals into timbral and harmonic ones. See its help file for more info.
This classvar is used for internal calculations. It is initialized up to prime 43 which is pretty much beyond human harmonic perception.
A harmonic vector has the following attributes:
The complete integer vector of that interval, including the dimension of 2. It is a vector class and not an array or a number.
The octave reduced vector, beginning from the dimension of prime 3.
The calculated ratio, it is not octave reduced.
The calculated octave reduced ratio.
This is used internally in calculations and corresponds to the ammount of octaves that have been reduced.
For making harmonic vectors from arrays, use the following added methods to Array:
A lengthier example:
The last field in the vector's string representation is its (Hugo) Riemann function, another way to represent the vector: D stands for dominant, d for subdominant (1/D), M & m for mediant and submediant and S,s for septimal and subseptimal, respectively. The numbers next to them denote the number of times they are stacked. For example, the wolf fifth is a 3d2m, i.e. a triple subdominant double submediant: 3 inverse fifths plus 2 inverse thirds (C-F-Bb-Eb--Cb-Abb, so the interval is really a lowered sixth, not a fifth!)
Another example. Finding commas, execute line by line: