harmonic-entropy
    Preparing search index...

    Class EntropyCalculator

    Construct a harmonic entropy calculator for individual musical intervals.

    The constructor computes both ratio and entropy tables immediately.

    Index

    Constructors

    Properties

    table: [number, number][]

    Accessors

    • get a(): number

      Rényi order.

      Returns number

    • set a(value: number): void

      Parameters

      • value: number

      Returns void

    • get maxCents(): number

      Upper bound of tabulation in cents.

      Returns number

    • set maxCents(value: number): void

      Parameters

      • value: number

      Returns void

    • get minCents(): number

      Lower bound of tabulation in cents.

      Returns number

    • set minCents(value: number): void

      Parameters

      • value: number

      Returns void

    • get N(): number

      Max height of rationals (Benedetti or Wilson depending on series).

      Returns number

    • set N(value: number): void

      Parameters

      • value: number

      Returns void

    • get normalize(): boolean

      Whether to normalize the result by Hartley entropy.

      Returns boolean

    • set normalize(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get res(): number

      Tabulation step size in cents.

      Returns number

    • set res(value: number): void

      Parameters

      • value: number

      Returns void

    • get s(): number

      Gaussian frequency deviation (default 0.01).

      Returns number

    • set s(value: number): void

      Parameters

      • value: number

      Returns void

    • get series(): "tenney" | "farey"

      Series of rationals to use.

      Returns "tenney" | "farey"

    • set series(value: "tenney" | "farey"): void

      Parameters

      • value: "tenney" | "farey"

      Returns void

    Methods

    • Calculate harmonic entropy of a musical interval measured in cents.

      Parameters

      • cents: number

        Width of the interval.

      Returns number

      Harmonic entropy of the input in natural units.

      Error if the input is outside the range of .minCents and .maxCents.

    • Calculate the harmonic entropy of a frequency ratio.

      Parameters

      • value: FractionValue

        Ratio-like input accepted by xen-dev-utils Fraction parsing. A numeric value is treated as a ratio (for example, 1.5 means 3/2).

      Returns number

      Harmonic entropy of the input in natural units.

      Error if the converted cents value is outside of the tabulated range.

    • Serialize the entropy calculator to a JSON-compatible object.

      Returns { options: HarmonicEntropyOptions; tableY: number[]; type: string }

      Serialized payload with type set to 'EntropyCalculator'.

    • Revive an EntropyCalculator instance produced by EntropyCalculator.toJSON(). Return everything else as-is.

      Intended usage:

      const data = JSON.parse(serializedData, EntropyCalculator.reviver);
      

      Parameters

      • key: string

        Property name.

      • value: any

        Property value.

      Returns any

      Deserialized EntropyCalculator instance or other data without modifications.