Skip to main content

Module chord

Module chord 

Source
Expand description

The chord-symbol parser.

A symbol is a root letter with an optional sharp or flat, a spelling from a chord entry of the dictionary, and an optional /X bass note. Parentheses list alterations (C7(b9,#11)), and no3, omit3 and no5 remove a tone. A 5 straight after the root is the power chord, so Cb5 is a power chord on Cb, not C with a flat fifth. A spelling outside the dictionary is an error that names it. The tones of a symbol with several readings follow the dictionary’s policy, not any one program.

use sound_to_patch::music::chord::parse_chord;

let chord = parse_chord("Am7/G")?;
assert_eq!((chord.root, chord.tones.as_slice(), chord.bass), (9, &[0, 3, 7, 10][..], Some(7)));
assert_eq!(chord.entry, Some("chord.minor-seventh"));

Structs§

ChordSymbol
A parsed chord symbol.

Constants§

ALTERED_DOMINANT
The one chord entry that chooses its tones; its spellings take ALT_TONES.
ALT_TONES
The tones the parser gives alt: the dominant’s root, third and seventh with a sharp ninth and a flat thirteenth.

Functions§

parse_chord
Parses a chord symbol such as Cmaj7, F#m7b5, Bb7(b9), C13b9 or C/E.