Error in audioDetect.js of MIDI.js (midicube)

49 views Asked by At

I'm trying to use MIDI.js (because I don't know how else to play MIDI files smoothly when the browser tab is not in focus). More specifically, I'm trying a new version of MIDI.js called midicube.

Like in the readme, I do

<script src="releases/midicube.js"></script>
<script>
MIDI.loadPlugin({
    // this only has piano. 
    // for other sounds install the MIDI.js 
    // soundfonts somewhere.
    soundfontUrl: "./examples/soundfont/",
    onerror: console.warn,
    onsuccess: () => {
        MIDI.noteOn(0, 60, 0);
    }
});
</script>

but I get

audioDetect.js:38 Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
    at s (audioDetect.js:38:22)
    at audioDetect.js:106:9
    at Module.$t (index.js:94:5)
    at mytest.html:3:6
s @ audioDetect.js:38
(anonymous) @ audioDetect.js:106
$t @ index.js:94
(anonymous) @ mytest.html:3
audioDetect.js:36 Uncaught TypeError: Cannot read properties of null (reading 'removeChild')
    at Audio.<anonymous> (audioDetect.js:36:8)

Here are the lines of code that cause the error. Am I doing something wrong or is midicube outdated in some way (latest commit 3 years ago)?

0

There are 0 answers