Skip to content

Commit

Permalink
feat: only parse accident on second char
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasmafra committed Jan 31, 2024
1 parent 850d5fa commit cdf19b0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions theory/PitchNotation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ export default {
textToChroma(text) {
const letter = text.substring(0, 1);
let chroma = notes.indexOf(letter);
if (text.includes('#')) chroma++;
if (text.includes('b')) chroma--;
if (text.length > 1) {
const acc = text.substring(1, 2);
if (acc == '#') chroma++;
if (acc == 'b') chroma--;
}
return (chroma + 12) % 12;
},
pitchToText(midiNumber) {
Expand Down

0 comments on commit cdf19b0

Please sign in to comment.