get

Scale# get

A collection of functions manipulates the scale and returns diverse information about it

Methods

# (static) area(ropt) → {Number}

Returns the area of the polygon created by the nodes of the set on the bracelet. With radius left to its default value, the area of the entire bracelet is 1, so this function will return a value between 0 to 1.

Parameters:
Name Type Attributes Default Description
r Number <optional>
0.56418958354776

The radius of the circle/bracelet. The default value is the radius of a circle with area=1

Source:
See:
  • EDO#get.area
Returns:

The area of the polygon. with the default settings if also conveys the percentage of the circle being occupied. (0=0% - 1=100%)

Type
Number
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,1,2,3,4,5,6,7,8,9,10,11]) //chromatic scale
scale.get.coordinates() //returns 0.9549296585513847

scale = edo.scale([0,4,7]) //major triad
scale.get.area() //returns 0.376564638493296

# (static) chord_quality_from_shape(shape, scale_degreeopt) → {Array.<Number>}

Returns the pitch classes of a chord "shape" on a given scale degree.

for instance, in the C major scale, the shape 1,2,3,5 on 1 gives C D E G, and starting on 2, gives D E F A.

Remark: "pitch classes" conform to the current tuning system used. E.g., 0-11 in 12EDO, 0-16 in 17EDO, etc.

Parameters:
Name Type Attributes Default Description
shape Array.<Number>

The "shape" starting from 1.

scale_degree Number <optional>
1

The scale degree on which to apply the shape (starting from 1)

Source:
Returns:
  • The resultant pitch classes from that shape on that scale degree.
Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
let scale = edo.scale([0,2,4,5,7,9,11])
scale.get.chord_quality_from_shape([1,5,6],1)
//returns [0, 7, 9]

scale.get.chord_quality_from_shape([1,3,4,5,7],7)
//returns [11, 2, 4, 5, 9]

scale.get.chord_quality_from_shape([1,7,3,13,9],5) //Get a 7,9,13 (no 5) chord, on scale degree 5, in this specific voicing.

# (static) coherence_quotient()

Returns the coherence quotient according to Carey (2007) (see citation)

Source:
See:
  • Carey, N. (2007). "Coherence and sameness in well-formed and pairwise well-formed scales." Journal of Mathematics and Music 1(2): 79-98.
Returns:

Number

Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //The pentatonic scale
scale.get.coherence_quotient() //returns 1

# (static) common_tone_transpositions(normalizeopt) → {Array.<Array.<Number>, Number>}

Returns all the transpositions of the scale that are constructed on the scale degrees of the original scale, As well the the number of notes altered to get from the original scale to the new scale as a "Tuple"

Parameters:
Name Type Attributes Default Description
normalize Boolean <optional>
true

when true, all of the transpositions will be constructed by altering the original scale

Source:
Returns:

An array containing all of the stacks

Type
Array.<Array.<Number>, Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,3,7]) //minor triad
scale.get.common_tone_transpositions()
//returns

[
 [ [ 0, 3, 7 ], 0 ],
 [ [ 0, 4, 9 ], 2 ],
 [ [ 0, 5, 8 ], 2 ],
 [ [ 3, 6, 10 ], 2 ],
 [ [ 3, 8, 11 ], 2 ],
 [ [ 2, 7, 10 ], 2 ],
 [ [ 4, 7, 11 ], 2 ]
]

# (static) complement(from_0opt) → {Array.<Number>}

Returns all the pitch-classes (of the current tuning system) that the scale does not use.

Remark: "pitch classes" conform to the current tuning system used. E.g., 0-11 in 12EDO, 0-16 in 17EDO, etc.

Parameters:
Name Type Attributes Default Description
from_0 boolean <optional>
false

when true, the output will be normalized to 0.

Source:
Returns:
Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
let scale = edo.scale([0,2,4,5,7,9,11])
scale.get.complement()
//returns [1, 3, 6, 8, 10]

scale.get.complement(true)
//returns [0, 2, 5, 7, 9]

# (static) coordinates(circle_centeropt, ropt) → {Array.<Array.<Number, Number>>}

Returns the [x,y] coordinates of the nodes of the scale.

