Why does no sound emit from this soundfont midi player replication?

375 views Asked by At

I am attempting to replicate the functionality of this soundfont based midi file player with verbatim javascript and html.

Despite no errors (except a favicon 404 error), no sounds emit when playing a midi file. However, events are displayed in the event monitor as if they're being played, and the soundfont notes play when clicking on the GM player piano keys.

I have no issues when running the linked demo.

This project appears to be unprecedented in being able to play midi files with directly uploaded .sf2 files. You may particularly be interested in this if you're familiar with MIDI.js.

Please indicate what could be causing this issue, or if interested in this project, any posted findings would be helpful (even if you experience no issues).

1

There are 1 answers

4
ballade4op52 On

A forked version was being used where https was not being forced as with the following script (required for the service worker script (sw.js)):

    <script>
    if (window.location.protocol !== 'https:' && window.location.hostname!='localhost') {
        window.location = 'https://' + window.location.hostname + window.location.pathname + window.location.hash;
    }
    </script>

This script was initially removed due to the inhibition of page loading as the site was not enforcing https