Replies: 2 comments
-
MIDI channels are from 1 to 16. There is no channel 0. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Since this is not a bug, I moved the issue to the Discussions section. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Describe the problem and how to reproduce it. If appropriate, include code samples, screenshots, error messages, etc.
Environment:
Specify the environment where you are witnessing the problem:
Details
Add any other information, context or details that could help track down the problem.
Trying to add web midi to a project but have issues:
TypeError: Cannot read properties of undefined (reading 'channels')
at onEnabled (main.js:303:1)
import {WebMidi} from "webmidi";
WebMidi
.enable()
.then(onEnabled)
.catch(err => console.log(err));
function onEnabled() {
if (WebMidi.inputs.length < 1) {
document.body.innerHTML+= "No device detected.";
} else {
WebMidi.inputs.forEach((device, index) => {
document.body.innerHTML+=
${index}: ${device.name} <br>
;});
}
const mySynth = WebMidi.inputs[0];
// const mySynth = WebMidi.getInputByName("TYPE NAME HERE!")
mySynth.channels[0].addListener("noteon", e => {
document.body.innerHTML+=
${e.note.name} <br>
;});
}
window.WebMidi = WebMidi;
when I call window.WebMidi() in console output is:{
"eventMap": {},
"eventsSuspended": false,
"defaults": {
"note": {
"attack": 0.5039370078740157,
"release": 0.5039370078740157,
"duration": null
}
},
"interface": {},
"validation": true,
"_inputs": [],
"_disconnectedInputs": [],
"_outputs": [],
"_disconnectedOutputs": [],
"_stateChangeQueue": [],
"_octaveOffset": 0,
"constructor": null
}
calling window.inputs logs
[]
Same error appears when I try to play a note instead.
App is developed with react.js, ionic and capacitor.js
Node.js v17.8.0
Language: Javascript
On MacOs BigSur
Beta Was this translation helpful? Give feedback.
All reactions