Parameters:
Name Type Attributes Default Description
circle_center Array.<Number> <optional>
[0,0]

The center of the circle

r Number <optional>
0.56418958354776

The radius of the circle. By default the radius is of a circle with area=1

Source:
Returns:

An array with tuples each corresponding to the x,y position of every pitch

Type
Array.<Array.<Number, Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,3,7]) //minor triad
scale.get.coordinates()
//returns [
 [00.56418958354776]
 [0.564189583547763.454664838020213e-17]
 [-0.2820947917738801-0.48860251190292314]
]

# (static) diagnostic_intervals() → {Array.<Number>}

Returns the (specific) intervals that only occur once in the set.

For instance, in the diatonic set (0 2 4 5 7 9 11) an interval of 6 semitones only occurs once (between 5 and 11). It is therefore a "diagnostic" interval within the diatonic scale.

Source:
See:
  • EDO#get.diagnostic_intervals
Returns:

An array containing all diagnostic intervals (or an empty array if none are available)

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //The diatonic set
scale.get.diagnostic_intervals() //returns [6]

# (static) generic_intervals(generic_interval_size-) → {Array.<Object>}

Given a generic interval ("scale degrees apart") returns all of the specific intervals.

Parameters:
Name Type Description
generic_interval_size- Number

The generic interval

Source:
See:
  • Rahn, J. (1991). "Coordination of interval sizes in seven-tone collections." Journal of Music Theory 35(1/2): 33-60.
  • Scale#get.specific_intervals
Returns:
Type
Array.<Object>
Example
let edo = new EDO(12) // define a tuning system
let scale = edo.scale([0,2,4,5,7,9,11])
scale.get.generic_intervals(3) //3 scale-degrees apart (e.g 4ths)
//returns
[
 {"generic":3,"specific":5,"pitches":[[0,5],[2,7],[4,9],[7,0],[9,2],[11,4]],"instances":6},
 {"generic":3,"specific":6,"pitches":[[5,11]],"instances":1}
]

# (static) interval_class(PC1, PC2) → {Array.<Number>}

Returns the interval between two pitch classes.

Remark: "pitch classes" conform to the current tuning system used. E.g., 0-11 in 12EDO, 0-16 in 17EDO, etc.

Parameters:
Name Type Description
PC1 Number

The first pitch class

PC2 Number

The second pitch class

Source:
Returns:
Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
edo.get.interval_class(1,8) //returns 5

# (static) interval_vector(cache) → {Array.<Number>}

Returns the interval vector of the scale.

Parameters:
Name Type Description
cache Boolean

When true, the result will be cached for faster retrieval

Source:
Returns:

An array representing the vector

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.interval_vector() //returns [ 1, 5, 2, 3, 3, 1 ]

# (static) inversion(cacheopt) → {Array.<Number>}

Returns the scale's inversion

Parameters:
Name Type Attributes Default Description
cache Boolean <optional>
false

When true, the result will be cached for future retrieval

Source:
Returns:

the inverted pitches

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.inversion() //returns [0, 2, 4, 6, 7, 9, 11]

# (static) least_step_multiplier() → {Number}

Returns the smallest multiplier between the sizes of steps

Source:
Returns:

The step sizes

Type
Number
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,1,4,5,7,8,11]) //define scale with 3 kinds of steps (1,2, and 3)
scale.get.least_step_multiplier()
//returns 1.5
//2 is a multiplier of 2 over 1. 3 is a multiplier of 3 over one and 1.5 over two.
//Therefore, the function will return 1.5.

# (static) lerdahl_attraction(note1, note2) → {Number}

Calculates the attraction between note1 to note2 according to Lerdahl's formula in TPS

Parameters:
Name Type Description
note1 Number

The first pitch-class

note2 Number

The second pitch-class

Source:
See:
  • Lerdahl, F. (2004). Tonal pitch space, Oxford University Press.
Returns:

The value of attraction between note1 and note2

Type
Number
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.lerdahl_attraction(1,0) //returns 4

# (static) lerdahl_attraction_vector() → {Array.<String>}

Returns a graphic vector showing the tendencies of each note in the scale

