count

EDO# count

A collection of functions that return an amount

Methods

# (static) common_tones(list1, list2) → {Number}

Returns the number of commons tones between two collections of pitches

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

Parameters:
Name Type Description
list1 Array.<Number>

a collection of pitches (not necessarily pitch classes)

list2 Array.<Number>

a collection of pitches (not necessarily pitch classes)

Source:
Returns:

The number of common tones between the two lists

Type
Number
Example
let edo = new EDO(12) // define a tuning system
edo.count.common_tones([1,2,4],[2,3,4,5])
//returns 2 (because 2 and 4 are in both lists)

# (static) differences() → {Number}

From a list of arrays passed to the function, returns the number of differences between each array and its following neighbor.

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

As many arrays as needed.

Source:
Returns:

The number of differences between neighboring arrays

Type
Number
Example
let edo = new EDO()
edo.count.differences([0,2,3],[0,1,2],[0,2,4],[0,2,1,1,1])
// returns [2,2,3] (2 differences between the 1st and 2nd arrays, 2 diffs between the 2nd and 3rd, and 3 diffs between the 3rd and 4th.)

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

Returns the pitch and the number of its occurrences as a tuple for every unique value in pitches

Parameters:
Name Type Description
pitches Array.<Number>

a collection of pitches (not necessarily pitch classes)

Source:
Returns:

A pitch, and how many times it appears

Type
Array.<Number>
Example
let edo = new EDO(12) // define a tuning system
edo.count.pitches([0, 3, 3, 2, 4, 3, 4])
// returns [[3,3],[4,2], [2,1], [0,1]] (3 appears 3 times, 4 appears 2 times, etc.)