TuningFork.Chord (TuningFork v0.1.0)

Copy Markdown View Source

Chord names to the MIDI notes that play them.

iex> TuningFork.Chord.notes("C^7")
[60, 64, 67, 71]

Summary

Functions

The MIDI notes of name, low to high, or [] for a name it does not know.

The same chord moved to octave, where 4 is where notes/1 leaves it.

Every quality this knows, sorted.

Functions

notes(name)

@spec notes(term()) :: [integer()]

The MIDI notes of name, low to high, or [] for a name it does not know.

name is a string or atom made of a root letter, an optional accidental (#, s or b) and one of qualities/0: C, Eb, F#m7, Bb^9. The root is read at octave 4, so C is 60.

iex> TuningFork.Chord.notes("F#m7")
[66, 69, 73, 76]
iex> TuningFork.Chord.notes("nonsense")
[]

octave(name, octave)

@spec octave(term(), integer()) :: [integer()]

The same chord moved to octave, where 4 is where notes/1 leaves it.

iex> TuningFork.Chord.octave("C", 3)
[48, 52, 55]

qualities()

@spec qualities() :: [String.t()]

Every quality this knows, sorted.