Source:
See:
  • Scale.get.lerdahl_attraction()
  • Lerdahl, F. (2004). Tonal pitch space, Oxford University Press.
Returns:

The attraction vector

Type
Array.<String>
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.lerdahl_attraction_vector() //returns [*,<>,*,<>,*,<<,>>]

# (static) levenshtein(t, ratio_calcopt) → {Number}

Returns the Levenshtein distance of the scale to another scale

Parameters:
Name Type Attributes Default Description
t Array.<Number>

Some collection of pitches to perferm the comparison with

ratio_calc Boolean <optional>
false

When true, the function computes the levenshtein distance ratio of similarity between two strings

Source:
Returns:
Type
Number
Examples
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //a major pentatonic scale
scale.get.levenshtein([0,2,4,5,7,9,11]) //returns 2
scale.get.levenshtein([0,2,4,5,7,9,11],true) //returns 0.9230769230769231

# (static) melody_from_intervals(intervals, starting_scale_degreeopt, starting_pitchopt) → {Array.<Number>}

Returns a melody by providing a list of generic intervals to traverse within the scale.

Parameters:
Name Type Attributes Default Description
intervals Array.<Number>

A list of generic intervals (how many scale degrees away from current)

starting_scale_degree Number <optional>
1

The first note of the melody

starting_pitch Number <optional>
0

The first pitch of the melody

Source:
Returns:
  • The a diatonic melody
Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
let scale = edo.scale([0,2,4,5,7,9,11]) //major
scale.get.melody_from_intervals([7,-1,-2,1,1,1,-7,5,-1,-6,5,-1]) //Over the rainbow
//returns [0, 12, 11, 7,  9, 11, 12,  0,  9, 7, -3,  5, 4]

# (static) modes(cache) → {Array.<Array.<Number>>}

Returns all the various modes (normalized to 0, that include all pitches) available from this scale

Parameters:
Name Type Description
cache Boolean

When true, the result will be cached for faster retrieval

Source:
Returns:

An array of the different modes

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.modes()
//returns
[
 [ 0, 2, 4, 7, 9 ],
 [ 0, 2, 5, 7, 10 ],
 [ 0, 3, 5, 8, 10 ],
 [ 0, 2, 5, 7, 9 ],
 [ 0, 3, 5, 7, 10 ]
]

# (static) motives_diatonic(melody, allow_skipsopt) → {Array.<motive>}

Same as EDO.get.motives() only instead of considering pitches as pitch classes, it looks at them as scale degrees.

As such, in the scale [0,2,4,5,7,9,11], [0,2,4] and [2,4,5] are considered the same motive This is because while the former has steps of size [2,2] and the latter [2,1] they both represent moving 2 scale degrees up step wise in the scale [1,1].

Parameters:
Name Type Attributes Default Description
melody Array.<Number>

a collection of pitches to find (in order)

allow_skips Boolean <optional>
true

if false, the search will only be done on consecutive items

Source:
Returns:
Type
Array.<motive>
Example
let edo = new EDO(12) // define a tuning system
let melody = [8,7,7,8,7,7,8,7,7,15,15,14,12,12,10,8,8,7,5,5] // Mozart Symphony no. 40
let scale = edo.scale([0,2,3,5,7,8,10]) //natural minor
scale.get.motives_diatonic(melody) // find diatonic motives in the melody
                     .slice(0,3) //show top 3
//returns (motives are represented in change in scale degrees)
[
 { motive: [ 0 ], incidence: 9 },
 { motive: [ -1 ], incidence: 6 },
 { motive: [ -1, 0 ], incidence: 5 }
]

# (static) n_chords(n, normalizeopt, cacheopt) → {Array.<Number>}

Returns every n_chord (bichord (n=2), trichord (n=3), tetrachord (n=4), etc.) available in this scale

Parameters:
Name Type Attributes Default Description
n Number

Number of pitches in every chord

normalize Boolean <optional>
true

When true, the function will return n_chords in normal order. otherwise it will return them as they appear in the scale

cache Boolean <optional>
false

When true, the result will be cached for faster retrieval

