-
Hi, there a some kind of newbie questions from my site. I just got a cme WIDI MASTER and i managed it to connect it to my hardware midi device via bluetooth(WIN 10). So now i try to make this with webmidi.js. Main questions / concepts i don't understand yet:
this is the js file for tests, loaded at startup (sending cc 48 while loading the page does work like expected) WebMidi
.enable({sysex:true})
.then(onEnabled)
.catch(err => alert(err));
function onEnabled() {
console.log(WebMidi.inputs);
console.log(WebMidi.outputs);
var kemperMidiOut = WebMidi.getOutputByName("WIDI Master OUT")
var kemperMidiIn = WebMidi.getInputByName("WIDI Master IN")
kemperMidiIn.addListener("controlchange", e => {
console.log(`Received 'controlchange' message.`, e);
},
{channels: [1, 2, 3]}
);
kemperMidiOut.channels[1].sendControlChange(48,0) //send cc 48
//console.log(WebMidi)
} Thanks, and sorry for the bad code formatting, i don't know why... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
There's a lot to unpack here. First, I fixed the layout of your code. When you want to display a block of code, you need to enclose it in triple backticks.
No. Only once at the beginning.
I'm not sure I understand your question. Unless you really want to listen on channels 1, 2 and 3, you are better off adding the listener to the channel itself: kemperMidiIn.channels[1].addListener("controlchange", e => {
console.log(`Received 'controlchange' message.`, e);
});
You can use a 3rd party tool. I use MIDI Monitor on macOS. While I haven't tried it, there's a tool called MIDI View that is cross-platform. You can also add a listener for the
The |
Beta Was this translation helpful? Give feedback.
-
No. If you want it global, declare the variable outside the function and assign a value to it inside the function.
You are the one responsible for sending outbound messages so you can filter them anyway you want without having to add a listener. Adding an event for outbound messages merely adds another way to do it. |
Beta Was this translation helpful? Give feedback.
-
You will have to read up on how promises work. If you want to display the outputs, you have to wait for the promise returned by calling |
Beta Was this translation helpful? Give feedback.
-
i allready tried what you suggested, but with this solution i don't have a way to supply different parameters(would be doable in supplying parms in "onEnabled" ), and it is executeable once...
i came along with this version, "sendKemperMidiout" can be called as wanted. There will be a lot to learn here, thanks for taking time to reply! |
Beta Was this translation helpful? Give feedback.
No. If you want it global, declare the variable outside the function and assign a value to it inside the function.
You are the one responsible for sending outbound messages so you can filter them anyway you want without having to add a listener. Adding an event for outbound messages merely adds another way to do it.