Chord Mapper
Brief Description
Chord Mapper is a Rust project that provides a command-line utility for parsing chord notations and mapping them to the individual musical notes they consist of.
-
parsing process: the parsing itself is delegated to the 'pest' crate. So the details about parsing process can be found here: https://docs.rs/pest/2.7.5/pest/
-
what exactly is being parsed: actually only strings representing chords in international chord notations, like "C#", "C#m" are being parsed.
-
how the results of the parsing will be used: the parsed string is converted to a program's chord representation which is then converted to the set of notes that make the chord up. Example: "Am" -> "A-C-E" (because A, C and E notes make up chord Am).
Grammar Rules
Chord Mapper uses a custom grammar to parse chord notations. The grammar rules are defined as follows:
root =
delimitor =
chord =
major_chord =
minor_chord =
tonic =
bare_note =
sharped_note =
flatted_note =
root: Represents the root rule for parsing a chord notation.delimitor: Matches any number of spaces used as delimiters.chord: Defines the structure of a chord, which can be either amajor_chordor aminor_chord.major_chord: Represents a major chord consisting of atonic.minor_chord: Represents a minor chord consisting of atonicfollowed by 'm'.tonic: Specifies the core note of a chord, which can be asharped_note,flatted_note, orbare_note.bare_note: Matches bare note names, such as 'A', 'B', 'C', 'D', 'E', 'F', 'G', or 'H'.sharped_note: Matches sharped note names, like 'A#', 'C#', 'D#', 'F#', or 'G#'.flatted_note: Matches flatted note names, including 'Db', 'Eb', 'Gb', 'Ab', or 'Bb'.
Usage
The Chord Mapper project includes a command-line interface (CLI) that allows you to interact with the tool. Here are some available commands:
-
parse: Use this command to parse a chord notation and display its constituent notes.Example:
chord_mapper parse Cm -
help: Show information about how to use the Chord Mapper CLI.Example:
chord_mapper help -
credits: Show information about the project and its contributors.Example:
chord_mapper credits
Chord Mapper is an essential tool for musicians and music enthusiasts, helping you understand chord notations and their underlying musical components.