How to use the midi.loadPlugin function in midi

To help you get started, we’ve selected a few midi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github panarch / concerto / src / Player.js View on Github external
Player.prototype.load = function load(callback, soundfontUrl) {
        if (this.loaded) {
            callback();
            return;
        }

        // TODO: should parse musicjson and load proper instruments, currently only support piano
        MIDI.loadPlugin({
            soundfontUrl: soundfontUrl,
            instrument: 'acoustic_grand_piano',
            callback: _callback.bind(this)
        });

        function _callback() {
            this.loaded = true;
            callback();
        }
    };