2 Basic Usage Overview

The Audio package must be loaded each time a GNU Octave session is started:

pkg load audio

The Audio toolkit provides 3 main types of MIDI functionality:

Device functions

These are functions that directly allow opening, sending and receiving MIDI messages.

Controller functions

Functions that provide a layer on top of the device functions for using MIDI controls.

File functions

Basic functions that allow read and write of MIDI files.

To read and write to a MIDI device, a MIDI device object must be created, using the name or id of a known MIDI device as provided by the mididevinfo function.

MIDI devices can then be read using the midisend and midireceive functions that use midimsg type to encapsulate the MIDI data.

% list the midi devices
devs = mididevinfo

% open a midi device, specifying the first input and output MIDI device
dev = mididevice("input", devs.input{1}.ID, "output", devs.output{1}.ID)

% receive data and echo it through the output port
while true
  msg = midireceive(dev, 1);
  if !isempty(msg)
    midisend(msg);
  endif
endwhile

An overview of the package can be displayed by running help audio

Help for each function can be displayed by help thefunctionname

ie:

help mididevice