src/MidiNumbers.js
function buildMidiNumberAttributes(midiNumber) {
  const pitchIndex = (midiNumber - MIDI_NUMBER_C0) % NOTES_IN_OCTAVE;
  const octave = Math.floor((midiNumber - MIDI_NUMBER_C0) / NOTES_IN_OCTAVE);
  const pitchName = SORTED_PITCHES[pitchIndex];
  return {
    note: `${pitchName}${octave}`,
    pitchName,
    octave,
    midiNumber,
    isAccidental: ACCIDENTAL_PITCHES.includes(pitchName),
  };
}
function buildMidiNumberAttributes(midiNumber) {
  const pitchIndex = (midiNumber - MIDI_NUMBER_C0) % NOTES_IN_OCTAVE;
  const octave = Math.floor((midiNumber - MIDI_NUMBER_C0) / NOTES_IN_OCTAVE);
  const pitchName = SORTED_PITCHES[pitchIndex];
  return {
    note: `${pitchName}${octave}`,
    pitchName,
    octave,
    midiNumber,
    isAccidental: ACCIDENTAL_PITCHES.includes(pitchName),
  };
}
function buildMidiNumberAttributes ( midiNumber ) { const pitchIndex = ( midiNumber - MIDI_NUMBER_C0 ) % NOTES_IN_OCTAVE ; const octave = Math . floor ( ( midiNumber - MIDI_NUMBER_C0 ) / NOTES_IN_OCTAVE ) ; const pitchName = SORTED_PITCHES [ pitchIndex ] ; return { note : ` ${ pitchName } ${ octave } ` , pitchName , octave , midiNumber , isAccidental : ACCIDENTAL_PITCHES . includes ( pitchName ) , } ; }
Build cache for getAttributes
Build cache for getAttributes