Skip to content

Play different instruments in a flexible way #226

@Owwwl9

Description

@Owwwl9

I'd like to play several midi-files after one another, like sort of a playlist. According to the midi-file I'd like to get all its instruments to play. Sofar I only achieve that like this:

var player;
var instruments;

window.onload = function () {
    MIDI.loadPlugin({
        soundfontUrl: './soundfont/',
        onsuccess: function () {
            player = MIDI.Player;
            player.timeWrap = 1;
            player.loadFile('test.mid', function () {
                instruments = player.getFileInstruments();
                for (var i = 0; i < instruments.length; i++) {
                    MIDI.programChange(i, MIDI.GM.byName[instruments[i]].number);
                }
                player.start();
            });
        }
    });
};

However they either seem to play on the wrong channel or somehow the wrong soundfont is assigned. So for example, the clarinet plays the piano's melody. I couldn't figure out how to solve that problem.

I'd be really happy about some advice or ideas :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions