Function tokenize

  • Tokenize a chord name. It returns an array with the tonic and chord type If not tonic is found, all the name is considered the chord name.

    This function does NOT check if the chord type exists or not. It only tries to split the tonic and chord type.

    Parameters

    • name: string

      the chord name

    Returns ChordNameTokens

    an array with [tonic, type]

    Function

    Example

    tokenize("Cmaj7") // => [ "C", "maj7" ]
    tokenize("C7") // => [ "C", "7" ]
    tokenize("mMaj7") // => [ null, "mMaj7" ]
    tokenize("Cnonsense") // => [ null, "nonsense" ]