%% readmidi
%  Conversion of MIDI file to notematrix
%  [nmat, mstr] = readmidi(fn);
%
%  Input argument:
%    FN = name of the MIDI file (string)
%
%  Output:
%    NMAT = notematrix
%    MSTR = midi structure (ala Ken Schutte's midi file reader)
%
%  Music Dynamics Lab read midi function created to replace the 
%  MIDI Toolbox function READMIDI
%  New wrapper function for midi2nmat
%  See License.txt
%
%
% Adapted back to miditoolbox by TE and PT 17.5.2016

%%
function [nmat, mstr] = readmidi(fn)

mstr = mdlMidiToMStr(fn);
nmat = mdlMStrToNMat(mstr);
nmat = nmat(setdiff(1:size(nmat,1),find(nmat(:,2)==-1)),:); % remove notes with duration -1; PT 17.5.2016