Skip to content

Instantly share code, notes, and snippets.

@francoisgeorgy
Created June 7, 2020 06:27
Show Gist options
  • Select an option

  • Save francoisgeorgy/67e0415b087640f662213db83e40f834 to your computer and use it in GitHub Desktop.

Select an option

Save francoisgeorgy/67e0415b087640f662213db83e40f834 to your computer and use it in GitHub Desktop.
tonal cookbook #tonal #music #javascript
// https://github.com/tonaljs/tonal/issues/108
// To obtain the scale properties, use the scale function:
import { scale } from "@tonaljs/scale"
scale("G aeolian").notes // => ["G", "A", "Bb", ... ]
// To obtain the chords, use the scaleChords function from the same package:
import { scaleChords } from "@tonaljs/scale"
scaleChords("aeolian")
// Getting a diatonic chord sequence starting from a given note
// https://github.com/tonaljs/tonal/issues/161
Key.majorKey('g4').chords.map(chord => Chord.get(chord).notes.slice(0,3))
/*
[
[ 'G4', 'B4', 'D5' ],
[ 'A4', 'C5', 'E5' ],
[ 'B4', 'D5', 'F#5' ],
[ 'C5', 'E5', 'G5' ],
[ 'D57', 'F#57', 'A57' ],
[ 'E5', 'G5', 'B5' ],
[ 'F#5', 'A5', 'C6' ]
]
/*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment