2.2.2 • Published 7 years ago
tonal-index v2.2.2
tonal-index
:books: Music theory library providing iterable collections of every possible note, scale and chord
If you have ever needed to iterate through every possible note, scale, or chord in your music applications then tonal-index is the answer.
tonal-index uses tonal to dynamically generate and aggregate each collection.
Modes
Because tonal-index generates relatively large sets of data it may be loaded in either warm or lazy mode.
- Warm: Pre-generates and caches all of the possible collection values
- Lazy: Defers generation until the collections are actually needed (default)
Install
npm install --save tonal-index
then, either:
// warm / pre-cached module
const music = require('tonal-index')()or
// lazy module
const music = require('tonal-index')API
all
- Types:
notes,scales, andchords - Returns: Every possible combination of
notes,scales, orchords
const { notes, scales, chord } = require('tonal-index')
notes.all() // [ 'C', 'C#', 'Db', 'D', 'D#', 'Eb', ...]
scales.all() // 1530 results
chords.all() // 1853 resultsby
Queries scale or chord collections by either type or root.
- Types:
scales,chords - Params:
key: Either'type'or'root'(i.e. the rootnoteof thescaleorchord)value: The value to compare all other values against
- Returns: Entire collection filtered by entries matching a
keyandvalue
const { scales, chords } = require('tonal-index')
const majScales = scales.by('type', 'major')
const min7Chords = chords.by('type', 'm7')each
- Types:
scales,chords - Returns: Each combination of
scales, orchords, one element at a time (generator)
const { scales } = require('tonal-index')
const generate = scales.each()
generate.next()Output
You can find the full list of chords and scales in test/fixtures/*
Types
note
- Type:
string - Format: Scientific notation
scale and chord
- Type:
object - Properties:
type:- Type:
string - Format: Scientific notation
- Examples:
"+add#9","m7","major"
- Type:
root:- Type:
string - Format: Scientific notation
- Example:
"C"
- Type:
notes:- Type:
Array<string> - Format: Scientific notation
- Example:
["C", "E", "G#", "D#"]
- Type:
Future
- Optionally group by root note
- Configurable octaves
- Chord voicings
- Chord inversions
- Streamed collection
- Generator collection
License
MIT