Skip to content
View source

musicGenerated

Category: Packages · Manifest: use "kernels/";

Music’s words, not a program’s music.

Music’s words, not a program’s music: scales and chords (the modes and the semitones of their degrees, a note’s pitch, the chords stacked on a degree), an instrument’s note (an Instrument row: how it sounds, its envelope, its vibrato, its chorus). A program makes its songs, tunes and palette of instruments of them (the study’s game_music is one).

Layer: Media. Uses: audio, random.

use "music.entpkg";
  • kernels/instrument.ent — An instrument and its note.
  • kernels/scale.ent — Scales and chords.

tests/ holds scenes and their replays, run on every backend: notes.replay.

Function Brief
osc_additive() -> Int
osc_square() -> Int
osc_triangle() -> Int
osc_bell() -> Int
osc_pluck() -> Int
osc_breath() -> Int
note_level(ins: Instrument, t: Float, held: Float) -> Float How loud a note is t seconds in, held held: its attack, its decay to its sustain, its release after it is let go.
note_tail(ins: Instrument) -> Float How long after it is let go a note is still heard.
timbre(ins: Instrument, p: Float, t: Float, seed: Int) -> Float One voice of an instrument whose pitch has run p turns, t seconds in (the turns, not the pitch times the time: its vibrato moves it).
play_note(ins: Instrument, semis: Float, t: Float, held: Float, seed: Int) -> Float A note of an instrument at semis (semitones above the C below middle C), t seconds in, held held: its two voices, a little apart, its vibrato coming in after the attack.
mode_major() -> Int
mode_dorian() -> Int
mode_phrygian() -> Int
mode_lydian() -> Int
mode_mixolydian() -> Int
mode_minor() -> Int
mode_harmonic() -> Int
mode_pentatonic() -> Int
mode_minor_pentatonic() -> Int
mode_in() -> Int
mode_hijaz() -> Int
pentatonic(m: Int) -> Bool Whether mode m has five degrees to an octave.
scale_step(m: Int, d: Int) -> Int Degree d (any whole number; seven to an octave, five in the pentatonic ones) of mode m, in semitones above its root.
degrees_of(m: Int) -> Int How many degrees an octave has in mode m.
pitch_of(semis: Float) -> Float The pitch (Hz) of a note semis semitones above the C below middle C.
chord_degree(m: Int, root: Int, k: Int) -> Int Tone k (0 root, 1 third, 2 fifth, 3 seventh) of the chord on degree root of mode m, in degrees: thirds stacked on the scale (in a pentatonic one, every other degree).
nearest_chord_degree(m: Int, root: Int, d: Int) -> Int The degree, of those of chord root, nearest degree d.
Name Syntax
Instrument struct Instrument
Instruments type Instruments = Rows<Instrument>;

notes.replay