Source:
Returns:

An array containing all n_chords

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.n_chords(3) //same as scale.get.trichords()
[
 [ 0, 2, 4 ],
 [ 0, 2, 7 ],
 [ 0, 3, 5 ],
 [ 0, 4, 7 ],
 [ 0, 3, 7 ],
 [ 0, 2, 5 ]
]

# (static) n_chords_diatonic(n) → {Array.<steps_quality_obj>}

Return every quality available in the scale for a combination of n scale degrees.

Parameters:
Name Type Description
n Number

Number of pitches in every chord

Source:
Returns:
Type
Array.<steps_quality_obj>

# (static) name()

The name of the scale in the form EDO-Code, EDO being the number of divisions of the octave in the current system, and code being the binary value of the scale (see example below).

For simplicity consider a system with 4 divisions. Such a system has 4 possible pitches: [0,1,2,3].
The scale vector is a binary representation of the pitch-classes used in the scale in reversed order. So the scale [0,2] would have a representation of: [0,1,0,1]
As such, the name for this scale will be 4-5

Source:

# (static) neighborhood(sizeopt, alterationsopt, normalizeopt, maintain_cardinalityopt) → {Array.<Number>}

Returns all of the sets whose constituents are at most size away from the original constituent, where no more than alterations constituents were altered.

Parameters:
Name Type Attributes Default Description
size Number <optional>
1

Maximal alteration size (e.g. if 2, 3 can be altered into 2, 1, 4, or 5)

alterations Number <optional>
1

Maximal number of constituents that can be altered.

normalize Boolean <optional>
true

When true, the function will return the sets in normal order.

maintain_cardinality Boolean <optional>
true

When true, the function will only return sets that have the same number of pitches as the original set.

Source:
Returns:

An array containing all neighboring sets

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,4,7])
scale.get.neighborhood() //returns
[
 [ 0, 3, 6 ],
 [ 0, 3, 7 ],
 [ 0, 2, 7 ],
 [ 0, 4, 8 ],
 [ 0, 4, 6 ]
]

# (static) normal_order(cacheopt) → {Array.<Number>}

Returns the scale's pitches in normal order

Parameters:
Name Type Attributes Default Description
cache Boolean <optional>
false

When true, the result will be cached for future retrieval

Source:
Returns:

The pitches in normal order

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.normal_order() //returns [0, 1, 3, 5, 6, 8, 10]

# (static) pairwise_generic_specific_intervals(SD1, SD2) → {Array.<Number>}

Returns the generic and specific intervals for a pair of scale degrees

Parameters:
Name Type Description
SD1 Number

The first scale degree

SD2 Number

The second scale degree

Source:
Returns:
Type
Array.<Number>
Example
* @see Rahn, J. (1991). "Coordination of interval sizes in seven-tone collections." Journal of Music Theory 35(1/2): 33-60.

# (static) per_note_set_difference(setopt) → {Object}

Returns a vector indicating the delta between two different sets of the same cardinality.

Parameters:
Name Type Attributes Default Description
set Array.<Number> <optional>
[0,2,4,5,7,9,11]

The set the current scale is compared to

Source:
Returns:
Type
Object
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,8,10])
scale.get.per_note_set_difference() //returns [0, 0, 0, 0, 0, 1, 1]

# (static) permutations() → {Array.<Array.<Number>>}

Returns every ordering (permutation) of notes in the scale

Uses EDO.get.permutations()

Source:
Returns:

The permutations of the scale

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,3,7]) //minor triad
scale.get.permutations()
//returns
[
 [ 0, 4, 7 ],
 [ 0, 7, 4 ],
 [ 4, 0, 7 ],
 [ 4, 7, 0 ],
 [ 7, 0, 4 ],
 [ 7, 4, 0 ]
]

# (static) pitches() → {Array.<Number>}

Returns the scale's pitches as pitch classes

Remark: "pitch classes" conform to the current tuning system used. E.g., 0-11 in 12EDO, 0-16 in 17EDO, etc.

Source:
Returns:

The scale's pitches as pitch-classes

Type
Array.<Number>

# (static) position_of_quality() → {Array.<Number>}

