See also matrix v.4 enhancements. The matrix help file has numerous usage examples.
Created by Panaiotis
© 2001-2008 by Panaiotis. All rights reserved.
#inlets * #outlets <= 29600 or so
The message from any data inlet can be sent to any combination of outlets. The outlet assignments of each inlet are independent of each other.
Matrix will always have one more inlet and outlet than requested. The leftmost inlet is a control inlet and is used exclusively to alter the configuration of the matrix. All other inlets are data inlets that pass information through assigned outlets. The data inlets may also be directed to interpret assignment command messages. The first (or last, depending on arg4) outlet sends internal configuration useful for coordinating matrix commands with the max matrixctrl and matrix~.
There are two modes that affect configuration. In the default mode, matrix is configured through the leftmost inlet only. The syntax for configuring is:
Msg1: [list]
, Msg2: [symbol list]
In the second mode, matrix may be configured either through the leftmost "control" inlet, or from any data inlet. In this mode configuration through the control inlet is the same as above. Configuration through the data inlets only affects the outlet status for the inlet receiving configuration messages. The message is the same as Msg2 mentioned above.
The leftmost inlet is a control inlet and can be used to simultaneously configure several inlets. Therefore, the left inlet must first receive a list of numbers (or an int for a single inlet assignment) that tells matrix which data inlets are to be configured by subsequent assignment commands sent through the left inlet. Once this list is received, it is in effect until a new list of inlets is received.
list |
A list of data inlets for which subsequent configuration messages will affect. Example: |
|
int | Tells matrix which data inlet is to be configured by subsequent assignment commands sent through the left inlet. | |
all | The symbol [all] prepares matrix to configure all inlets with subsequent configuration messages. |
|
bang | ignored | |
float | ignored | |
symbols | The symbols listed below under Assignment Commands will alter the matrix outlet configuration for the inlet(s) determined by the most recent list of inlets as mentioned above. |
bang | bang is sent to outlets assigned to the particular inlet. | |
int | int is sent to outlets assigned to the particular inlet. | |
List | the list is sent to outlets assigned to the particular inlet. | |
float | float is sent to outlets assigned to the particular inlet. | |
symbols | the symbol (or list of symbols) will be sent through outlets assigned to the particular inlet unless matrix is set to interpret symbols as assignment controls. In this case, the symbols listed below will alter the matrix outlet configuration for the inlet the symbol is sent through. Anything else is passed through assigned outlets. |
matrix has (number of data inlets) X (number of outlets) on/off gates. The messages to configure the matrix routing turn these gates on or off according to the operation and, often, the current state of each gate.
Outlet assignments are made through the leftmost inlet. If matrix is sent an message (or arg3 of matrix is 1), assignment commands may be sent through data inlets. When this is the case, assignment commands sent through data inlets only affect the assignments for that particular inlet. An
tells matrix to interpret assignment commands that are sent to the leftmost inlet only. The following discussion assumes that matrix was set to interpret assignment commands sent to any inlet.
Outlet assignments are made by sending an operator prepended to a list or descriptor.
Example: [= 2 5]
opens outlets 2 and 5 and closes all others for associated inlets.
[ odd 2 26, t even ]
are two messages that can be read as: for odd inlets between 2 and 26 (inclusive), toggle the open/close status of even numbered outlets.
The descriptors are as follows:
[list] | a list of ints or floats. Floats are rounded to the nearest int. | |
all | all inlets if in control inlet. all outlets if configuring through a data inlet | |
even a1 a2 | Even numbered values. The args are optional range indicators. If arg1 is present but not arg2, or arg2 is less than arg1, the range is from arg1 to the last outlet. Even is influenced by the current setting of ioref. | |
odd a1 a2 | Odd numbered values. a1 and a2 same as above. | |
mod a1 a2 a3 a4 | modulo descriptor. The first arg is obligatory and indicates the modulo. a2 is a shift value. a3 and a4 provides a range of values to which the modulo operation is applied.
Example: if ioref = 0, [mod 2 0] is the same as [even], and [mod 2 1] is the same as [odd]. Unlike even and odd, mod is not affected by ioref. Therefore, if ioref = 1, [mod 2 0] is the same as [odd], and [mod 2 1] is the same as [even]. The range args, however, do relate to the current ioref setting. |
|
range a1 a2 | This simply selects a range of numbers between a1 and a2. If a2 is not present or is less than a1, it assumes the value of the last outlet of the matrix. |
In the control inlet, these descriptors are used to describe the inlets that subsequent operators will apply to. If the descriptor is appended to an operator (as listed below) they refer to the outlet list for which the operator will be applied.
In most cases, when matrix is set to allow configuration through its data inlets, configuration messages sent to a data inlet do the same thing as the same message sent through the control inlet.
Often, a symbol sent without arguments is a shortcut way to do the operation with a list of all outlets.
In the description below, the affected outlets are for the active inlets list if the message is sent to the control inlet, or the inlet that the message is sent through. Lists may be floats, which are truncated to ints.
= [desc] | Open these outlets, close all others for this (or these) inlet(s)only. The descriptor can be any of the above (even, odd, mod, range or list].
In a data inlet with s=1 (allow config through data inlet), the descriptor without the '=' symbol acts the same as if the '=' were provided. In the control inlet, the '=' must be included to apply them to outlets. Otherwise, the descriptors indicate inlets. |
||||||||
![]() routes data sent through data inlet 2 to outlets 2 and 4 only. |
|||||||||
= |
When no outlet list is appended to the "=" symbol, matrix opens only the outlet(s) corresponding to this (or these) inlets. An [all] [=] or [all, =] message in the leftmost inlet will open in1/out1, in2/out2, .... This is a shortcut to: [1, = 1], [2, = 2], [3, =3]... [2 3 6] [=] will subsequently configure inlets 2, 3, and 6 as: |
||||||||
|
|||||||||
+ [desc] | open these outlets. Leave the condition of other outlets alone. | ||||||||
+ | without arg list, open all outlets. | ||||||||
[desc] | close these outlets. Leave the condition of other outlets alone. | ||||||||
| Without arg list, close all outlets. | ||||||||
t [desc] | toggle the on/off state of these outlets. Leave the condition of other outlets alone. | ||||||||
t | without arg list, toggle the on/off state of all outlets. | ||||||||
all |
in left inlet selects all inlets for subsequent assignment command messages sent to left inlet. Example: [all] [+] configures all inlets to send to all outlets. [all] [-] closes everything. |
||||||||
In data inlets: same as + with no arg list: opens all outlets for data inlet. | |||||||||
< [descr] |
rotate to the left the on/off state of these outlets. Arg list number order is significant.
|
||||||||
< | left rotate status of all outlets. | ||||||||
> | Same as < except rotate right. | ||||||||
<< arg [descr] << arg >> >> arg [descr] |
Same as the rotate above except that the arg is a shift amount. [>> 2 odd] rotates all odd node values two positions. The operation behaves as if the outlets not described don't exist. | ||||||||
<- -> <<- ->> |
These take the same args as the rotate group. Instead of rotation, they simply shift without rotating. | ||||||||
i> <i i<< i>> i-> |
Same as the outlet rotate and shift but these apply to inlet configuartions | ||||||||
rev [list] | reverse the order of the status of these outlets. Arg list number order is significant. | ||||||||
|
|||||||||
rev | without arg list: Reverse the status of all outlets. | ||||||||
![]() |
In control inlet: tells matrix to pass all messages sent through the data inlets without any interpretation. This is the default behavior of matrix. | ||||||||
![]() |
In control inlet: assignment commands will be interpreted when sent through data inlets. When this is the case, assignment commands sent through data inlets only affect the assignments for that particular inlet. | ||||||||
s |
S in data inlets when Example: if matrix is set to allow configuration through inlets and you want to send the message [t 5 6] through data3, then you would need to actually send the message [s t 5 6]. The first 's' is stripped from the original and tells matrix not to interpret the 't' as a toggle configuration command. A safer way to do this is to momentarily shut off inlet configuration by sending an In general, configuring matrix through data inlets works best if you are sending ints, floats, and lists, and no symbols that matrix will interpret as a configuration command. |
Integer arguments are interpreted in the following order. None of them are obligatory. Matrix defaults to a 2 x 2 matrix.
int1 | number of inlets (maximum 253). If no arguments matrix defailts to 2. | |
int2 | number of outlets (maximum 253). The actual number of inlets and outlets is a combination by which inlets*outlets=ca 30,600. If absent, defaults to 2. | |
int3 |
(optional unless arg4 is needed). 0: (default if not provided): matrix passes all messages from data inlets through assigned outlets. Configuration can only be made through the leftmost inlet. 1: matrix will interpret special assignment commands that are sent through data inlets. Anything that is not interpreted as an assignment command will be sent through assigned outlets. The messages |
|
int4 |
(optional) 0: (default if not provided): matrix sends configuration data out the rightmost outlet. The leftmost outlet is the first data outlet. 1: matrix sends configuration data out the leftmost outlet. The second outlet from the left is the first data outlet. |
|
ioref0 | symbol can be anywhere in the arg list. Matrix interprets i/o references like gate and switch, with the leftmost inlet/outlet as 1. 'ioref0' changes the references to match Max objects like martix~ and router, with the leftmost i/o referenced as 0. This reference can be changed at any time using the <ioref> message to matrix. |
Anything:
Messages received by data inlets are passed out the specified outlets according to the configuration of the matrix as discussed above. All types of data are passed through. Symbols are a special case when matrix is set to allow inlet configuration through the data inlets (see discussion above). All output is in standard right to left order. Assignment reversal, rotation, etc. do not affect the right to left output order. They only affect the internal matrix configuration.
![]() |
Each |
![]() |
NB: the example does not include the control outlet because it was made before that feature was implemented. |
gate, reroute, switch, router