sonic-weave
    Preparing search index...

    Class Val

    A mapping vector commonly used to convert intervals in just intonation to steps of an equal temperament.

    Index

    Constructors

    • Construct a mapping vector.

      Parameters

      • value: TimeMonzo

        A TimeMonzo instance interpreted as a val. Usually a projective approximation to the Just Intonation Point with integer coefficients.

      • basis: ValBasis

        The subgroup basis associated with this val. The first basis element determines the equave that is equally divided by this val.

      • Optionalnode: CoIntervalLiteral

        Node in the abstract syntax tree used for string representation.

      Returns Val

    Properties

    basis: ValBasis
    domain: "cologarithmic" = ...
    value: TimeMonzo

    Accessors

    • get divisions(): Fraction

      The number of divisions in the equal temperament associated with this val.

      Returns Fraction

    • get equave(): TimeMonzo

      The interval this val is equally dividing.

      Returns TimeMonzo

    • get sval(): FractionalMonzo

      The value of this val within the associated basis.

      Returns FractionalMonzo

    Methods

    • Normalize the leading coefficient to be positive.

      Returns Val

      A new val with a positive division of its equave.

    • Add this this val to another.

      Parameters

      • other: Val

        Another val.

      Returns Val

      The sum of the vals.

    • Inversely scale this val by a linear interval.

      Parameters

      Returns Val

      A rescaled version of this val.

    • Map an interval using this val or calculate the cosine of the unweighted angle between two vals.

      Parameters

      • other: Interval | Val

        An interval to map or another val.

      Returns Interval

      The dot product between this and the other as a linear interval.

    • Check if this val has the same size and equave as another.

      Parameters

      • other: Val

        Another val.

      Returns boolean

      true if the vals have the same size and their equaves have the same size.

    • Compute the root mean squared error against the just intonation point.

      Parameters

      • weights: number[]

        Additional weights to apply on top of Tenney weights.

      • unnormalized: boolean = false

        Return the unnormalized squared error instead.

      Returns number

      The TE error.

    • The geometric inverse of this val.

      Returns Interval

      An interval in the logarithmic domain whose dot product with the original val is unitary.

    • Scale this val by a linear interval.

      Parameters

      Returns Val

      A rescaled version of this val.

    • The additive inverse of this val.

      Returns Val

      The negative of this val.

    • Obtain the next val in the basis' generalized patent val sequence or approach it if this val is off-JIP.

      Parameters

      • weights: number[]

        Additional weights to apply on top of Tenney weights.

      Returns Val

      The val at unit distance that comes after this one (non-projective metric).

    • A meaningless operation.

      Returns Val

      A new Val obtained by pretending its value represents a linear quantity.

    • Check if this val has the same structure as another.

      Parameters

      • other: Val

        Another val.

      Returns boolean

      true if the vals and their equaves have the same components.

    • Subtract another val from this one.

      Parameters

      • other: Val

        Another val.

      Returns Val

      The difference of the vals.

    • Obtain a faithful string representation of this val.

      Returns string

      A string that evaluates to a val with the same value as this one when interpreted as a SonicWeave expression.

    • Construct a val from an array of mapping entries representing equal divisions of an equave.

      Parameters

      • primeExponentMap: FractionValue[]

        Val components.

      • Optionalbasis: ValBasis

        Basis of the subgroup. Defaults to the primes.

      • Optionalnode: CoIntervalLiteral

        Node in the abstract syntax tree used for string representation.

      Returns Val

      A cologarithmic mapping vector.

    • Convert an array of components in a subgroup basis to a val in the standard basis.

      Parameters

      • basisExponentMap: FractionValue[]

        Components of the val.

      • basis: ValBasis

        Basis of the val.

      • Optionalnode: CoIntervalLiteral

        Node in the abstract syntax tree used for string representation.

      Returns Val