Your programs can use functions from the popular open-source package Tonal.js to help you select notes and chords. Here we provide a quick reference to common functions as well as convenient links to Tonal's online docs.
Tonal.Scale functions | 
Description | Example | 
|---|---|---|
rangeOf(name) | 
returns function that produces note names in a range. | rangeOf("C Minor")("C1", "C6") | 
steps(name) | 
returns function that produces note names. Index-origin is 0. | s=steps("A4 major"); s(0):"A4", s(7):"A5", s(-1):"G#4", s(-7):"A3", s(-8):"G#3" | 
Tonal.Note functions | 
Description | Example | 
|---|---|---|
midi(note) | 
convert note name to its MIDI key number. | midi("C3") | 
Tonal.Midi functions | 
Description | Example | 
|---|---|---|
midiToFreq(key) | 
convert MIDI key to a frequency. | midiToFreq(60) | 
| name | aliases | intervals | size | 
|---|---|---|---|
| altered | super locrian,diminished whole tone,pomeroy | 0P,2m,2A,3M,4A,6m,7m | 7 | 
| augmented heptatonic | 0P,2A,3M,4P,5P,5A,7M | 7 | |
| augmented | 0P,2A,3M,5P,5A,7M | 6 | |
| balinese | 0P,2m,3m,4P,5P,6m,7M | 7 | |
| bebop locrian | 0P,2m,3m,4P,5d,5P,6m,7m | 8 | |
| bebop major | 0P,2M,3M,4P,5P,5A,6M,7M | 8 | |
| bebop minor | 0P,2M,3m,3M,4P,5P,6M,7m | 8 | |
| bebop | 0P,2M,3M,4P,5P,6M,7m,7M | 8 | |
| chromatic | 0P,2m,2M,3m,3M,4P,5d,5P,6m,6M,7m,7M | 12 | |
| composite blues | 0P,2M,3m,3M,4P,5d,5P,6M,7m | 9 | |
| diminished | whole-half diminished | 0P,2M,3m,4P,5d,6m,6M,7M | 8 | 
| dorian #4 | ukrainian dorian,romanian minor,altered dorian | 0P,2M,3m,4A,5P,6M,7m | 7 | 
| dorian b2 | phrygian #6,melodic minor second mode | 0P,2m,3m,4P,5P,6M,7m | 7 | 
| dorian | 0P,2M,3m,4P,5P,6M,7m | 7 | |
| double harmonic lydian | 0P,2m,3M,4A,5P,6m,7M | 7 | |
| double harmonic major | gypsy | 0P,2m,3M,4P,5P,6m,7M | 7 | 
| egyptian | 0P,2M,4P,5P,7m | 5 | |
| enigmatic | 0P,2m,3M,5d,6m,7m,7M | 7 | |
| flamenco | 0P,2m,3m,3M,4A,5P,7m | 7 | |
| flat six pentatonic | 0P,2M,3M,5P,6m | 5 | |
| flat three pentatonic | kumoi | 0P,2M,3m,5P,6M | 5 | 
| half-whole diminished | dominant diminished,messiaen's mode #2 | 0P,2m,3m,3M,4A,5P,6M,7m | 8 | 
| harmonic major | 0P,2M,3M,4P,5P,6m,7M | 7 | |
| harmonic minor | 0P,2M,3m,4P,5P,6m,7M | 7 | |
| hirajoshi | 0P,2M,3m,5P,6m | 5 | |
| hungarian major | 0P,2A,3M,4A,5P,6M,7m | 7 | |
| hungarian minor | 0P,2M,3m,4A,5P,6m,7M | 7 | |
| ichikosucho | 0P,2M,3M,4P,5d,5P,6M,7M | 8 | |
| in-sen | 0P,2m,4P,5P,7m | 5 | |
| ionian pentatonic | 0P,3M,4P,5P,7M | 5 | |
| iwato | 0P,2m,4P,5d,7m | 5 | |
| kafi raga | 0P,3m,3M,4P,5P,6M,7m,7M | 8 | |
| kumoijoshi | 0P,2m,4P,5P,6m | 5 | |
| leading whole tone | 0P,2M,3M,4A,5A,7m,7M | 7 | |
| locrian #2 | half-diminished,aeolian b5 | 0P,2M,3m,4P,5d,6m,7m | 7 | 
| locrian 6 | locrian natural 6,locrian sharp 6 | 0P,2m,3m,4P,5d,6M,7m | 7 | 
| locrian major | arabian | 0P,2M,3M,4P,5d,6m,7m | 7 | 
| locrian pentatonic | minor seven flat five pentatonic | 0P,3m,4P,5d,7m | 5 | 
| locrian | 0P,2m,3m,4P,5d,6m,7m | 7 | |
| lydian #5P pentatonic | 0P,3M,4A,5A,7M | 5 | |
| lydian #9 | 0P,2A,3M,4A,5P,6M,7M | 7 | |
| lydian augmented | 0P,2M,3M,4A,5A,6M,7M | 7 | |
| lydian diminished | 0P,2M,3m,4A,5P,6M,7M | 7 | |
| lydian dominant pentatonic | 0P,3M,4A,5P,7m | 5 | |
| lydian dominant | lydian b7,overtone | 0P,2M,3M,4A,5P,6M,7m | 7 | 
| lydian minor | 0P,2M,3M,4A,5P,6m,7m | 7 | |
| lydian pentatonic | chinese | 0P,3M,4A,5P,7M | 5 | 
| lydian | 0P,2M,3M,4A,5P,6M,7M | 7 | |
| major augmented | major #5,ionian augmented,ionian #5 | 0P,2M,3M,4P,5A,6M,7M | 7 | 
| major blues | 0P,2M,3m,3M,5P,6M | 6 | |
| major pentatonic | pentatonic | 0P,2M,3M,5P,6M | 5 | 
| major | ionian | 0P,2M,3M,4P,5P,6M,7M | 7 | 
| malkos raga | 0P,3m,4P,6m,7m | 5 | |
| melodic minor | 0P,2M,3m,4P,5P,6M,7M | 7 | |
| messiaen's mode #3 | 0P,2M,3m,3M,4A,5P,6m,7m,7M | 9 | |
| messiaen's mode #4 | 0P,2m,2M,4P,4A,5P,6m,7M | 8 | |
| messiaen's mode #5 | 0P,2m,4P,4A,5P,7M | 6 | |
| messiaen's mode #6 | 0P,2M,3M,4P,4A,5A,6A,7M | 8 | |
| messiaen's mode #7 | 0P,2m,2M,3m,4P,4A,5P,6m,6M,7M | 10 | |
| minor #7M pentatonic | 0P,3m,4P,5P,7M | 5 | |
| minor bebop | 0P,2M,3m,4P,5P,6m,7m,7M | 8 | |
| minor blues | blues | 0P,3m,4P,5d,5P,7m | 6 | 
| minor hexatonic | 0P,2M,3m,4P,5P,7M | 6 | |
| minor pentatonic | vietnamese 2 | 0P,3m,4P,5P,7m | 5 | 
| minor six diminished | 0P,2M,3m,4P,5P,6m,6M,7M | 8 | |
| minor six pentatonic | 0P,3m,4P,5P,6M | 5 | |
| minor | aeolian | 0P,2M,3m,4P,5P,6m,7m | 7 | 
| mixolydian b6 | melodic minor fifth mode,hindu | 0P,2M,3M,4P,5P,6m,7m | 7 | 
| mixolydian pentatonic | indian | 0P,3M,4P,5P,7m | 5 | 
| mixolydian | dominant | 0P,2M,3M,4P,5P,6M,7m | 7 | 
| mystery #1 | 0P,2m,3M,5d,6m,7m | 6 | |
| neopolitan major pentatonic | 0P,3M,4P,5d,7m | 5 | |
| neopolitan major | 0P,2m,3m,4P,5P,6M,7M | 7 | |
| oriental | 0P,2m,3M,4P,5d,6M,7m | 7 | |
| pelog | 0P,2m,3m,5P,6m | 5 | |
| persian | 0P,2m,3M,4P,5d,6m,7M | 7 | |
| phrygian dominant | spanish,phrygian major | 0P,2m,3M,4P,5P,6m,7m | 7 | 
| phrygian | 0P,2m,3m,4P,5P,6m,7m | 7 | |
| piongio | 0P,2M,4P,5P,6M,7m | 6 | |
| prometheus neopolitan | 0P,2m,3M,4A,6M,7m | 6 | |
| prometheus | 0P,2M,3M,4A,6M,7m | 6 | |
| purvi raga | 0P,2m,3M,4P,4A,5P,6m,7M | 8 | |
| ritusen | 0P,2M,4P,5P,6M | 5 | |
| scriabin | 0P,2m,3M,5P,6M | 5 | |
| six tone symmetric | 0P,2m,3M,4P,5A,6M | 6 | |
| spanish heptatonic | 0P,2m,3m,3M,4P,5P,6m,7m | 8 | |
| super locrian pentatonic | 0P,3m,4d,5d,7m | 5 | |
| todi raga | 0P,2m,3m,4A,5P,6m,7M | 7 | |
| ultralocrian | superlocrian bb7,superlocrian diminished | 0P,2m,3m,4d,5d,6m,7d | 7 | 
| vietnamese 1 | 0P,3m,4P,5P,6m | 5 | |
| whole tone pentatonic | 0P,3M,5d,6m,7m | 5 | |
| whole tone | messiaen's mode #1 | 0P,2M,3M,4A,5A,6A | 6 | 
Courtesy tonaljs via :
let scales = [];
for(let n of Scale.names()) 
{ 
    let s = Scale.get(n); 
    scales.push(`|${n}|${s.aliases}|${s.intervals.length}|${s.intervals}|`); 
}
scales.sort();
| Full name | short name | intervals | 
|---|---|---|
| altered | alt7 | 1P,3M,7m,9m | 
| augmented seventh | maj7#5, maj7+5, +maj7, ^7#5 | 1P,3M,5A,7M | 
| augmented | aug, +, +5, ^#5 | 1P,3M,5A | 
| diminished seventh | dim7, °7, o7 | 1P,3m,5d,7d | 
| diminished | dim, °, o | 1P,3m,5d | 
| dominant flat ninth | 7b9 | 1P,3M,5P,7m,9m | 
| dominant ninth | 9 | 1P,3M,5P,7m,9M | 
| dominant seventh | 7, dom | 1P,3M,5P,7m | 
| dominant sharp ninth | 7#9 | 1P,3M,5P,7m,9A | 
| dominant thirteenth | 13 | 1P,3M,5P,7m,9M,13M | 
| eleventh | 11 | 1P,5P,7m,9M,11P | 
| fifth | 5 | 1P,5P | 
| half-diminished | m7b5, ø, -7b5, h7, h | 1P,3m,5d,7m | 
| lydian dominant seventh | 7#11, 7#4 | 1P,3M,5P,7m,11A | 
| major ninth | maj9, Δ9, ^9 | 1P,3M,5P,7M,9M | 
| major seventh flat sixth | M7b6, ^7b6 | 1P,3M,6m,7M | 
| major seventh sharp eleventh | maj#4, Δ#4, Δ#11, M7#11, ^7#11, maj7#11 | 1P,3M,5P,7M,11A | 
| major seventh | maj7, Δ, ma7, M7, Maj7, ^7 | 1P,3M,5P,7M | 
| major sharp eleventh (lydian) | maj9#11, Δ9#11, ^9#11 | 1P,3M,5P,7M,9M,11A | 
| major thirteenth | maj13, Maj13, ^13 | 1P,3M,5P,7M,9M,13M | 
| major | M, ^, , maj | 1P,3M,5P | 
| minor augmented | m#5, -#5, m+ | 1P,3m,5A | 
| minor eleventh | m11, -11 | 1P,3m,5P,7m,9M,11P | 
| minor ninth | m9, -9 | 1P,3m,5P,7m,9M | 
| minor seventh | m7, min7, mi7, -7 | 1P,3m,5P,7m | 
| minor sixth | m6, -6 | 1P,3m,5P,6M | 
| minor thirteenth | m13, -13 | 1P,3m,5P,7m,9M,13M | 
| minor/major ninth | mM9, mMaj9, -^9 | 1P,3m,5P,7M,9M | 
| minor/major seventh | m/ma7, m/maj7, mM7, mMaj7, m/M7, -Δ7, mΔ, -^7, -maj7 | 1P,3m,5P,7M | 
| minor | m, min, - | 1P,3m,5P | 
| sixth added ninth | 6add9, 6/9, 69, M69 | 1P,3M,5P,6M,9M | 
| sixth | 6, add6, add13, M6 | 1P,3M,5P,6M | 
| suspended fourth flat ninth | b9sus, phryg, 7b9sus, 7b9sus4 | 1P,4P,5P,7m,9m | 
| suspended fourth seventh | 7sus4, 7sus | 1P,4P,5P,7m | 
| suspended fourth | sus4, sus | 1P,4P,5P | 
| suspended second | sus2 | 1P,2M,5P | 
Courtesy tonaljs via :
let lines = [];
for(let t of Tonal.ChordType.names()) 
{ 
    c = Tonal.Chord.get(t); 
    lines.push(`|${c.name}|${c.aliases.join(", ")}|${c.intervals}|`); 
}
lines.sort();
| Chroma | Interval | Description | 
|---|---|---|
| 0 | 1P | tonic, root | 
| 1 | 2m | minor second | 
| 2 | 2M | major second | 
| 3 | 3m | minor second | 
| 4 | 3M | major third | 
| 5 | 4P | perfect fourth | 
| 6 | 5d | diminished fifth | 
| 7 | 5P | perfect fifth | 
| 8 | 6m | minor sixth | 
| 9 | 6M | major sixth | 
| 10 | 7m | minor seventh | 
| 11 | 7M | major seventh | 
Interval alteration qualities: ..dd, d, m, M, P, A..
Roman Numeral chords are of use to describe key-agnostic chord progressions and are very common in Jazz leadsheets.
| example | interpretation | 
|---|---|
IMaj7 | 
major seventh chord off root | 
IIm7 | 
minor seventh chord off second | 
V7 | 
dominant fifth chord | 
bVIIMaj7 | 
flattened seventh as a major 7 | 
The Key context (Major, Minor, diminished, augmented, …) is represented by 
M, m, d, a, and the chord extension is represented by 
a number: 7, 11, etc. The chord root can be changed by preceding
the roman numeral field with b or #.
Generally:
[#|b]RomanNumber[quality][extension]
This notation can be combined with a key tonic to produce concrete chords. These still can be further qualified by providing a octave with the key tonic.
To produce triads off a C4 (middle-c) root:
Scale = "C4"
[I IIm IIIm IV] [V VIm VIId I]
Further reading here.