Skip to content

Instantly share code, notes, and snippets.

@jnslxndr
Created May 14, 2023 05:11
Show Gist options
  • Save jnslxndr/e669db1b9c85079605f1f1e6de87db8f to your computer and use it in GitHub Desktop.
Save jnslxndr/e669db1b9c85079605f1f1e6de87db8f to your computer and use it in GitHub Desktop.
// A one liner to convert a decimal MIDI note pitch to human readable notation
const midiNote2Name = (i, offset=-2) => `${["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][i%12]}${Math.floor(i / 12) + offset}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment