Code covered by the BSD License  

Highlights from
MIDI Interface for MATLAB

image thumbnail

MIDI Interface for MATLAB


Tucker McClure (view profile)


04 Sep 2012 (Updated )

Supports bringing incoming MIDI data into MATLAB on Windows.

% midi_interface - Interface for acquiring MIDI messages from one of the
% system's MIDI input devices. Only works on Windows XP and above.
% Usage:
% [success, device] = midi_interface('open') prompts the user for MIDI
% devices to open, opens a device, and returns the success and device id.
% success = midi_interface('open', device) opens the specified device (by
% number or string name) and returns the success.
% midi_interface('close') closes the current MIDI device.
% [messages, times] = midi_interface() returns the buffer of messages and
% message times and clears the buffer. One message is a 1x3 matrix of ints.
% The first value is the first "byte", etc. The meaning of the values can
% be found here: The timing
% values are milliseconds since the interface was started (since the 'open'
% command). These values come from the system's MIDI driver via Windows.
% Notes:
% - Only 1 device can be open at a time.
% - A new device cannot be opened until the first is properly closed.
% - The maximum buffer size is 65536 messages. Beyond this number, messages
%   will be dropped, so the buffer should be checked quickly.
% Tucker McClure @ The MathWorks
% Copyright 2012-2013 The MathWorks, Inc.

Contact us