Interface IPitchContainer

IPitchContainer provides a simple interface for objects which are defined by a collection of pitches, i.e. Chords and Scales.

Hierarchy

  • IPitchContainer

Implemented by

Accessors

Methods

Accessors

  • get pitches(): number[]
  • The pitches contained within the collection.

    Returns number[]

  • get root(): number
  • The root pitch within the collection.

    Returns number

Methods

  • The contains method should return true only if the passed in pitch is contained within the implementing object. It is up to whoever's doing the implementation to determine whether pitches 1 or more octaves apart from a pitch within the container should be considered contained.

    For example: dMajorScale.contains('F6') returns false.

    Parameters

    • pitch: string | number

      The MIDI numerical representation of the pitch we want to check if contained. Can also take pitch names, see the pitch method for more information.

    Returns boolean

  • The fitPitch method should take in a pitch, and return a new (or possibly the same pitch) that better fits the pitches within the container that the method was called on.

    For example: CmajorChord.fitPitch(39, { maxMovement: 1, preferredDirection: shimi.FitDirection.random}) returns 40 (E).

    Parameters

    • pitch: string | number

      The MIDI numerical representation of the pitch to be fitted to the pitches within the container. Can also take pitch names, see the pitch method for more information.

    • Optional options: Partial<FitPitchOptions>

      The options that determine how the pitch is fitted.

    Returns number

Generated using TypeDoc