Gets a list of intervallic units above a root, and returns all the positions in the scale where this chord quality can be created

Remark: "intervallic units" conform to the current tuning system used. E.g., 0-11 occupy 1 octave in 12EDO, 0-16 in 17EDO, etc.

Source:
Returns:

The pitch-classes (that appear in the scale) on which the quality can be built

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.position_of_quality([4,7]) (a major triad)
//returns [0,5,7] because you can construct a major triad on 0, 5, and 7

# (static) prime_form(cacheopt) → {Array.<Number>}

Returns the scale's pitches in prime form

(Notice, the prime form calculation conforms to Rahn's prime form rather than Forte's)
Parameters:
Name Type Attributes Default Description
cache Boolean <optional>
false

When true, the result will be cached for future retrieval

Source:
Returns:

The pitches in prime form

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.prime_form() //returns [0, 1, 3, 5, 6, 8, 10]

# (static) product(multiplier, sortopt) → {Array.<Number>}

Returns the scale's pitches in prime form

Parameters:
Name Type Attributes Default Description
multiplier Number

The number by which to multiply the set

sort Boolean <optional>
false

When true, the returned result will be sorted

Source:
Returns:

The pitches after multiplication

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.product(2) //returns [ 0, 4, 8, 2, 6 ]
scale.get.product(5,true) //returns [ 0, 8, 9, 10, 11 ]

# (static) quality_with_intervals(intervals, length) → {Array.<Number>}

Returns note combination of a given length who are restricted to only using specified intervals that are members of the scale

Parameters:
Name Type Description
intervals Array.<Number>

A list of allowed intervals

length Number

The length of the returned combinations. If not specific length will default to the length of the scale

Source:
Returns:

The pitches after multiplication "intervals" conform to the current tuning system used. 0-11 occupy 1 octave in 12EDO, 0-16 in 17EDO, etc.

Type
Array.<Number>

# (static) resize_melody(melody, resize_by, methodopt) → {Array.<Number>}

Expends / contracts the intervals between pitches of a melody.

Parameters:
Name Type Attributes Default Description
melody Array.<Number>

The melody to be modified

resize_by Number

The amount by which the melody will be modified (can be positive/negative/fraction)

method String <optional>
"multiply"

"add" to add resize by to any interval. "multiply" to multiply the intervals by the value.

Source:
Returns:
Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
edo.get.resize_melody([0,2,4,5,7,5,4,2,-1,0],2)
//returns [0, 4, 8, 10, 14, 10, 8, 4, -2, 0]

edo.get.resize_melody([0,2,4,5,7,5,4,2,-1,0],-1)
//[0,-2,-4,-5,-7,-5,-4,-2,1,0]

edo.get.resize_melody([0,2,4,5,7,5,4,2,-1,0],-1,method='add')
//returns
[0,1,2,2,3,2,2,1,-1,-1]

# (static) rotations() → {Array.<Array.<Number>>}

Returns all of the rotations of the scale (not normalized to 0).

To get the rotations normalized to zero (the modes) use Scale.get.modes()

Source:
Returns:

The rotations of the scale

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,3,7]) //minor triad
scale.get.rotations()
//returns [[0,3,7],[3,7,0],[7,0,3]]

# (static) rothenberg_propriety(cacheopt) → {'strictly proper'|'proper'|'improper'}

Returns the Rothenberg Propriety value for this scale

Parameters:
Name Type Attributes Default Description
cache Boolean <optional>
false

When true, the result will be cached for future retrieval.

Source:
See:
  • Rothenberg, D. (1977). "A model for pattern perception with musical applications part I: Pitch structures as order-preserving maps." Mathematical Systems Theory 11(1): 199-234.
Returns:

The step sizes

Type
'strictly proper' | 'proper' | 'improper'
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //a major pentatonic scale
scale.get.rothenberg_propriety()
//returns "strictly proper"

# (static) roughness(all_modesopt, base_freqopt)

Returns the sum of the roughness of every pair in the set in a certain mode or averaged across all modes

Parameters:
Name Type Attributes Default Description
all_modes Boolean <optional>
false

