TuningFork.SonicPi.Names (TuningFork v0.1.4)

Copy Markdown View Source

Notes, chords and scales by Sonic Pi's names, as MIDI numbers.

iex> TuningFork.SonicPi.Names.chord(:e3, :m7)
[52, 55, 59, 62]

Summary

Functions

The notes of a chord, as MIDI numbers.

A chord built on the degreeth note of a scale: count notes, every other scale step.

The chord names known.

The degreeth note of a scale as a MIDI number, counting from 1.

The frequency of note in hertz. A float is already one.

A MIDI number, fractional, for a frequency in hertz.

The MIDI number of note, or nil for nil. Hertz become a fractional number.

midi/1, moved to octave octave when one is given.

Hertz for a MIDI number, which may be fractional.

The name of a MIDI number, the way TuningFork.Notes.name_of/1 spells it.

The notes of a scale as MIDI numbers, from root up :num_octaves octaves (default 1) and the note above.

The scale names known.

Functions

chord(root, name, opts \\ [])

@spec chord(term(), atom() | String.t(), keyword()) :: [integer()]

The notes of a chord, as MIDI numbers.

:num_octaves repeats it up the keyboard; :invert moves the lowest notes up an octave that many times.

chord_degree(degree, tonic, scale_name, count \\ 4, opts \\ [])

@spec chord_degree(integer(), term(), atom(), pos_integer(), keyword()) :: [integer()]

A chord built on the degreeth note of a scale: count notes, every other scale step.

:invert as chord/3.

chords()

@spec chords() :: [atom()]

The chord names known.

degree(degree, tonic, scale_name)

@spec degree(integer(), term(), atom()) :: integer()

The degreeth note of a scale as a MIDI number, counting from 1.

hz(hz)

@spec hz(term()) :: float()

The frequency of note in hertz. A float is already one.

hz_to_midi(hz)

@spec hz_to_midi(number()) :: float()

A MIDI number, fractional, for a frequency in hertz.

midi(midi)

@spec midi(term()) :: number() | nil

The MIDI number of note, or nil for nil. Hertz become a fractional number.

midi(note, opts)

@spec midi(term(), keyword()) :: number() | nil

midi/1, moved to octave octave when one is given.

midi_to_hz(midi)

@spec midi_to_hz(number()) :: float()

Hertz for a MIDI number, which may be fractional.

name(midi)

@spec name(number()) :: atom()

The name of a MIDI number, the way TuningFork.Notes.name_of/1 spells it.

scale(root, name, opts \\ [])

@spec scale(term(), atom() | String.t(), keyword()) :: [integer()]

The notes of a scale as MIDI numbers, from root up :num_octaves octaves (default 1) and the note above.

scales()

@spec scales() :: [atom()]

The scale names known.