Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static pitch_name_to_number(pitch_name){
if (typeof(pitch_name) == "number") { return pitch_name }
else {
if (pitch_name.startsWith("R")) { return -1 } //rest, It might have an octave on it
if(!is_digit(last(pitch_name))) { pitch_name += "4" } //the oct of middle C
return WebMidi.guessNoteNumber(pitch_name)
}
}