Parse chords and chord sheets in Elm
A chord has a note which gives it a name and a general quality.
The quality of the chord. Most well known chord types are described by a tertian quality, which means a chord characterized by a root note, a third and a fifth. We might want to have less notes, or more notes, or replace the root note with another.
This type contains chords characterized by a root note, a third (minor or major) and a fifth (diminished, perfect or augmented)
toString : Chord -> String
Converts a Chord to a string.
toIntegerNotation : Chord -> ( Note, List Basics.Int )
Converts a Chord to its integer notation, which is the distance in semitones of every note from the root.
This type represents either a successfully parsed Chord or a portion of the song lyrics. Thanks to the design of the line parser, the lyrics will always be non-empty.
chordParser : Parser Chord
The actual chord parser. Using this you can create your own line parser, for example if you want to parse chords separated by spaces, or curly brackets.
lineParser : Parser (List Token)
The actual line parser. You can use this if you want to customize the line parsing, for example if you want to parse the whole song together.
parseChord : String -> Result (List Parser.DeadEnd) Chord
Parses a string to a Chord. The return value is a result which either returns a Chord or a String that describes why we couldn't parse successfully.
parseLine : String -> Result (List Parser.DeadEnd) (List Token)
Parses a line of a song to a list of Tokens. When we cannot parse the line successfully, we will return a description of why the parsing failed. We will also automatically merge adjacent lyrics tokens.
parseSheet : String -> List (Result (List Parser.DeadEnd) (List Token))
Parses a full song line by line.
Basics.Int
Which fret it is being pressed.
List (Maybe ( Fret
, Pitch )
}
For each string of our instrument, we could be muting the string, playing an open string or pressing a particular fret.
voicingToString : Voicing -> String
Converts a Voicing to a compact string representation. For example, the C Major chord is written as "032010", while the D Major chord is written as "XX0232".