Class ChordFinder

Hierarchy

  • ChordFinder

Constructors

Properties

lookupData: ChordLookupData[] = []

Accessors

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

    Returns string

Methods

  • The addChordLookup method adds a new chord shape which the findChord method is able to search through.

    Returns

    The ChordFinder instance is returned, to allow for chaining operations.

    Parameters

    • shapeName: string

      The name to use when refering to the shape rather than a specific instance of the chord.

      For example, for a minor 7th chord, this would just be 'm7'.

    • intervals: number[]

      The intervals that make up the chord. Where each interval is defined as the semi-tone distance from the chord root.

      For example, for a major chord, this would be [0, 4, 7].

    • name: string

      The name of the chord in expression form, where {r} is a placeholder for the chord root. For example, '{r}M7' is the expression for a major 7th chord.

    • inverseName: string

      The name of the chord in expression form when inversed, where {r} is a placeholder for the chord root and {b} for the chord bass. For example, '{r}M7/{b}' is the expression for a major 7th chord, when the root is not in the bass.

    • preference: number

      Where 2 chords are equally well suited, the one with higher preference will be chosen.

    Returns ChordFinder

  • The findChord method gets passed in a collection of pitches and tries to find the best suggestion it can of what chord they make up.

    Returns

    If a matching chord is successfully found, then a ChordLookupResult instance is returned with details of the match. Otherwise the method returns null.

    Parameters

    • pitches: number[]

      The currently known pitches in the chord.

    • root: number = null

      Optional, the currently known chord root.

    • shapeFilter: string[] = null

      Optional, the names of the chord shapes that it's allowed to return. These must match shape names of already added chord lookups.

    • scale: Scale = null

      Optional, the scale which any notes that need to be added to the suggested chord must belong to.

    Returns ChordLookupResult

  • Just like the findChord method, this method returns a ChordLookupResult object with details about the best chord fit it could find. However, this method performs its lookup by chord name, rather than the individual pitches that are in the chord

    Returns

    Parameters

    • chordName: string

      The name of the chord to look for

    • Optional scale: Scale

    Returns ChordLookupResult

  • Takes a chord name as parameter, and attempts to return a new Chord object which matches the named chord

    Returns

    Parameters

    • chordName: string

      The name of the chord that we want to create

    • Optional scale: Scale

    Returns Chord

  • The removeChordLookup method finds a lookup that's already been added and removes it, meaning the chord finder can no longer find chords of that type.

    Returns

    The ChordFinder instance is returned, to allow for chaining operations.

    Parameters

    • shapeName: string

      The shape name of the chord to remove, for example 'M' or 'm7'.

    Returns ChordFinder

  • The replaceChordLookup method acts the same as if you called removeChordLookup, followed by addChordLookup. This just allows you to more easily redefine existing lookups.

    Returns

    The ChordFinder instance is returned, to allow for chaining operations.

    Parameters

    • shapeName: string

      The name to use when refering to the shape rather than a specific instance of the chord.

      For example, for a minor 7th chord, this would just be 'm7'.

    • intervals: number[]

      The intervals that make up the chord. Where each interval is defined as the semi-tone distance from the chord root.

      For example, for a major chord, this would be [0, 4, 7].

    • name: string

      The name of the chord in expression form, where {r} is a placeholder for the chord root. For example, '{r}M7' is the expression for a major 7th chord.

    • inverseName: string

      The name of the chord in expression form when inversed, where {r} is a placeholder for the chord root and {b} for the chord bass. For example, '{r}M7/{b}' is the expression for a major 7th chord, when the root is not in the bass.

    • preference: number

      Where 2 chords are equally well suited, the one with higher preference will be chosen.

    Returns ChordFinder

  • The withDefaultChordLookups method sets up the ChordFinder with a default collection of chord lookups that should cover most of what you might commonly use.

    Returns

    The ChordFinder instance is returned, to allow for chaining operations.

    Returns ChordFinder

Generated using TypeDoc