3.3 MIDI File I/O

3.3.1 ismidifile

: ismidi = ismidifile (filename)

Check if filename is a midi file.

The function only checks whether it is an existing file and the file starts with a valid ’MThd’ header.

Non existing files, or files that do not meet the header criteria will return false.

Inputs

filename - filename of file to check.

Outputs

ismidi - true if it is a midi file, false otherwise

See also: midifileread, midifilewrite.

3.3.2 midifileinfo

: info = midifileinfo (filename)

Read MIDI file and display information about the tracks and data

Inputs

filename - filename of file to open.

Outputs

info - structure of the midi file data with the following fields:

filename

the name of the file

header

The header block information

track

An array of tracks read from the file

other

An array of non-track midi blocks read from the file

See also: midifileread.

3.3.3 midifileread

: msg = midifileread (filename, [propertyname, propertyvalue …])

Read MIDI file into a midimsg

Inputs

filename - filename of file to open.
propertyname, properyvalue - optional propertyname/value pairs.

Known property values are:

includemetaevents

A True/False value to include MetaEvents in the out message list.

Outputs

msg - a midimsg struct containing the messages read from the file

See also: midifileinfo, midimsg.

3.3.4 midifilewrite

: midifilewrite (filename, msgs)
: midifilewrite (filename, msgs, optionname, optionvalue)

Write a midifile

Inputs

filename - filename of file to open.
msg - a midimsg struct or a cell array of midimsg containing data to write to file
optionname, optionvalue - option value/name pairs

Known options are:

format

MIDI file format number. (0 (default), 1, 2)

Where format is 0, if a cell array is passed to midifilewrite, the midimsg values will be concatenated together before saving.

Were format is not 0, the cell array is treated as tracks of misimsg.

Outputs

None

See also: midifileread, midimsg.


Next: Enumerations, Previous: MIDI Controller Interface, Up: Function Reference   [Contents][Index]