Playing MIDI but no sound
See original GitHub issueHi all,
I tried playing MIDI on an Apache Cordova app. I used to be able to play, but now it’s just plain silent. The player keeps listening, but no sound at all, even if I already set the volume to 127.
MIDI.loadPlugin({
soundfontUrl: 'midi/soundfont/',
instruments: 'acoustic_grand_piano',
onsuccess: function () {
pluginLoaded = true;
var player = MIDI.Player;
player.loadFile("midi/files/h" + number + ".mid", function () {
MIDI.AudioTag.setVolume(0, 127);
MIDI.AudioTag.setVolume(1, 127);
for (var i = 0; i < 2; i++) {
MIDI.channels[i].mute = !document.getElementById('chkChannel' + (i + 1)).checked;
}
player.start();
$('#midiPlayPause > i').toggleClass('mdi-av-play-arrow mdi-av-pause');
loaded = true;
}, null, function (error) {
createToast('midi file does not exist.');
});
player.addListener(function (data) {
var now = data.now;
var end = data.end;
var channel = data.channel;
var note = data.note;
var velocity = data.velocity;
if (now + 1 > end) {
loaded = false;
$('#midiPlayPause > i').toggleClass('mdi-av-play-arrow mdi-av-pause');
}
});
}
});
What am I missing here? Thanks
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:8
Top Results From Across the Web
I have midi input, but no sound - Sunday Sounds, LLC
5. Select a channel strip, click the “MIDI Input” tab in the inspector area, make sure the “Keyboard:” section matches your assigned keyboard....
Read more >MIDI device recognized but no sound! - Apple Community
Been recording audio on Logic Pro 7 for ages with no problems. Decided to do some MIDI for the first time, and not...
Read more >MIDI keyboard not getting sound on laptop
If there's still no sound, troubleshoot with these possible solutions: 1) Check the volume settings of the tone generator and speaker system. 2) ......
Read more >MIDI signal but no sound-please help all treads on the matter ...
Double Check MIDI Filters in the Preferences > MIDI > MIDI Filter. Make sure Note is not enabled in the filter. Also make...
Read more >Simple Fixes For No Sound From Your MIDI Keyboard In ...
First, check to see if the MIDI keyboard is registering in Ableton. Second, ensure that you have a virtual instrument on the MIDI...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, I just encounter simular issue today and finally figure out another way instead of pre-compile the soundfont into code.
When you use webpack, the
MIDIobject is not registered to globalwindow(browser case). So the solution is very simple:perfect @jeffcaiz, it works!
guys don’t forget to declare the player like this:
const player = new MIDI.Player();