Class ChordProgression

The ChordProgression class reppresents a sequence of chords that play one after another.

Hierarchy

  • Range

    Hierarchy

    • ChordProgression

Constructors

Properties

chords: ChordProgressionChord[] = []

The collection of chords that the progression contains.

Accessors

  • get duration(): number
  • The difference between the start and end values.

    Attempts to set this to a negative value will result in an error being thrown.

    Returns number

  • set duration(value: number): void
  • Parameters

    • value: number

    Returns void

  • get end(): number
  • The value which the range ends at.

    Attempts to set this to a value less than start will result in an error being thrown.

    Returns number

  • set end(value: number): void
  • Parameters

    • value: number

    Returns void

  • get start(): number
  • The value which the range starts at.

    Attempts to set this to a value greater than end will result in an error being thrown.

    Returns number

  • set start(value: number): void
  • Parameters

    • value: number

    Returns void

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

Methods

  • Add a new chord to the progression. If the new chord overlaps or entirely contains existing chords within the progression, then those chords will be shrunk down, or fully removed to make room for the new chord.

    Returns

    Returns the ChordProgression instance, to allow for chained operations

    Parameters

    • start: number

      The start beat of the chord within the context of the progression

    • duration: number

      The beat duration of the chord

    • chord: Chord

      The chord itself that is to be added

    Returns ChordProgression

  • Returns true if the passed in point is greater than or equal to range start, and less than or equal to range end.

    Returns

    Parameters

    • point: number

      The point value to determine whether it's within the range.

    Returns boolean

  • Returns the chord that occurs at the given point in time within the chord progression.

    Returns

    Parameters

    • beat: number

      The beat of the chord, relative to the start of the chord progression.

    Returns ChordProgressionChord

  • Returns a collection of all the chords that overlap with the passed in range.

    If rangeEnd < rangeStart, then it returns all chords which end after rangeStart, or begin before rangeEnd.

    Returns

    Parameters

    • rangeStart: number
    • rangeEnd: number

    Returns ChordProgressionChord[]

  • Accepts a value and returns what percentage of the way into the range that the value is.

    The returned value can be negative, or greater than 100%, if the passed in value is less than the range start, or greater than the range end.

    Returns

    Parameters

    • value: number

      The value to compare against the range.

    Returns number

Generated using TypeDoc