Matlab MIDI note value input not working, but control values are working

3 views (last 30 days)
I have a question about MIDI in matlab: I have a hard time getting the note values of a midi keyboard into matlab. I need them in real-time. Getting control information from sliders and such works, but I can't get the key note value recognition to work. I've searched around for this also, but no success.
PS There is no problem with my midi keyboard!

Answers (2)

Arnav Mendiratta
Arnav Mendiratta on 3 Mar 2017
As the following link mentions, you should start MATLAB after you have connected your MIDI device:
Verify that MATLAB is able to identify the connected MIDI controller when you execute "midiid" in MATLAB Command Window. When you call "midiid" MATLAB waits for a Control Change message from your MIDI Device. When you use a control on your MIDI Board, MATLAB recieves a Control Change message and it returns a control number corresponding to the MIDI controller number that you interacted with on your MIDI hardware. The following link describes how MATLAB defines control numbers:
Note that 'midiid' and associated MIDI functions are for use with MIDI control surfaces and only respond to MIDI Control Change messages. The keyboard sends other kinds of messages (Note On, etc). Please refer to the MIDI implementation of your device's Manual to verify what knobs, sliders, pedals etc. can send Control Changes messages which would be recognized by 'midiid'.
Also, the keyboard may have to be in a particular mode for the controls to work. MIDI Monitor is probably the best way to figure out what the keyboard is sending. If it is sending Control Change messages, 'midiid' should be able to see them.
There are other failure modes. For example, two programs cannot share a MIDI device. If another program (e.g., MIDI Monitor) is still connected to the keyboard, MATLAB will not be able to find it.
There is also a File Excange submission you could look into. As the author mentions, this only works on Windows XP and later:
Here are some other tools from the community that are available for you to try:

Charlie DeVane
Charlie DeVane on 13 Dec 2018
The R2018a release of Audio System Toolbox added these capabilities to MATLAB.
Search the documentation for "MIDI Device Interface".
hope this helps,
Charlie

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!