Parsing strings to chords #22
-
Hey! I have a simple use-case where I want to parse strings into the correct chords:
Can this be done with this crate? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi! The library provides It wouldn't be a huge modification to allow abbreviations. In fact, the regex parses are already case insensitive, and effectively ignore whitespace. One would just have to extend the regexes in |
Beta Was this translation helpful? Give feedback.
Hi! The library provides
from_regex
functions for most domains, including chords and scales. The general form of the regex is<root> <quality> <number>
, where quality and number are optional. That means thatC#
will work as you indicate. To get D# major 7, you would have to passD# major seventh
orD# maj seventh
, as the number must be fully spelled out (though number and quality are case insensitive, and number can be omitted). C# minor can be retrieved by passingC# minor
orC# min
.It wouldn't be a huge modification to allow abbreviations. In fact, the regex parses are already case insensitive, and effectively ignore whitespace. One would just have to extend the regexes in
number.rs
and…