Convert interval to absolute representation. Normalized to a frequency.
Convert interval to absolute FJS.
Calculate acos x.
Reduce the given/current scale to a single value by the reducer
riff which takes an accumulator, the current value, the current index and the array as arguments.
Repeat the given/current array or string count
times.
Calculate asin x.
Calculate atan x.
Calculate atan2(y, x) which is the angle between (1, 0) and (x, y), chosen to lie in (−π; π], positive anticlockwise.
Calculate atanXY(x, y) = atan2(y, x) which is the angle between (1, 0) and (x, y), chosen to lie in (−π; π], positive anticlockwise.
If the current scale is empty, generate absolute Diamond-mos notation based on the current config. Uses relative notation if J4 does not coincide with 1/1.
Construct a subgroup basis from intervals.
Return the basis of a val or a temperament.
Convert a subgroup basis to an array of basis elements.
Get rid of interval coloring and label.
Convert value to a boolean.
Round value up to the nearest integer.
Convert interval to cents. fractionDigits
represents the number of decimal digits in the cents representation. May produce non-algebraic (real) results if number of digits is not given. String arguments are interpreted as denoting cent quantities, not linear fractions.
Color based on the size of the interval. Hue wraps around every 1200 cents.
Obtain an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
Remove the contents of the current/given scale.
Calculate clz32 x.
Obtain a non-negative integer that is the Unicode code point value of the character starting at the given index. Note that the index is still based on UTF-16 code units, not Unicode code points.
Return the color of the interval.
Obtain the comma basis (null space) of a temperament or a val.
Construct a Temperament instance from an array of commas. Optional weights are applied multiplicatively on top of Tenney weights. Optionally equaves are normalized to pure. Optionally the full prime limit is assumed based on the commas.
Compare two values. Result is -1 if x < y, +1 if x > y and 0 if the arguments are equal.
Compute the prime limit ordinal of an interval or val. 1/1 has a complexity of 0, 2/1 has complexity 1, 3/1 has complexity 2, 5/1 has complexity 3, etc.. If countZeros
is true, measure the complexity of the internal representation instead.
Combine two or more arrays/strings.
Calculate cos x.
Convert interval to a decimal number.
Compute the determinant of a matrix. Domain is ignored, all values coerced to linear.
Obtain the javascript representation of the value.
Remove and return the first element equal to the given one from the current/given scale.
Remove intervals from the given/current scale that evaluate to false
according to the tester
riff.
Obtain an array of divisors of a natural number.
Obtain the docstring of the given riff.
Obtain an array of [key, value]
pairs of the record.
Calculate Tenney-Euclid error w.r.t the vals basis. Weights are applied multiplicatively on top of Tenney weights if given. Unnormalized values are slightly faster to compute and are in the linear domain instead of (logarithmic) cents.
Tests whether all elements in the array pass the test implemented by the provided function. It returns a Boolean value. It doesn't modify the array. If no array is provided it defaults to the current scale. If no test is provided it defaults to truthiness.
Calculate expm1 x.
Extend the first array with the contents of the rest.
Color an interval based on its prime factors.
Generate the interior of the n'th Farey sequence i.e. all fractions between 0 and 1 exclusive with denominator below or at the given limit.
Generate the n'th Farey sequence i.e. all fractions between 0 and 1 inclusive with denominator below or at the given limit.
Obtain a copy of the given/current scale containing values that evaluate to true
according to the tester
riff.
Convert interval to (relative) FJS.
Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth (default inf
).
Round value down to the nearest integer.
Convert interval to a fraction. Throws an error if conversion is impossible and no tolerance (in cents) for approximation is given.
Obtain a string created from the specified sequence of UTF-16 code units.
Obtain a string created from the specified sequence of code points.
Calculate fround x.
Obtain the largest (linear) multiplicative factor shared the two arguments or by all intervals or the current scale if no arguments are given.
Obtain the generators of a temperament with period first. See mappingBasis
for the untempered mapping generators.
Returns true
if the current/given scale has constant structure (i.e. every scale degree is unambiguous).
Print information about the given riff to the console.
HSL color (Hue range 0-360, Saturation range 0-100, Lightness range 0-100).
HSLA color (Hue range 0-360, Saturation range 0-100, Lightness range 0-100, Alpha range 0-1).
Calculate imul x.
Insert an interval into the current/given scale keeping it sorted.
Convert value to an integer. Throws an error if conversion is impossible.
Compute the inverse of a matrix. Domain is ignored, all values coerced to linear.
Return true
if the interval belongs to the absolute echelon.
Return true
if the value is an array.
Return true
if the value is a basis.
Return true
if the value is a boolean.
Return true
if the value is a color.
Return true
if the value is a riff or an arrow function.
Return true
if the interval is an integer.
Return true
if the value is an interval.
Return true
if the interval belongs to the linear domain.
Return true
if the interval belongs to the logarithmic domain.
Return true
if n
is a prime number, false
otherwise.
Return true
if the interval is an nth root.
Return true
if the interval is a rational number.
Return true
if the interval belongs to the relative echelon.
Return true
if the value is a string.
Return true
if the value is a temperament.
Return true
if the value is a val.
The Just Intonation Point. Converts intervals to real cents.
Obtain all k-sized combinations in a set
Obtain a copy of the popped/given scale with only unique intervals kept.
Convert interval to absolute FJS and label without octaves. Color black if there are accidentals, white otherwise.
Return the label of the interval.
Obtain the smallest (linear) interval that shares both arguments as multiplicative factors. Applies to the current scale if not arguments are given.
Return the number of intervals in the scale, the length of a string or the size of a basis.
Convert interval to linear representation. Formatting information of logarithmic quantities is lost.
Perform Lensta-Lenstra-Lovász basis reduction.
Calculate log1p x.
Convert interval to logarithmic representation. Formatting information of linear quantities is lost.
Obtain a "best effort" short string representing a primitive value. Vectorizes over arrays.
Map a riff over the given/current scale producing a new scale.
Obtain the mapping generators (preimage) of a temperament or a val with period first. See generatorsOf
for the tempered generators.
Obtain the argument with the maximum value.
Obtain the argument with the minimum value.
Convert interval to a prime count vector a.k.a. monzo.
Convert an array of prime counts to a monzo.
Calculate a subset of equally tempered degrees with maximum variety two per scale degree.
nedji(interval, preferredNumerator, preferredDenominator, preferredEquaveNumerator, preferredEquaveDenominator)
Convert interval to N-steps-of-Equally-Divided-interval-of-Just-Intonation.
Obtain the next generalized patent val in the sequence.
Obtain the nth odd prime or prime 2 if n = 0.
Get/set the number of prime exponents to support in monzos. Also sets the length of vals.
Obtain the number of periods per equave in a temperament.
Remove and return the last interval in the current/given scale. Optionally an index to pop may be given.
Remove and return all intervals in the current/given scale.
Construct a prime mapping for tempering intervals to specified cents. Remaining primes are left untempered.
Convert interval to a prime count vector a.k.a. monzo with all primes listed in the subgroup part.
Obtain a range of primes starting at the given ordinal. Prime 2 has ordinal 0. (End - start) elements are returned.
Obtain an array of prime numbers such that start <= p <= end. Or p <= start if end is omitted.
Print the arguments to the console.
Append an interval onto the current/given scale. Optionally an index to push after may be given.
Convert interval to a radical expression. Throws an error if conversion is impossible and no maximum index (2 means square root, 3 means cube root, etc.) for approximation is given.
Obtain a random value between (linear) 0 and 1.
Obtain random cents between (logarithmic) 0.0c and 1.0c.
Convert interval to a linear real value.
Convert interval to relative representation.
Map a riff over the given/current scale replacing the contents.
Obtain a string representation of the value (with color and label).
Respell i.e. simplify fractions in the the current scale treating intervals separated by the given commas as the same. Search radius (default 1) is an integer for discovering harder-to-find simplifications. (Creates a respelling function.)
Obtain a copy of the popped/given scale in reversed order.
Reverse the order of the current/given scale.
RGB color (Red range 0-255, Green range 0-255, Blue range 0-255).
RGBA color (Red range 0-255, Green range 0-255, Blue range 0-255, Alpha range 0-1).
Round value to the nearest integer.
Compute (k²)/(k²-1) or a product of a range of such square-superparticulars.
Remove and return the first interval in the current/given scale.
Get rid of interval formatting. Simplifies a ratio to lowest terms.
Calculate sin x.
Obtain a slice of a string or scale between the given indices.
Test whether at least one element in the array passes the test implemented by the provided function. It returns true if, in the array, it finds an element for which the provided function returns true; otherwise it returns false. It doesn't modify the array. If no array is provided it defaults to the current scale. If no test is provided it defaults to truthiness.
Obtain a sorted copy of the popped/given scale in ascending order.
Sort the current/given scale in ascending order.
Format a val using Sparse Offset Val notation.
Calculate the step signature of an entire scale word.
Obtain the step string associated with the scale e.g. "LLsLLLs" for Ionian.
Obtain a string representation of the value (w/o color or label).
Return the higher prime tail of an interval starting from the given index. Prime 2 has index 0.
Calculate tan x.
Construct a Temperament instance from an array of vals. Optional weights are applied multiplicatively on top of Tenney weights. Optionally equaves are normalized to pure.
Access the nth template argument when using the sw
tag inside JavaScript.
Calculate the Tenney height of the interval. Natural logarithm of numerator times denominator.
Convert interval to an array of its prime counts.
Attach a tracking ID to the interval.
Obtain an array of the tracking IDs attached to the interval.
Transpose a matrix. For modal transposition see rotate().
Truncate value towards zero to the nearest integer.
Attempt to combine the given vals into a more Tenney-Euclid optimal val. Weights are applied multiplicatively on top of Tenney weights of the subgroup basis.
Prepend an interval at the beginning of the current/given scale.
Convert an array of prime mapping entries to a val.
Obtain a string representation of a primitive value (w/o color or label). Vectorizes over arrays.
Print the arguments to the console with "warning" emphasis.
Format a val using warts shorthand notation.
Calculate the Wilson height of the interval. Sum of prime absolute factors with repetition..
Change the basis of the val.
Combine elements of each array into tuples until one of them is exhausted.
Combine elements of each array into tuples until all of them are exhausted. Pads missing values with niente
.
Convert interval to absolute linear representation.
Convert interval to absolute logarithmic representation.
Convert interval to absolute FJS using HEJI comma flavors.
Convert interval to absolute FJS using neutral comma flavors.
Calculate the inverse hyperbolic cosine of x.
Calculate the (linear) sum of the arguments.
Generate arithmetic frequency divisions of the given equave/octave.
Stack arithmetic frequency deltas up to the given equave/octave.
Calculate the inverse hyperbolic sine of x.
Assert that the test expression is true or fail with the given message.
Calculate the inverse hyperbolic tangent of x.
Calculate the arithmetic mean of the terms.
Calculate the frequency corresponding to the given number of beats per minute.
Calculate the cube root of the input.
Calculate the geometric difference of two intervals on a circle.
Calculate the geometric distance of two intervals on a circle.
Obtain a copy of the popped/given scale where groups of intervals separated by tolerance
are coalesced into one. action
is one of 'simplest', 'wilson', 'lowest', 'highest', 'avg', 'havg' or 'geoavg'. If preserveBoundary
is true
intervals close to unison and the equave are not eliminated.
Obtain an array of colors of the current/given scale.
Generate a concordance shell i.e. a vertically aligned object reduced to an equal temperament. Intervals are labeled by their harmonics.
Calculate the hyperbolic cosine of x.
Generate a combination product set from the given factors and combination size.
Generate a constant structure generator sequence. Zero ordinal corresponds to the (trivial) stack of all generators while positive ordinals denote scales with constant structure ordered by increasing size.
Create a constrained (nearly) Tenney-Euclid optimal temperament from an array of vals or commas. Note: Comma lists will always use the full inferred prime limit, but a higher one or an explicit basis can be given.
Calculate the cumulative products of the factors in the array i.e. logarithmic cumulative sums.
Calculate the cumulative sums of the terms in the array.
Calculate the denominator of x in reduced form.
Calculate the (linear) differences between the terms.
Return the domain of the given interval as a callable converter.
Color every interval in the scale with hue repeating every step of an equal division of equave
. offset
rotates the hue wheel.
Obtain a copy of the popped/given scale with denominators removed and the root made explicit.
Produce an array of [index, element] pairs from the given current/given array.
Obtain a copy of the popped/given scale quantized to given equal divisions of its equave.
Obtain a copy of the popped/given scale reduced by its equave.
Span a lattice from all divisors of the guide-tone rotated to the root-tone.
Calculate e raised to the power of x.
Throw the given message as an error.
Convert absolute frequency to MIDI note number / MTS value (fractional semitones with A440 = 69).
Calculate the geometric mean of the factors.
Calculate the geometric differences between the factors.
Obtain a copy of the popped/given scale that uses the first interval as the implicit unison.
Stack a periodic array of generators up to the given size which must be a multiple of the number of periods.
Calculate the harmonic mean of the terms.
Convert interval to (relative) FJS using HEJI comma flavors.
Calculate the square root of the sum of squares of the arguments.
Obtain an array of keys of the record.
Obtain an array of labels of the current/given scale.
Calculate the logarithm of x base y. Base defaults to E.
Calculate the logarithm of x base 10.
Calculate the logarithm of x base 2.
Obtain a copy of the popped/given scale with the given offset or polyoffset merged into it. overflow
is one of 'keep', 'drop' or 'wrap' and controls what to do with offset intervals outside of current bounds.
mos(numberOfLargeSteps, numberOfSmallSteps, sizeOfLargeStep = 2, sizeOfSmallStep = 1, up = niente, down = niente, equave = 2)
Generate a Moment-Of-Symmetry scale with the given number number of large and small steps. up
defines the brightness of the mode i.e. the number of major intervals from the root. Alternatively down
defines the darkness of the mode i.e. the number of minor intervals from the root. The default equave
is the octave 2/1
.
Convert MIDI note number to absolute frequency.
Calculate the (linear) product of the arguments i.e. the logarithmic sum.
Convert interval to (relative) FJS using neutral comma flavors.
Calculate the numerator of x in reduced form.
Obtain a copy of the popped/given scale in the default overtonal interpretation.
Generate a 4-dimensional octaplex a.k.a. 20-cell from the given basis intervals.
Generate all fractions with odd limit <= limit
reduced to between 1 (exclusive) and equave
(inclusive).
Calculate the odd limit of x. Here 'odd' means not divisible by the equave.
Obtain a copy of the popped/given scale reduced by its last interval, sorted and with duplicates filtered out. If tolerance
is given near-duplicates are coalesced instead using the given action
. If preserveBoundary
is true
intervals close to unison and the equave are not eliminated.
parallelotope(basis, ups = niente, downs = niente, equave = niente, basisSizeHints = niente, equaveSizeHint = niente)
Span a parallelotope by extending a basis combinatorically. ups
defaults to all ones while downs
defaults to all zeros. The size hints are used to get the correct period reduction when generating a preimage.
Create a naïve pure-equaves tuning by normalizing the Tenney-Euclid optimal temperament based on an array of vals or commas. Note: Comma lists will always use the full inferred prime limit, but a higher one or an explicit basis can be given.
Calculate x to the power of y.
Calculate the (linear) product of the factors or the current scale i.e. the logarithmic sum.
Obtain a copy of the popped/given scale with random variance added.
Obtain an array of integers from start
to stop - 1
. When only a single parameter is given range(0, n)
is returned.
rank2(generator, up, down = 0, period = niente, numPeriods = 1, generatorSizeHint = niente, periodSizeHint = niente)
Create a finite segment of a Rank-2 scale by stacking the given generator against the given period (or the octave by default). up
and down
must be multiples of numPeriods
. The size hints are used to get the correct period reduction when generating a preimage.
Realize a scale word like "LLsLLLs" as a concrete scale with the given step sizes such as #{L: 9/8, s:256/243}
. One step size may be omitted and inferred based on the size of the equave
(default 2
).
Obtain a copy of the popped/given scale reduced by its equave. Issue a warning if the scale was already reduced.
Obtain a copy of the popped/given scale reflected about unison.
Convert interval to relative linear representation.
Convert interval to relative logarithmic representation.
Stack the popped/given scale on top of itself.
Repeat the popped/given intervals as-is without accumulating equaves.
Repeat the popped/given scale shifted linearly each time.
Obtain a copy of the popped/given scale with occurences of interval
replaced by replacement
.
Obtain a copy of the popped/given scale with relative occurences of step
replaced by replacement
.
Obtain an retroverted copy of the popped/given scale (negative harmony i.e. reflect and transpose).
Obtain a copy of the popped/given scale that sounds in the opposite direction.
Obtain a copy of the popped/given scale rotated onto the given degree.
Get rid of interval formatting, color and label.
Calculate the sign of x.
Calculate the hyperbolic sine of x.
Compute the geometric difference between successive odd harmonics (2*start + 1) / (2*start - 1)
and (2*start + 3) / (2*start + 1)
. If end
is given, (2*end + 3) / (2*end + 1)
is used as the endpoint instead.
Calculate the square root of the input.
Cumulatively stack the popped/given intervals on top of each other.
Cumulatively sum the numbers of the popped/given array.
Stack the popped/given inflections along with the guide generator into a periodic sequence of steps.
Obtain a copy of the popped/given scale streched by the given amount. A value of 1
corresponds to no change.
Generate a subharmonic segment including the given start and end points.
Obtain a copy of the popped/given scale with only the given degrees kept. Omitting the zero degree rotates the scale.
Calculate the (linear) sum of the terms or the current scale.
Obtain generalized patent vals in the same sequence as the initial val that make the given commas vanish.
Calculate the hyperbolic tangent of x.
Create a Tenney-Euclid optimal temperament from an array of vals or commas. Note: Comma lists will always use the full inferred prime limit, but a different basis or a prime limit may be given.
Generate an equal temperament with the given number of divisions of the given equave/octave.
Stack relative edosteps up to the given equave/octave.
Obtain a copy of the popped/given scale quantized to harmonics of the given fundamental.
Obtain a copy of the current/given scale quantized to subharmonics of the given overtone.
Produce a function that fails with the given message when called.
Obtain a undertonal reflection of the popped/given overtonal scale.
Unstack the popped/given scale into steps.
Convert the popped/given periodic sequence of steps into inflections of the last interval as the guide generator.
Obtain an array of values of the record.
Generate a vertically aligned object i.e. a subset of the harmonic series that sounds like the given equal temperament (default 12
) within the given tolerance (default 5c
). Harmonics equated by the equave
(default 2/1
) are only included once. The returned segment begins at unison.
Convert value to a boolean. Vectorizes over arrays.
Get rid of expression results. void(++i)
increments the value but doesn't push anything onto the scale.
Calculate the Weil height of the interval. Natural logarithm of the maximum of numerator or denominator.
Generate a well-temperament by cumulatively modifying the pure fifth 3/2
(or a given generator) by fractions of the syntonic/given comma.