Defines a Tonality as a pari of arrays of notes and chords with methods to get harmonic function I, II, III, IV, V, VI, VII etc.
Part of superharmony, a library with utilities for tonal analysis of chords.
Creates a new Tonality instance with a base note integer and a string type. "M" major = [0,2,4,5,7,9,11], "m" harmonic minor = [0, 2, 3, 5, 7, 8, 11] Can be called with the shorthand notation
Base of the scale as in integer value | |
Type of the scale, currently only major "M" and harmonic minor "m" are supported. |
Converts string degree to integer value.
String with the value of degree. |
Integer with degree value, from 0 to 6.
A origin harmony and a target harmony, this function returns an harmony equivalent to the "target" that is closest to the "origin" harmony using the Manhattan metric (taxicab metric).
Origin Harmony | |
Target Harmony |
A harmony equivalent to target harmony closest to Origin Harmony
Checks the percentage (value from 0 to 1), of notes in an array that are part of the current tonality.
Array of interger values. |
Float value with range 0.0 to 1.0 representing the percentage of notes present in the tonality
Returns the harmony/chord associated with the corresponding scale degree in roman numeral.
String degree, values can be I,II,III,IV,V,VI,VII and seventh chords I7,II7,III7,IV7,V7,VI7,VII7. The value is case insensitive, so I gives the same result as i. |
A Harmony with the corresponding tonal function is the input is value, nil if the input was invalid
Returns the harmony/chord triad or seventh associated with the corresponding scale degree in numeric value (0-6).
Integer degree, values can be 0 to 6. | |
String to indicate if triad "3" or seventh "7" chord. |
A Harmony with the corresponding tonal function is the input is value, nil if the input was invalid
Returns the harmony/chord seventh associated with the corresponding scale degree in numeric value (0-6).
Integer degree, values can be 0 to 6. |
A seventh Harmony with the corresponding tonal function is the input is value, nil if the input was invalid
Returns the harmony/chord triad associated with the corresponding scale degree in numeric value (0-6).
Integer degree, values can be 0 to 6. |
A seventh Harmony with the corresponding tonal function is the input is value, nil if the input was invalid.
Returns the type of seventh chord from an integer scale degree.
Integer degree, values can be 0 to 6. |
A string with the type of seventh chord.
Returns the type of triad chord from an integer scale degree.
Integer degree, values can be 0 to 6. |
A string with the type of triad chord.
Checks if a list of notes belongs to the tonality, true if all notes belong to the tonality, false if at least one note is not part of the tonality.
List of integers. |
Boolean value, true if all notes belong to the tonality, false if at least one note is not part of the tonality.
Checks if a note belongs in the tonality.
Integer value |
Boolean value, true if note belongs to the tonality, false if its not part of the tonality.
Returns an integeger degree from the note numerical value, returns -1 if number is not part of the scale.
Integer value with numeric note. |
Integer value with degree value 0 to 6, and -1 if it does not belong.
Notes that are part of the tonality.
List of integers with tonality values in degree order.
From a harmony, returns a list of the closest chords in the tonality to the reference ordered.
Harmony of reference. |
List of distance and Harmony, [distance,Harmony] closest to the reference that belongs to the tonality, ordered by distance.
Integer value with base of the chord 0-6.
String value with the type of the scale "M" for major and "m" for minor.
Creating a Tonalyt
Cristian Banuelos, 2022.