Class FitPitchOptions

FitPitchOptions is referenced by the IPitchContainer.fitPitch method to provide extra information about how a pitch should be fitted to some chord or scale.

Hierarchy

  • FitPitchOptions

Constructors

  • For normal usage, library users shouldn't need to call the FitPitchOptions constructor. The IPitchContainer.fitPitch method accepts a partial FitPitchOptions declaration. Enabling library users to simply call something like: eMinorChord.fitPitch(66, { scale: cMajor, maxMovement: 1 })

    Parameters

    • init: Partial<FitPitchOptions>

      The init parameter is a partial definition of a FitPitchOptions object.

    Returns FitPitchOptions

Properties

maxMovement: number = 2

The maximum amount that the pitch being fitted can be moved to better fit.

For example, if maxMovement = 2, and the pitch being fitted is G5, then the fitted pitch can't be less that F5, or more than A5.

The default value of maxMovement is 2.

precision: "LOOSE" | "MEDIUM" | "TIGHT" = 'TIGHT'

The precision property defines how close of a fit to the target that a pitch must be before it's considered a valid fit. See the FitPrecision type for detailed information about the criteria of each of the FitPrecision options.

The default value of precision is FitPrecision.tight.

preferRoot: boolean = true

If true, then pitch fitting will always prefer setting the pitch to match the root of whatever we're fitting it to.

For example, if fitting D5 to a C major chord, with preferRoot set to true, fitPitch will prefer C5 over E5 regardless of the value of preferredDirection, because the root of the chord is C.

The default value of preferRoot is true.

preferredDirection: "UP" | "DOWN" | "RANDOM" = 'DOWN'

The preferredDirection defines that if 2 equally good matches are found, which direction the pitch fitting logic will choose. See the FitDirection type for further information about the FitDirection options.

The default value of preferredDirection is FitDirection.down.

scale: Scale = null

The scale property is only relevant when fitting a pitch to a chord.

Without this property set, the pitch will only be fitted to the chord. With it, the pitch will be fitted to the chord AND scale. See the FitPrecision document for more information on how this can affect the fit calculations.

By default, scale is left null.

Generated using TypeDoc