Function sortedNoteNames

  • Sort an array of notes in ascending order. Pitch classes are listed before notes. Any string that is not a note is removed.

    Parameters

    • notes: string[]

    Returns string[]

    sorted array of notes

    Example

    sortedNoteNames(['c2', 'c5', 'c1', 'c0', 'c6', 'c'])
    // => ['C', 'C0', 'C1', 'C2', 'C5', 'C6']
    sortedNoteNames(['c', 'F', 'G', 'a', 'b', 'h', 'J'])
    // => ['C', 'F', 'G', 'A', 'B']