# doc-cache created by Octave 5.2.0
# name: cache
# type: cell
# rows: 3
# columns: 12
# name: <cell-element>
# type: sq_string
# elements: 1
# length: 5
audio


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1381
The Audio package provides basic MIDI functionality for GNU octave.

   The following MIDI functions are available:

MIDI Device query:
..................

mididevinfo
     list any MIDI devices detected in the system

MIDI Device creation and manipulation:
......................................

mididevice
     Create a midi device
midimsg
     Create a MIDI message or group of messages
midireceive
     receive a MIDI message from a device
midisend
     Send a MIDI message to a device

MIDI Controller Interface Functions:
....................................

midiid
     Identify a midi controller
midicontrols
     Create a MIDI controller object
midireceive
     Receive data from a MIDI controller object
midisend
     Send data to a MIDI controller.

Writing and reading basic MIDI files:
.....................................

midifileinfo
     read information about a MIDI file, including number of tracks,
     comments etc.
midifileread
     read a MIDI file into a midimsg array
midifilewrite
     write a midimsg array to a MIDI file

General usage:
..............

Normal usage would involve querying the devices that are available:
     mididevinfo

   Then selecting the device(s) to connect to, and creating a mididevice
to perform read and write functionality:
     dev = mididevice(0);

   And then performing I/O on the device:
     msg = midireceive(dev)


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 67
The Audio package provides basic MIDI functionality for GNU octave.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
ismidifile


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 483
 -- 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.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 33
Check if FILENAME is a midi file.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 10
mididevice


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1528
 -- DEV = mididevice (MIDIDEV)
 -- DEV = mididevice (MIDIDIR, MIDIDEV)
 -- DEV = mididevice ("input", MIDIINDEV, "output", MIDIOUTDEV)
     Create a midi device using the input parameters.

     When a single device name or id is provided, attempt to create the
     midi device using the same name for both input and output.

     Otherwise, use the name or device id for the given input or output
     direction.

     Inputs
     ......

     MIDIDEV - name or id of device to load.
     MIDIDIR - midi direction of "input" or "output"
     MIDIINDEV - midi input name or id
     MIDIOUTDEV - midi output name or id

     Outputs
     .......

     DEV - octave_midi class for opened device

     Properties
     ..........

     INPUT - Input device name (read only).
     OUTPUT - Output device name (read only).
     INPUTID - Input device id (read only).
     OUTPUTID - Output device id (read only).

     Examples
     ........

     Open midi device with ID of 0.
          > dev = mididevice(0);

           mididevice connected to
             input: "SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0" (1)
             output: "SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0" (0)

     Open a named midi device:
          > dev = mididevice("SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0");

           mididevice connected to
             input: "SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0" (1)
             output: "SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0" (0)

     See also: mididevinfo.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 48
Create a midi device using the input parameters.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
mididevinfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 1772
 -- DEVLIST = mididevinfo ()
 -- mididevinfo ()
     Retrieve the midi devices detected within the system.

     The list will be stored with variable DEVLIST as either a input or
     output device.  If no output variable is provided, the devices will
     be displayed.

     Inputs
     ......

     None

     Outputs
     .......

     DEVLIST - a structure containing the midi device information

     Examples
     ........

     Display the known devices of the system.

          > mididevinfo

          MIDI devices available
          ID Direction Interface  Name
           0 output    Alsa       Midi Through:Midi Through Port-0 14:0
           1 output    Alsa       Ensoniq AudioPCI:ES1371 16:0
           2 output    Alsa       SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0
           3 input     Alsa       Midi Through:Midi Through Port-0 14:0
           4 input     Alsa       Ensoniq AudioPCI:ES1371 16:0
           5 input     Alsa       SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0


     Assign variable MIDIDEVICES with the values from the known devices

          > mididevices = mididevinfo

          mididevices =
           scalar structure containing the fields:
             input =
             {
               [1,1] =
                 scalar structure containing the fields:
                   Name = SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0
                   Interface = Alsa
                   ID =  0
             }
             output =
             {
               [1,1] =
                 scalar structure containing the fields:
                   Name = SparkFun Pro Micro:SparkFun Pro Micro MIDI 1 20:0
                   Interface = Alsa
                   ID =  1
             }


     See also: mididevice.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 53
Retrieve the midi devices detected within the system.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
midifileinfo


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 456
 -- 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

     See also: midifileread.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 64
