Class PitchFitter

This class is designed to allow optimized pitch fitting. Using the regular pitch fitting methods on scale and chord objects often results in different input pitches being mapped to the same output pitch. This takes a collection of pitches which are to be optimized for, as well as a pitch container to check against. It uses a modified version of the stable marriage algorithm to decide where pitches need to be mapped to.

Hierarchy

  • PitchFitter

Constructors

Methods

Constructors

  • Parameters

    • pitches: number[]

      The collection of pitches which we want to optimize mapping for

    • pitchContainer: IPitchContainer

      The scale/chord that we want the pitches to be fitted to

    • fitOptions: Partial<FitPitchOptions>

      Options to configure how the fitting works

    Returns PitchFitter

Methods

  • Returns a pitch near to the passed in pitch, but which should fit better with the notes within the container that was optimized against.

    Returns

    Returns a new pitch number.

    Parameters

    • pitch: string | number

      The pitch which we want to fit to the scale. Can also take pitch names, see the pitch method for more information.

    Returns number

  • Calling this will invalidate the current fitting and recalculate.

    Parameters

    • pitches: number[]

      The collection of pitches which we want to optimize mapping for

    • pitchContainer: IPitchContainer

      The scale/chord that we want the pitches to be fitted to

    • fitOptions: Partial<FitPitchOptions>

      Options to configure how the fitting works

    Returns void

Generated using TypeDoc