When true, the algorithm returns the roughness value for all of the modes

base_freq Number <optional>
440

The frequency to associate with the pitch-class 0

Source:
See:
  • EDO#get.sine_pair_dissonance
Returns:

Number

Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //a major pentatonic scale
scale.get.roughness()
//returns 0.21543265646088483

# (static) sameness_quotient()

Returns the sameness quotient according to Carey (2007) (see citation)

Source:
See:
  • Carey, N. (2007). "Coherence and sameness in well-formed and pairwise well-formed scales." Journal of Mathematics and Music 1(2): 79-98.
Returns:

Number

Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,6,8,10]) //a whole-tone scale
scale.get.sameness_quotient() //returns 1

scale = edo.scale([0,2,4,5,7,9,11]) //the diatonic scale
scale.get.sameness_quotient() //returns 0.5555555555555556

# (static) scale_degree_roles(interval_mapopt) → {Array.<Array.<Number>>}

Returns every possible interpretation of the scale's intervals in terms of their possible scale degree

Parameters:
Name Type Attributes Description
interval_map Object <optional>

a map of every interval and the role it can play in the scale (for instance PC6 in 12EDO can be both an augmented 4th and a diminished 5th. see code for clarity). This paramater must be passed in EDO systems other than 12.

Source:
Returns:

An array containing every interpretation of the scale degrees.

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.scale_degree_roles()
//returns [ [ 1, 2, 3, 5, 6 ] ] (the last note can be interpreted as a major 6th, or a diminished 7th)

# (static) scale_degree_transpositions(normalizeopt) → {Array.<Array.<Number>, Number>}

Returns all the transpositions of the scale that are constructed on the scale degrees of the original scale, As well the the number of notes altered to get from the original scale to the new scale as a "Tuple"

Parameters:
Name Type Attributes Default Description
normalize Boolean <optional>
true

when true, all of the transpositions will be constructed by altering the original scale

Source:
Returns:

An array containing all of the stacks

Type
Array.<Array.<Number>, Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.scale_degree_transpositions()
//returns

[
 [ [0, 2, 4, 5, 7, 9, 11], 0 ],
 [ [0, 2, 4, 5, 7, 9, 10], 1 ],
 [ [0, 2, 4, 6, 7, 9, 11], 1 ],
 [ [1, 2, 4, 6, 7, 9, 11], 2 ],
 [ [1, 2, 4, 6, 8, 9, 11], 3 ],
 [ [1, 3, 4, 6, 8, 9, 11], 4 ],
 [ [1, 3, 4, 6, 8, 10, 11], 5 ]
]

# (static) segments() → {Array.<Array.<Number>>}

Returns the scale as steps, broken to their repetitive segments.

Source:
Returns:

An array containing the scale's steps in segments

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.segments()
//returns [[2,2],[1],[2,2,2],[1]]

# (static) sequence_transposition(seq, transposition) → {Array.<Number>}

Transposes a melody within the scale by a given number of scale degrees

Parameters:
Name Type Description
seq Array.<Number>

The original melody / sequence to be "transposed"

transposition Number

The number of scale degrees (up or down) by which to shift the melody.

Source:
Returns:

The transposed pitches

Type
Array.<Number>
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //a major pentatonic scale
scale.get.sequence_transposition([0,2,4],1) //returns [ 2, 4, 7 ]

# (static) set_difference(setopt, consider_all_modesopt, valid_diviations_maxopt) → {Object}

Returns the difference between the current scale and a given set.

Parameters:
Name Type Attributes Default Description
set Array.<Number> <optional>
[0,2,4,5,7,9,11]

The set the current scale is compared to

consider_all_modes Boolean <optional>
false

Indicates whether the algorithm should consider every possible mode of the current scale to assess which is closest to the comparison set, or whether it should only consider the current set in its current mode.

valid_diviations_max Number <optional>
1

The maximal amount each constituent can be "altered" to still be considered a "valid" alteration of the comparison set.