Read MIDI file and display information about the tracks and data



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 12
midifileread


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 274
 -- MSG = midifileread (FILENAME)
     Read MIDI file into a midimsg

     Inputs
     ......

     FILENAME - filename of file to open.

     Outputs
     .......

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

     See also: midifileinfo, midimsg.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 29
Read MIDI file into a midimsg



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 13
midifilewrite


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 262
 -- midifilewrite (FILENAME, MSGS)
     Write a midifile

     Inputs
     ......

     FILENAME - filename of file to open.
     MSG - a midimsg struct containing data to write to file

     Outputs
     .......

     None

     See also: midifileread, midimsg.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 16
Write a midifile



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 6
midiid


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 655
 -- [CTRLID, DEV] = midiid ()
     Scan for control messages from midi devices to get the id of the
     device

     Function will display a prompt for the user to move the midi
     control and return when a control messages is detected or ctrl-C is
     pressed.

     Inputs
     ......

     None

     Outputs
     .......

     CTRLID - control id made from the controller channel * 1000 +
     controller number.
     DEV = name of the midi device the controller was detected on.

     Examples
     ........

     Monitor midi devices for first moving controller

          [ctrlid, devname] = midiid()


     See also: mididevinfo, midicontrols.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 71
Scan for control messages from midi devices to get the id of the device



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
midiread


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 681
 -- VAL = midiread (MIDICONTROLSOBJ)
     Read current values of midi controls

     Inputs
     ......

     MIDICONTROLOBJ - control object created using midicontrols

     Outputs
     .......

     VAL single value or array of current values from the midi device.

     Examples
     ........

     Read current value of midicontrols with a ctrlid 2001 on the
     default midi device.

          ctrl = midicontrols(2001)
          val = midiread(ctrl);


     Read current value of midicontrols with a ctrlid 2001 on a non
     default midi device.

          ctrl = midicontrols(2001, 'mididevice', 1)
          val = midiread(ctrl);


     See also: midicontrols, midisync.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 36
Read current values of midi controls



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 11
midireceive


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 834
 -- MIDIMSG = midireceive (DEV)
 -- MIDIMSG = midireceive (DEV, MAXMSG)
     Attempt to receive midi messages from a midi device.

     Inputs
     ......

     DEV - a octave midi device opened using mididevice.
     MAXMSG - Maximum number of messages to retrieve.  If not specified,
     the function will attempt to get all pending.

     Outputs
     .......

     MIDIMSG - a midimsg containing the messages retrieved from the
     device.
     If no messages are available, MIDIMSG will be empty.

     Examples
     ........

     Open device 0, and poll and display read messages

          dev = mididevice(0);
          while true
             mx = midireceive(dev);
             if !isempty(mx)
               % display message
               mx
             endif
          endwhile


     See also: mididevice, midisend.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 52
Attempt to receive midi messages from a midi device.



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
midisend


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 596
 -- midisend (DEV, MSG)
 -- midisend (DEV, ...)
     Send a midimsg to a midi device

     Inputs
     ......

     DEV - midi device opened using mididevice
     MSG - a midi message class with messages to send to the midi device
     If the msg isn't a midimsg class, the input data is expected to be
     in same format as the inputs to a midimsg object.

     Outputs
     .......

     None

     Examples
     ........

     Send a note on/off command to a opened midi device DEV

          midisend(dev, midimsg("note", 1, 60, 100, 2.0));


     See also: midimsg, mididevice, midireceive.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 31
Send a midimsg to a midi device



# name: <cell-element>
# type: sq_string
# elements: 1
# length: 8
midisync


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 598
 -- midisync (MIDICONTROLSOBJ)
 -- midisync (MIDICONTROLSOBJ, CTRLVALUES)
     Send the values of control object to the control, using CTRLVALUES
     values if specified instead

     Inputs
     ......

     MIDICONTROLOBJ - control object created using midicontrols
     CTRLVALUES - values to send to the controls instead of initial
     values

     Outputs
     .......

     None

     Examples
     ........

     Send sync command to a midicontrols with a ctrlid 2001 to set a
     value of 1

          ctrl = midicontrols(2001)
          midisync(ctrl, 1);


     See also: midicontrols.


# name: <cell-element>
# type: sq_string
# elements: 1
# length: 80
Send the values of control object to the control, using CTRLVALUES
values if ...





