Skip to content

Commit

Permalink
fix range not set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
TeemuKoivisto committed Jan 18, 2024
1 parent 8044a80 commit ac12d61
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/client/src/utils/midi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ export function parseNote(val: string): Result<number> {
} catch (err) {
return { err: `Couldn't parse note "${val}" octave`, code: 400 }
}
const found = Object.values(C_MAJOR_NOTES).find(n => n.note === note)
if (!found) {
const found = Object.values(C_MAJOR_NOTES).findIndex(n => n.note === note)
if (found === -1) {
return { err: `Note "${val}" not found in scale`, code: 400 }
}
return { data: 12 + octave * 7 + found.steps }
return { data: 12 + octave * 12 + found }
} else {
return { err: `Unrecognized note "${val}"`, code: 400 }
}
Expand Down

0 comments on commit ac12d61

Please sign in to comment.