IntervalConstructor
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:13
Musical Interval Constructor Class Handles equal temperament, just intonation, and Pythagorean tuning systems
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new IntervalConstructor():
IntervalConstructor
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:14
Returns
Section titled “Returns”IntervalConstructor
Properties
Section titled “Properties”_cache
Section titled “_cache”_cache:
Map<any,any>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:16
COMMON_INTERVALS
Section titled “COMMON_INTERVALS”COMMON_INTERVALS:
object
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:19
major_second
Section titled “major_second”major_second:
number
major_seventh
Section titled “major_seventh”major_seventh:
number
major_sixth
Section titled “major_sixth”major_sixth:
number
major_third
Section titled “major_third”major_third:
number
minor_second
Section titled “minor_second”minor_second:
number
minor_seventh
Section titled “minor_seventh”minor_seventh:
number
minor_sixth
Section titled “minor_sixth”minor_sixth:
number
minor_third
Section titled “minor_third”minor_third:
number
octave
Section titled “octave”octave:
number=2.0
perfect_fifth
Section titled “perfect_fifth”perfect_fifth:
number
perfect_fourth
Section titled “perfect_fourth”perfect_fourth:
number
tritone
Section titled “tritone”tritone:
number
unison
Section titled “unison”unison:
number=1.0
Methods
Section titled “Methods”_vectorsEqual()
Section titled “_vectorsEqual()”_vectorsEqual(
a,b):any
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:466
Parameters
Section titled “Parameters”any
any
Returns
Section titled “Returns”any
analyzeInterval()
Section titled “analyzeInterval()”analyzeInterval(
ratio):any
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:507
Analyze interval quality (consonance/dissonance)
Parameters
Section titled “Parameters”number
Interval ratio
Returns
Section titled “Returns”any
Analysis result
centsToRatios()
Section titled “centsToRatios()”centsToRatios(
cents):Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:484
Convert cents to interval ratios
Parameters
Section titled “Parameters”any[]
Intervals in cents
Returns
Section titled “Returns”Float32Array<ArrayBufferLike>
Interval ratios
getNoteNames()
Section titled “getNoteNames()”getNoteNames(
binsPerOctave?):string[]
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:493
Get note names for intervals (Western 12-tone system)
Parameters
Section titled “Parameters”binsPerOctave?
Section titled “binsPerOctave?”number = 12
Number of divisions (default: 12)
Returns
Section titled “Returns”string[]
Note names
intervalFrequencies()
Section titled “intervalFrequencies()”intervalFrequencies(
nBins,options?):Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:60
Construct a set of frequencies from an interval set
Parameters
Section titled “Parameters”number
The number of frequencies to generate
options?
Section titled “options?”Configuration options
binsPerOctave
Section titled “binsPerOctave”number
Bins per octave (default: 12)
number
The minimum frequency (must be > 0)
intervals
Section titled “intervals”string | number[]
Interval specification
boolean
Sort intervals in ascending order (default: true)
tuning
Section titled “tuning”number
Deviation from A440 in fractional bins (default: 0)
Returns
Section titled “Returns”Float32Array<ArrayBufferLike>
The frequency array
plimitIntervals()
Section titled “plimitIntervals()”plimitIntervals(
options?):any[] |Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:232
Construct p-limit intervals using harmonic crystal growth algorithm
Parameters
Section titled “Parameters”options?
Section titled “options?”Configuration options
binsPerOctave
Section titled “binsPerOctave”number
Number of intervals (default: 12)
primes
Section titled “primes”number[]
Prime factors to use
returnFactors
Section titled “returnFactors”boolean
Return prime factorization (default: false)
boolean
Sort intervals ascending (default: true)
Returns
Section titled “Returns”any[] | Float32Array<ArrayBufferLike>
Intervals or their factorizations
pythagoreanIntervals()
Section titled “pythagoreanIntervals()”pythagoreanIntervals(
options?):any[] |Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:164
Generate Pythagorean intervals based on powers of 3
Parameters
Section titled “Parameters”options?
Section titled “options?”Configuration options
binsPerOctave
Section titled “binsPerOctave”number
Number of intervals to generate (default: 12)
returnFactors
Section titled “returnFactors”boolean
Return prime factorization (default: false)
boolean
Sort intervals ascending (default: true)
Returns
Section titled “Returns”any[] | Float32Array<ArrayBufferLike>
Intervals or their factorizations
ratiosToCents()
Section titled “ratiosToCents()”ratiosToCents(
ratios):Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:475
Convert interval ratios to cents
Parameters
Section titled “Parameters”ratios
Section titled “ratios”Float32Array<ArrayBufferLike>
Interval ratios
Returns
Section titled “Returns”Float32Array<ArrayBufferLike>
Intervals in cents
wellTemperedIntervals()
Section titled “wellTemperedIntervals()”wellTemperedIntervals(
temperament?,sort?):Float32Array<ArrayBufferLike>
Defined in: packages/pleco-xa/src/scripts/xa-intervals.js:390
Generate well-tempered intervals (historical temperaments)
Parameters
Section titled “Parameters”temperament?
Section titled “temperament?”string = 'werckmeister'
Temperament name (‘werckmeister’, ‘kirnberger’, ‘young’)
boolean = true
Sort intervals
Returns
Section titled “Returns”Float32Array<ArrayBufferLike>
Interval ratios