497 lines
13 KiB
Rust
497 lines
13 KiB
Rust
//! Word definitions for music theory, harmony, and chord construction.
|
|
|
|
use super::{Word, WordCompile::*};
|
|
|
|
pub(super) const WORDS: &[Word] = &[
|
|
// Music
|
|
Word {
|
|
name: "mtof",
|
|
aliases: &[],
|
|
category: "Music",
|
|
stack: "(midi -- hz)",
|
|
desc: "MIDI note to frequency",
|
|
example: "69 mtof => 440.0",
|
|
compile: Simple,
|
|
varargs: false,
|
|
},
|
|
Word {
|
|
name: "ftom",
|
|
aliases: &[],
|
|
category: "Music",
|
|
stack: "(hz -- midi)",
|
|
desc: "Frequency to MIDI note",
|
|
example: "440 ftom => 69.0",
|
|
compile: Simple,
|
|
varargs: false,
|
|
},
|
|
// Harmony
|
|
Word {
|
|
name: "key!",
|
|
aliases: &[],
|
|
category: "Harmony",
|
|
stack: "(root --)",
|
|
desc: "Set tonal center for scale operations",
|
|
example: "g3 key! 0 major => 55",
|
|
compile: Simple,
|
|
varargs: false,
|
|
},
|
|
Word {
|
|
name: "triad",
|
|
aliases: &[],
|
|
category: "Harmony",
|
|
stack: "(degree -- n1 n2 n3)",
|
|
desc: "Diatonic triad from scale degree (follows a scale word)",
|
|
example: "0 major triad => 60 64 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "seventh",
|
|
aliases: &[],
|
|
category: "Harmony",
|
|
stack: "(degree -- n1 n2 n3 n4)",
|
|
desc: "Diatonic seventh from scale degree (follows a scale word)",
|
|
example: "0 major seventh => 60 64 67 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chord voicings
|
|
Word {
|
|
name: "inv",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(a b c.. -- b c.. a+12)",
|
|
desc: "Inversion: bottom note moves up an octave",
|
|
example: "c4 maj inv => 64 67 72",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dinv",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(a b.. z -- z-12 a b..)",
|
|
desc: "Down inversion: top note moves down an octave",
|
|
example: "c4 maj dinv => 55 60 64",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "drop2",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(a b c d -- b-12 a c d)",
|
|
desc: "Drop-2 voicing: 2nd from top moves down an octave",
|
|
example: "c4 maj7 drop2 => 55 60 64 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "drop3",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(a b c d -- c-12 a b d)",
|
|
desc: "Drop-3 voicing: 3rd from top moves down an octave",
|
|
example: "c4 maj7 drop3 => 52 60 67 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Transpose
|
|
Word {
|
|
name: "tp",
|
|
aliases: &[],
|
|
category: "Harmony",
|
|
stack: "(n --)",
|
|
desc: "Transpose all ints on stack by N semitones",
|
|
example: "c4 maj 3 tp => 63 67 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Triads
|
|
Word {
|
|
name: "pwr",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root fifth)",
|
|
desc: "Power chord",
|
|
example: "c4 pwr => 60 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "maj",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth)",
|
|
desc: "Major triad",
|
|
example: "c4 maj => 60 64 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "m",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth)",
|
|
desc: "Minor triad",
|
|
example: "c4 m => 60 63 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dim",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth)",
|
|
desc: "Diminished triad",
|
|
example: "c4 dim => 60 63 66",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "aug",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth)",
|
|
desc: "Augmented triad",
|
|
example: "c4 aug => 60 64 68",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "sus2",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root second fifth)",
|
|
desc: "Suspended 2nd",
|
|
example: "c4 sus2 => 60 62 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "sus4",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root fourth fifth)",
|
|
desc: "Suspended 4th",
|
|
example: "c4 sus4 => 60 65 67",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Seventh
|
|
Word {
|
|
name: "maj7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Major 7th",
|
|
example: "c4 maj7 => 60 64 67 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Minor 7th",
|
|
example: "c4 min7 => 60 63 67 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Dominant 7th",
|
|
example: "c4 dom7 => 60 64 67 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dim7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Diminished 7th",
|
|
example: "c4 dim7 => 60 63 66 69",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "m7b5",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Half-diminished (min7b5)",
|
|
example: "c4 m7b5 => 60 63 66 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "minmaj7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Minor-major 7th",
|
|
example: "c4 minmaj7 => 60 63 67 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "aug7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Augmented 7th",
|
|
example: "c4 aug7 => 60 64 68 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "augmaj7",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh)",
|
|
desc: "Augmented major 7th",
|
|
example: "c4 augmaj7 => 60 64 68 71",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "7sus4",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root fourth fifth seventh)",
|
|
desc: "Dominant 7 sus4",
|
|
example: "c4 7sus4 => 60 65 67 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "9sus4",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root fourth fifth seventh ninth)",
|
|
desc: "9 sus4",
|
|
example: "c4 9sus4 => 60 65 67 70 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Sixth
|
|
Word {
|
|
name: "maj6",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth sixth)",
|
|
desc: "Major 6th",
|
|
example: "c4 maj6 => 60 64 67 69",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min6",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth sixth)",
|
|
desc: "Minor 6th",
|
|
example: "c4 min6 => 60 63 67 69",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "maj69",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth sixth ninth)",
|
|
desc: "Major 6/9",
|
|
example: "c4 maj69 => 60 64 67 69 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min69",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth sixth ninth)",
|
|
desc: "Minor 6/9",
|
|
example: "c4 min69 => 60 63 67 69 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Extended
|
|
Word {
|
|
name: "dom9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth)",
|
|
desc: "Dominant 9th",
|
|
example: "c4 dom9 => 60 64 67 70 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "maj9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth)",
|
|
desc: "Major 9th",
|
|
example: "c4 maj9 => 60 64 67 71 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth)",
|
|
desc: "Minor 9th",
|
|
example: "c4 min9 => 60 63 67 70 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom11",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth eleventh)",
|
|
desc: "Dominant 11th",
|
|
example: "c4 dom11 => 60 64 67 70 74 77",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "maj11",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth eleventh)",
|
|
desc: "Major 11th",
|
|
example: "c4 maj11 => 60 64 67 71 74 77",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min11",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth eleventh)",
|
|
desc: "Minor 11th",
|
|
example: "c4 min11 => 60 63 67 70 74 77",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom13",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth thirteenth)",
|
|
desc: "Dominant 13th",
|
|
example: "c4 dom13 => 60 64 67 70 74 81",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "maj13",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth thirteenth)",
|
|
desc: "Major 13th",
|
|
example: "c4 maj13 => 60 64 67 71 74 81",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "min13",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh ninth thirteenth)",
|
|
desc: "Minor 13th",
|
|
example: "c4 min13 => 60 63 67 70 74 81",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Add
|
|
Word {
|
|
name: "add9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth ninth)",
|
|
desc: "Major add 9",
|
|
example: "c4 add9 => 60 64 67 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "add11",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth eleventh)",
|
|
desc: "Major add 11",
|
|
example: "c4 add11 => 60 64 67 77",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "madd9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth ninth)",
|
|
desc: "Minor add 9",
|
|
example: "c4 madd9 => 60 63 67 74",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
// Chords - Altered dominants
|
|
Word {
|
|
name: "dom7b9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh flatninth)",
|
|
desc: "7th flat 9",
|
|
example: "c4 dom7b9 => 60 64 67 70 73",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom7s9",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh sharpninth)",
|
|
desc: "7th sharp 9 (Hendrix chord)",
|
|
example: "c4 dom7s9 => 60 64 67 70 75",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom7b5",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third flatfifth seventh)",
|
|
desc: "7th flat 5",
|
|
example: "c4 dom7b5 => 60 64 66 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom7s5",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third sharpfifth seventh)",
|
|
desc: "7th sharp 5",
|
|
example: "c4 dom7s5 => 60 64 68 70",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
Word {
|
|
name: "dom7s11",
|
|
aliases: &[],
|
|
category: "Chord",
|
|
stack: "(root -- root third fifth seventh sharpelev)",
|
|
desc: "7th sharp 11 (lydian dominant)",
|
|
example: "c4 dom7s11 => 60 64 67 70 78",
|
|
compile: Simple,
|
|
varargs: true,
|
|
},
|
|
];
|