chords

This module provides functions for producing lists of MIDI note numbers from scale degrees, note names, or nashville numbers.

Source:

Members

(static, constant) chordDegrees :Object(string, Array.<(string|number)>)

Source:

degrees for each type relative to major scale, user can add more

Type:
  • Object(string, Array.<(string|number)>)

(static, constant) nashvilleChordTypes :Object(string, string[])

Source:

triad and 7th types for major and minor scales

Type:
  • Object(string, string[])

Methods

(static) chordToMidi(optionsopt) → {Array.<number>}

Source:

What are the MIDI note numbers for the named chord (such as 'C#7b5', or 'BM7:3')?

Examples
const result = chords.chordToMidi({ name: 'C' })
// <= [60,64,67]
const result = chords.chordToMidi({ name: 'CM7:4' })
// <= [60,64,67,71]
const result = chords.chordToMidi({
  name: 'CM7',
  defaultOctave: 3
})
// <= [48,52,55,59]
const result = chords.chordToMidi({ name: 'C#m7' })
// <= [61,64,68,71]
Parameters:
Name Type Attributes Description
options Object <optional>

{ name = , scale = 'Ionian', defaultOctave = origin.octave }

Returns:

array of MIDI note numbers

Type
Array.<number>

(static) degreesToMidi(degrees, options) → {Array.<number>}

Source:

What are the MIDI note numbers for the degrees?

Examples
const result = chords.degreesToMidi([1, 'b2:4', 2])
// <= [60,61,62]
const result = chords.degreesToMidi(
  [1, 'b2', 2],
  {
    defaultOctave: 0,
    shift: 60
  })
// <= [60,61,62]
Parameters:
Name Type Description
degrees Array.<(string|number)>

list of scale degrees

options Object

{octave(default octave), shift(where is middle C)}

Returns:

array of MIDI note numbers for degrees

Type
Array.<number>

(static) nashvilleToMidi(options) → {Array.<number>}

Source:

What are the MIDI note numbers for the named Nashville chord (such as '1', '4^7:3')?

Examples
// CM7 chord (default is to produce 7th chords)
const options = { name: 1 }
const result = chords.nashvilleToMidi(options)
// <= [60,64,67,71]
/* An extension of the nashville number concept:
   this will be an #1^M7 chord, in the key of C */
const options = { name: '#1' }
const result = chords.nashvilleToMidi(options)
// <= [61,65,68,72]
// 1 chord, major scale (just a C major triad)
const options = { name: 1, scale: 'M' }
const result = chords.nashvilleToMidi(options)
// <= [60,64,67]
/* scale is superfluous (and ignored) when the
   chord type is specified */
const options = { name: '2^m7b5', scale: 'notAScale' }
const result = chords.nashvilleToMidi(options)
// <= [62,65,68,72]
// 3 chord, major scale
const options = { name: 3, scale: 'm' }
const result = chords.nashvilleToMidi(options)
// <= [64,68,71]
Parameters:
Name Type Description
options Object

{ name = , key = 'C', scale = 'M7' }

Returns:

array of MIDI note numbers

Type
Array.<number>

(static) notesToMidi(notes, optionsopt) → {Array.<number>}

Source:

What are the MIDI note numbers for the list of notes?

Examples
const result = chords.notesToMidi(['C', 'C#:4', 'D'])
// <= [60,61,62]
const result = chords.notesToMidi(['C', 'C#', 'D'],
  { defaultOctave: 3 })
// <= [48,49,50]
Parameters:
Name Type Attributes Description
notes Array.<string>
options Object <optional>

{octave(default octave), shift(where is middle C)}

Returns:

array of MIDI note numbers

Type
Array.<number>