Source:
Returns:
Type
Object
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,8,10]) //
scale.get.set_difference() //returns
{
 valid: true, //Whether it's a valid alteration of the comparison set or not
 alterations: 2, //The amount of pitches that were altered between the sets
 delta: [0, 0, 0, 0, 0, -1, -1], //The alteration vector
 mode: [0, 2, 4, 5, 7, 8, 10] // The mode of the scale that was used
}

# (static) shortest_path(destination_scale_degree, up_steps, down_steps)

Same as EDO.get.shortest_path() but for diatonic cases.

Instead of thinking in "intervals" it thinks in steps and scale degrees. so in the context of C major, moving from E to G is a move of size 3 (scale degrees), and from C to E is also 3 (scale degrees) even though in one case it's a minor third and in the other its a Major third.

     <p>In this function the starting point is scale_degree 1</p>
Parameters:
Name Type Description
destination_scale_degree Number
up_steps Number
down_steps Number
Source:

# (static) sine_pair_dissonance(freq1, freq2, amp1opt, amp2opt) → {Number}

Returns the ROUGHNESS OF SINE-PAIRS based on algorithm from Vassilakis, 2001 & 2005 .

Parameters:
Name Type Attributes Default Description
freq1 Number

the frequency of the 1st sine

freq2 Number

the frequency of the 2nd sine

amp1 Number <optional>
1

the amplitude of the 1st sine

amp2 Number <optional>
1

the amplitude of the 2nd sine

Source:
See:
  • http://www.acousticslab.org/learnmoresra/moremodel.html
  • Vassilakis, P. (2001). "Auditory roughness estimation of complex spectra—Roughness degrees and dissonance ratings of harmonic intervals revisited." The journal of the Acoustical Society of America 110(5): 2755-2755.
Returns:
Type
Number
Example
edo.get.sine_pair_dissonance(440,475) //returns 0.08595492117939352

# (static) specific_intervals(specific_interval_size-) → {Array.<Object>}

Given a specific interval (in semitones or whatever the smallest division is) returns all of the generic intervals.

Parameters:
Name Type Description
specific_interval_size- Number

The specific interval size (in semitones or whatever the smallest division is)

Source:
See:
  • Rahn, J. (1991). "Coordination of interval sizes in seven-tone collections." Journal of Music Theory 35(1/2): 33-60.
  • Scale#get.generic_intervals
Returns:
Type
Array.<Object>
Example
let edo = new EDO(12) // define a tuning system
let scale = edo.scale([0,2,4,5,7,9,11])
scale.get.specific_intervals(6)
//returns
[
 {"generic":"3","specific":6,"pitches":[[5,11]],"instances":1},
 {"generic":"4","specific":6,"pitches":[[11,5]],"instances":1}
]

# (static) stacks(levels, skip) → {Array.<Array.<Number>>}

Returns a list of lists of size "levels" made out of scale degrees with "skip" steps skipped apart.

Parameters:
Name Type Description
levels Number

The number of levels to the stack

skip Number

The number of scale steps to skip between each level on the stack

Source:
Returns:

An array containing all of the stacks

Type
Array.<Array.<Number>>
Examples
[0,2,4,5,7,9,11] in 12-TET Scale.get.stacks(3,1)
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.stacks(3,1) //get all tercial stacks of 3
//returns [[0, 3, 6], [0, 3, 7], [0, 4, 7]]

scale.get.stacks(5,2) //get all quartal stacks of 5
//returns
[
 [ 0, 5, 11, 4, 9 ],
 [ 0, 5, 10, 3, 9 ],
 [ 0, 5, 10, 3, 8 ],
 [ 0, 6, 11, 4, 9 ],
 [ 0, 5, 10, 4, 9 ]
]

# (static) step_sizes() → {Array.<Number>}

Returns a list of unique step sizes that appear in the scale.

Source:
Returns:

The step sizes

Type
Array.<Number>
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.step_sizes()
//returns [1,2]

# (static) steps_to_qualities(steps) → {quality_position_obj}

from a given array of steps taken, returns all of the available qualities and their positions

Parameters:
Name Type Description
steps Array.<Number>

steps in the scale in the form of [1,1,2,1..] (1=one step, 2= two steps, etc)

Source:
Returns:

The step sizes

