These days, new AudioContext() and requestMIDIAccess() need to be initiated by a user gesture.
Error messages in Firefox:
An AudioContext was prevented from starting automatically. It must be created or resumed after a user gesture on the page.
Uncaught (in promise) TypeError: selectMIDI is null
populateMIDIInSelect https://webaudiodemos.appspot.com/midi-synth/js/midi.js:44
onMIDIStarted https://webaudiodemos.appspot.com/midi-synth/js/midi.js:87