How to properly release a MIDI device object?

1 view (last 30 days)
Hi!
I'm using an external MIDI keyboard, which I'm accessing through
device = mididevice('Teensy MIDI');
after running my code, I can't rerun it without Matlab hanging, and I can't close Matlab since it hangs all the same, and I end up killing it.
I'm pretty sure it's due to the MIDI device not being properly released, combined with the code starting by calling
clear all
when I try to manually 'clear device' I get the same behavior.
I've tried 'release' as well, but to no avail...
Thanks!

Answers (1)

Brandon Stevens
Brandon Stevens on 11 Nov 2022
There are a few ways you can 'release' a MIDI device depending on how you are using it in your code.
If you also use an audio device writer object when accesing your keyboard, you can use 'release' on that system object. For an example, check out the one on this page:
I would not expect just having a mididevice interface to cause MATLAB to hang.
If you have any follow-up questions, please reach out to MathWorks Technical Support

Categories

Find more on Musical Instrument Digital Interface (MIDI) in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!