Type
quality_position_obj
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,5,7,9,11]) //major scale
scale.get.steps_to_qualities([1,1]) //two successive steps
//returns
 {
     "steps":[1,1],
     "combos":[
         {"quality":[0,2,4],"positions":[0,5,7]},
         {"quality":[0,2,3],"positions":[2,9]},
         {"quality":[0,1,3],"positions":[4,11]}
         ]
 }

# (static) supersets(scales) → {Array.<Array.<Number>>}

Returns the sets that the scale is contained in from a given list of sets

Parameters:
Name Type Description
scales Array.<Array.<Number>>

a list of scales

Source:
Returns:

the scales that contain the Scale object

Type
Array.<Array.<Number>>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,3,7]) //minor triad
scale.get.supersets([[0,1,2,3,4,5,6,7],[0,3,4,7],[0,1,2]])
//returns [[0,1,2,3,4,5,6,7],[0,3,4,7]]

# (static) tetrachords(cache) → {Array.<Number>}

Returns every tetrachord (normalized to 0) available in this scale

Note: for a collection of all pitch subsets of length n (rather than 4) use Scale.get.n_chords()

Parameters:
Name Type Description
cache Boolean

When true, the result will be cached for faster retrieval

Source:
Returns:

An array containing all tetrachords

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.tetrachords()
//returns [ [ 0, 2, 4, 7 ], [ 0, 3, 5, 7 ], [ 0, 2, 5, 7 ], [ 0, 3, 5, 8 ] ]

# (static) transposition(amount) → {Array.<Number>}

Returns the scale's pitches transposed by a certain amount

Parameters:
Name Type Description
amount Number

The amount by which to transpose the pitches

Source:
Returns:

The transposed pitches

Type
Array.<Number>
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,7,9]) //a major pentatonic scale
scale.get.transposition(5) //returns [ 5, 7, 9, 0, 2 ]

# (static) transpositions_with_pitches(pitches) → {Array.<Object>}

Returns the transpositions of the scale that include the given pitches verbatim.

Parameters:
Name Type Description
pitches Array.<Number>

The pitches to find

Source:
Returns:
  • The property 'pitches' includes the pitches of the transposition. The property 'common_tones' tallies how many pitches the original scale and the transposed scale have in common..
Type
Array.<Object>
Example
let edo = new EDO(12) //define tuning
let scale = edo.scale([0,2,4,5,5,9,11]) //a major scale
scale.get.transpositions_with_pitches(1,4,8)
[
 {pitches: [9,11,1,2,4,6,8], alterations: 4}, //The transposition starting on 9 contains 1,4,8 verbatim. It has 4 tones in common with the original scale.
 {pitches: [4,6,8,9,11,1,3], alterations: 3}, //The transposition starting on 4 ... It has 3 tones in common...
 {pitches: [11,1,3,4,6,8,10], alterations: 2} //The transposition starting on 11 ... It has 2 tones in common...
]

# (static) trichords(cache) → {Array.<Number>}

Returns every trichord (normalized to 0) available in this scale

Note: for a collection of all pitch subsets of length n (rather than 3) use Scale.get.n_chords()

Parameters:
Name Type Description
cache Boolean

When true, the result will be cached for faster retrieval

Source:
Returns:

An array containing all trichords

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,7,9]) //pentatonic scale
scale.get.trichords()
//returns
[
 [ 0, 2, 4 ],
 [ 0, 2, 7 ],
 [ 0, 3, 5 ],
 [ 0, 4, 7 ],
 [ 0, 3, 7 ],
 [ 0, 2, 5 ]
]

# (static) without(to_remove, normalopt) → {Array.<Number>}

Returns the scale without the pitches in to_remove array

Parameters:
Name Type Attributes Default Description
to_remove Array.<Number>

The pitches to be removed from the original scale

normal Boolean <optional>
false

When true, the returned array will be in normal order.

Source:
Returns:

An array containing the original scale with pitches to_remove removed.

Type
Array.<Number>
Example
let edo = new EDO(12) //define context
let scale = edo.scale([0,2,4,5,7,9,11])
scale.get.without([5,11]) //returns [0,2,4,7,9]