Date post: | 07-Jul-2018 |
Category: |
Documents |
Upload: | luis-clemente |
View: | 218 times |
Download: | 0 times |
8/18/2019 Max 43 Reference
1/524
MAX
Reference
8/18/2019 Max 43 Reference
2/524
2
Copyright and Trademark Notices
This manual is copyright ©2000-2003 Cycling ’74.
Max is copyright ©1990-2003 Cycling ’74/IRCAM, l’Institut de Recherche et CoördinationAcoustique/Musique.
Credits
Original Max Documentation: Chris Dobrian
Max 4.3 Reference Manual: David Zicarelli, Gregory Taylor, Joshua Kit Clayton, jhno, RichardDudas
Max 4.3 Tutorials and Topics Manual: David Zicarelli, Gregory Taylor, Jeremy Bernstein, AdamSchabtach, Richard Dudas
Max 4.3 Manual page example patches: R. Luke DuBois, Darwin Grosse, Ben Nevile, Joshua KitClayton, David Zicarelli
Cover Design: Lilli Wessling Hart
Graphic Design: Gregory Taylor
8/18/2019 Max 43 Reference
3/524
Introduction
3
This volume,Max Reference,contains information about each individual Max object. It includes:
Max Objects
Contains precise technical information on the workings of each of the built-in and externalobjects supplied with Max, organized in alphabetical order.
Max Object Thesaurus
Consists of a reverse index of Max objects, alphabetized by keyword rather than by objectname. Use this Thesaurus when you want to know what object(s) are appropriate for the taskyou are trying to accomplish, then look up those objects by name in theObjects section.
Manual Conventions
The central building block of Max is the object. Names of objects are always displayed in boldtype,like
this
.
Messages (the arguments that are passed to and from objects) are displayed in plain type,
like this.
The name of a Max object displayed in blue type
like this
is hyperlinked to the reference page forthat object in this document. Clicking on the blue text will jump to the reference page for thatobject.
In the “See Also” sections, anything in regular type is a reference to a section of either this manualor theMax Tutorials and Topics
manual.
Reading the manual online
The table of contents of the Max Reference Manual is bookmarked, so you can view the book-marks and jump to any topic listed by clicking on its names. To view the bookmarks, chooseBookmarks
from the Windows menu. Click on the triangle next to each section to expand it.
Instead of using the Index at the end of the manual, it might be easier to use Acrobat Reader’s Findcommand. Choose Find from the Tools menu, then type in a word you’re looking for.Find
willhighlight the first instance of the word, andFind Again
takes you to subsequent instances. We’dlike to take this opportunity to discourage you from printing out the manual unless you find itabsolutely necessary.
8/18/2019 Max 43 Reference
4/524
4
!-
Subtraction object (inlets reversed)
The!-
object functions just like the
-
object, but the inlets’ functions are reversed.
Input
int
In left inlet: The number is stored, and will be subtracted from a number receivedin the right inlet.
In right inlet: The number in the left inlet is subtracted from the number, and theresult is sent out the outlet.
float
Converted to int
, unless!-has a float argument.
bang
In left inlet: Performs the subtraction with the numbers currently stored. If thereis no argument,!-
initially holds0
.
Arguments
int
orfloat
Optional. Sets the initial value, to be subtracted from a number received in the leftinlet. Float argument causes the numbers to be subtracted as floats.
Output
int
The difference between the two numbers received in the inlets.
float
Only if there is an argument with a decimal point.
Examples
-
with the input s swapped
8/18/2019 Max 43 Reference
5/524
!- Subtraction object (inlets reversed)
5
See Also
expr
Evaluate a mathematical expression
!/
Division object (inlets reversed)
!=
Compare two numbers, output1
if they are not equal
+
Add two numbers, output the result
-
Subtract two numbers, output the result
*
Multiply two numbers, output the result
/
Divide two numbers, output the result
%
Divide two numbers, output the remainder Tutorial 8 Doing math in Max
http://%21.pdf/http://remainder.pdf/http://remainder.pdf/http://%21.pdf/
8/18/2019 Max 43 Reference
6/524
6
!/
Division object (inlets reversed)
The!/
object functions just like the
/
object, but the inlets’ functions are reversed.
Input
int
In left inlet: The number is stored as thedivisor
(the number to be divided into thenumber in the right inlet).
In right inlet: The number is divided by the number in the right inlet, and theresult is sent out the outlet.
float
Converted to int
, unless!/
has a float argument.
bang
In left inlet: Performs the division with the numbers currently stored.
Arguments
int
orfloat
Optional. Sets an initial value for the divisor. If there is no argument, the divisor is
set to1
initially. Float argument causes the numbers to be divided as floats. (Divi-sion by 0 is not allowed. Int division by 0 will have the same result as dividing by 1.Float division by 0 will always cause an output of -2
31
.)
Output
int
The two numbers in the inlets are divided, and the result is sent out the outlet.
float
Only if there is an argument with a decimal point.
Examples
/with the inputs swapped
8/18/2019 Max 43 Reference
7/524
!/ Division object (inlets reversed)
7
See Also
expr
Evaluate a mathematical expression
!-
Subtraction object (inlets reversed)
!=
Compare two numbers, output1
if they are not equal
+
Add two numbers, output the result
-
Subtract two numbers, output the result
*
Multiply two numbers, output the result
/
Divide two numbers, output the result
%
Divide two numbers, output the remainder Tutorial 8 Doing math in Max
http://remainder.pdf/http://remainder.pdf/
8/18/2019 Max 43 Reference
8/524
8
!=
Com pare two numbers,output 1
if they are not equal
Input
int
In left inlet: The number is compared with the number in the right inlet. If the twonumbers are not equal,!=
outputs1
. If they are equal!=
outputs0
.
In right inlet: The number is stored, to be compared with a number received in
the left inlet.
float
Converted to int
before comparison, unless!=
has a float argument.
bang
In left inlet: Performs the comparison with the numbers currently stored. If thereis no argument,!=
initially holds0
for comparison.
list
In left inlet: Compares first and second number, outputs1
if they are not equal,0
ifthey are equal.
Arguments
int
orfloat
Optional. Sets the initial value, to be compared with a number received in the leftinlet. Float argument forces a float comparison.
Output
int 1
if the numbers in the inlets are not equal,0
if they are equal.
Examples
Test if two nu mbers are not
equal
See Also
select
Select certain inputs, pass the rest on
split
Look for a range of numbers
<
Is less than
, comparison of two numbers
Is greater than
, comparison of two numbers
>=
Is greater than or equal to
, comparison of two numbers Tutorial 15 Making decisions with comparisons
8/18/2019 Max 43 Reference
9/524
+ A dd two nu m bers,output the result
9
Input
int
In left inlet: The number is added to the number in the right inlet, and the result issent out the outlet.
In right inlet: The number is stored for addition to a number received in the left
inlet.
float
Converted to int
, unless+
has a float argument.
bang
In left inlet: Performs the addition with the numbers currently stored. If there isno argument,+
initially holds0
.
list
In left inlet: The first number is added to the second number, and the result is sentout the outlet.
set
In left inlet: The wordset
, followed by a number, adds that number to the number
in the right inlet but nothing is sent out. A subsequentbang
sends out the result.
Theset
message functions similarly for all the arithmetic operators, logical operators, and bitwiseoperators:+
,-
,*
,/
,%
,,&&,||,&,|,. The number is used as theleft operand, and the expression is evaluated, but the result is not sent out.
Arguments
int orfloat Optional. Sets the initial value, to be added to a number received in the left inlet.Float argument causes the numbers to be added as floats.
Outputint The sum of the two numbers received in the inlets.
float Only if there is an argument with a decimal point.
8/18/2019 Max 43 Reference
10/524
10
+ A dd two num bers,output the result Examples
See Also
expr Evaluate a mathematical expression!- Subtraction object (inlets reversed)!/ Division object (inlets reversed)- Subtract two numbers, output the result* Multiply two numbers, output the result/ Divide two numbers, output the result% Divide two numbers, output the remainder Tutorial 8 Doing math in Max
Norm ally adds int s Floats are truncated before addition ... un less there is a float argum ent
http://%21.pdf/http://remainder.pdf/http://remainder.pdf/http://%21.pdf/
8/18/2019 Max 43 Reference
11/524
- Subtract two num bers,output the result
11
Input
int In left inlet: The number in the right inlet is subtracted from the number, and theresult is sent out the outlet.
In right inlet: The number is stored, to be subtracted from a number received in
the left inlet.
float Converted to int, unless- has a float argument.
bang In left inlet: Performs the subtraction with the numbers currently stored. If thereis no argument,- initially holds0.
list In left inlet: The second number is subtracted from the first number, and theresult is sent out the outlet.
Arguments
int orfloat Optional. Sets the initial value, to be subtracted from a number received in the leftinlet. Float argument causes the numbers to be subtracted as floats.
Output
int The difference between the two numbers received in the inlets.
float Only if there is an argument with a decimal point.
8/18/2019 Max 43 Reference
12/524
12
- Subtract two nu mbers,output the result Examples
See Also
expr Evaluate a mathematical expression!- Subtraction object (inlets reversed)!/ Division object (inlets reversed)+ Add two numbers, output the result- Subtract two numbers, output the result
* Multiply two numbers, output the result/ Divide two numbers, output the result% Divide two numbers, output the remainder Tutorial 8 Doing math in Max
Subtracted as ints Floats are truncated before subtraction… … unless there is a float argument
http://%21.pdf/http://remainder.pdf/http://remainder.pdf/http://%21.pdf/
8/18/2019 Max 43 Reference
13/524
* M ultiply two num bers,output the result
13
Input
int In left inlet: The number is multiplied by the number in the right inlet, and theresult is sent out the outlet.
In right inlet: The number is stored for multiplication with a number received in
the left inlet.
float Converted to int before multiplication, unless* has a float argument.
bang In left inlet: Performs the multiplication with the numbers currently stored. Ifthere is no argument,* initially holds0 as a multiplier.
list In left inlet: The first number is multiplied by the second number, and the result issent out the outlet.
Arguments
int orfloat Optional. Sets the initial value, to be multiplied by a number received in the leftinlet. Float argument causes the numbers to be multiplied as floats.
Output
int The product of the two numbers received in the inlets.
float Only if there is an argument with a decimal point.
Examples
Multiplied as ints Floats are truncated before multiplication… … un less there is a float argum ent
8/18/2019 Max 43 Reference
14/524
14
* Multiply two numbers,output the result See Also
expr Evaluate a mathematical expression!- Subtraction object (inlets reversed)!/ Division object (inlets reversed)!= Compare two numbers, output1 if they are not equal
+ Add two numbers, output the result- Subtract two numbers, output the result/ Divide two numbers, output the result% Divide two numbers, output the remainder
8/18/2019 Max 43 Reference
15/524
/ Divide two nu m bers,output the result
15
Input
int In left inlet: The number is divided by the number in the right inlet, and the resultis sent out the outlet.
In right inlet: The number is stored as thedivisor (the number to be divided into
the number in the left inlet).
float Converted to int, unless/ has a float argument.
bang In left inlet: Performs the division with the numbers currently stored.
list In left inlet: The first number is divided by the second number, and the result issent out the outlet.
Arguments
int orfloat Optional. Sets an initial value for the divisor. If there is no argument, the divisor isset to1 initially. Float argument causes the numbers to be divided as floats. (Divi-sion by 0 is not allowed. Int division by 0 will have the same result as dividing by 1.Float division by 0 will always cause an output of -231.)
Output
int The two numbers in the inlets are divided, and the result is sent out the outlet.
float Only if there is an argument with a decimal point.
8/18/2019 Max 43 Reference
16/524
16
/ D ivide two num bers,output the result Examples
See Also
expr Evaluate a mathematical expression!- Subtraction object (inlets reversed)!/ Division object (inlets reversed)+ Add two numbers, output the result- Subtract two numbers, output the result
* Multiply two numbers, output the result% Divide two numbers, output the remainder Tutorial 8 Doing math in Max
Rem ainder is discarded Floats are truncated before division … … un less there is a float argum ent
http://%21.pdf/http://remainder.pdf/http://remainder.pdf/http://%21.pdf/
8/18/2019 Max 43 Reference
17/524
% Divide two nu m bers,output remainder
17
Input
int In left inlet: The number is divided by the number in the right inlet, and theremainder is sent out the outlet.
In right inlet: The number is stored as thedivisor (the number to be divided into
the number in the left inlet) for calculating the remainder.
float Converted to int.
bang In left inlet: Performs the operation with the numbers currently stored.
list In left inlet: The first number is divided by the second number, and the remainderis sent out the outlet.
Arguments
int Optional. Sets an initial value for the divisor. If there is no argument, the divisor isset to1 initially.
Output
int When the two numbers in the inlets are divided, the remainder is sent out the out-let.%is called themodulo operator.
Examples
Find the remainder of a div ision
See Also
expr Evaluate a mathematical expression!- Subtraction object (inlets reversed)!/ Division object (inlets reversed)+ Add two numbers, output the result- Subtract two numbers, output the result* Multiply two numbers, output the result/ Divide two numbers, output the result Tutorial 8 Doing math in Max
http://%21.pdf/http://%21.pdf/
8/18/2019 Max 43 Reference
18/524
18
< Is less than ,comparison of two num bersInput
int In left inlet: If the number is less than the number in the right inlet,
8/18/2019 Max 43 Reference
19/524
8/18/2019 Max 43 Reference
20/524
20
== Compare two nu mbers,output 1if they are equalInput
int In left inlet: The number is compared with the number in the right inlet. If the twonumbers are equal,== outputs1. If they are not equal== outputs0.
In right inlet: The number is stored to be compared with a number received in the
left inlet.
float Converted to int before comparison, unless== has a float argument.
bang In left inlet: Performs the comparison with the numbers currently stored. If thereis no argument,== initially holds0 for comparison.
list In left inlet: Compares first and second number, outputs1if they are equal,0 ifthey are not equal.
Arguments
int orfloat Optional. Sets the initial value, to be compared with a number received in the leftinlet. Float argument forces a float comparison.
Output
int 1if the numbers in the inlets are equal,0 if they are not equal.
Examples
See Also
select Select certain inputs, pass the rest onsplit Look for a range of numbers
!= Compare two numbers, output1 if they are not equal< Is less than, comparison of two numbers Is greater than , comparison of two numbers>= Is greater than or equal to, comparison of two numbers Tutorial 15 Making decisions with comparisons
T he num bers are equal T he num bers are not equal Using ==0as a logical “not”
8/18/2019 Max 43 Reference
21/524
> Is greater than ,comparison of two num bers
21
Input
int In left inlet: If the numberis greater than the number in the right inlet,> outputs1.Otherwise,> outputs0.
In right inlet: The number is stored to be compared with a number received in the
left inlet.
float Converted to int before comparison, unless> has a float argument.
bang In left inlet: Performs the comparison with the numbers currently stored. If thereis no argument,> initially holds0 for comparison.
list In left inlet: If the first number is greater than the second number,> outputs1.Otherwise,> outputs0.
Arguments
intorfloat Optional. Sets the initial value, to be compared with a number received in the leftinlet. Float argument forces a float comparison.
Output
int 1 if the number in the left inlet is greater than the number in the right inlet.0 if thenumber in the left inlet is less than or equal to the number in the right inlet.
Examples
See Also
!= Compare two numbers, output1 if they are not equal< Is less than, comparison of two numbers= Is greater than or equal to, comparison of two numbers Tutorial 15 Making decisions with comparisons
T h e nu m ber on th e left is greater T h e nu m ber on th e left is n ot greater
8/18/2019 Max 43 Reference
22/524
22
>= Is greater than or equal to,comparison of two num bersInput
int In left inlet: If the number isgreater than or equal to the number in the right inlet,>= outputs1. Otherwise,>= outputs0.
In right inlet: The number is stored to be compared with a number received in the
left inlet.
float Converted to int before comparison, unless>= has a float argument.
bang In left inlet: Performs the comparison with the numbers currently stored. If thereis no argument,>= initially holds0for comparison.
list In left inlet: If the first number isgreater than or equal to the second number,>= outputs1. Otherwise,>= outputs0.
Arguments
intorfloat Optional. Sets the initial value, to be compared with a number received in the leftinlet. Float argument forces a float comparison.
Output
int 1 if the number in the left inlet is greater than or equal to the number in the rightinlet.0 if the number in the left inletis less than the number in the right inlet.
Examples
See Also
!= Compare two numbers, output1 if they are not equal< Is less than, comparison of two numbers Is greater than , comparison of two numbers Tutorial 15 Making decisions with comparisons
Is greater than... or equal to Is not greater than or equal to
8/18/2019 Max 43 Reference
23/524
& Bitwise intersectionof two num bers
23
Input
int In left inlet: The number is compared, in binary form, with the number in theright inlet. The output is a number composed of those bits which are 1 inboth numbers.
In right inlet: The number is stored for comparison with a number received in theleft inlet.
float Converted to int.
bang In left inlet: Performs the comparison with the numbers currently stored. If thereis no argument,& initially holds 0 for comparison.
list In left inlet: Compares the first and second numbers bit-by-bit, and outputs anumber composed of those bits which are 1 in both numbers.
Argumentsint Optional. Sets an initial value to be compared with a number received in the left
inlet.
Output
int The two numbers received in the inlets are compared, one bit at a time. If a bit is 1in both numbers, it will be 1 in the output number, otherwise it will be 0 in theoutput number.
Examples
See Also
&& If both numbers are non-zero, output 1| Bitwise union of two numbers|| If either of two numbers is non-zero, output1
Nonzero bits shared by both num bers Can be used as an odd/ even detector
8/18/2019 Max 43 Reference
24/524
24
&& If both num bers are non-zero,output 1Input
int If the number inboth inlets is not0, then the output is1. If the number in one orboth of the inlets is0, then the output is0. A number in the left inlet triggers theoutput.
float Converted to int.
bang In left inlet: Performs the operation with the numbers currently stored. If there isno argument,&& initially holds0.
list In left inlet: If both the first and second numbers are not0, then the output is1.Otherwise, the output is0.
Arguments
int Optional. Sets an initial value to be stored by&&. A number in the right inlet
changes the value set by the argument.
Output
int If the number in the left inletand the number in the right inlet (or specified by theargument) are both not0, then the output is1. Otherwise, the output is0.
Examples
See Also
& Bitwise intersection of two numbers| Bitwise union of two numbers|| If either of two numbers is non-zero, output1 Tutorial 15 Making decisions with comparisons
Both num bers are not 0 Used to com bine comparisons
8/18/2019 Max 43 Reference
25/524
| Bitwise unionof two num bers
25
Input
int In left inlet: Outputs a number composed of all those bits which are 1 in either ofthe two numbers.
In right inlet: The number is stored for combination with a number received in
the left inlet.
float Converted to int.
bang In left inlet: Performs the calculation with the numbers currently stored. If there isno argument,| initially holds0.
list In left inlet: Combines the first and second numbers bit-by-bit, and outputs anumber composed of all those bits which are 1 in either of the two numbers.
Arguments
int Optional. Sets an initial value to be or-ed with a number received in the left inlet.
Output
int All the nonzero bits of the two numbers received in the inlets are combined. If abit is 1 in either one of the numbers, it will be 1 in the output number, otherwise itwill be 0 in the output number.
Examples
See Also
& Bitwise intersection of two numbers&& If both numbers are non-zero, output 1|| If either of two numbers is non-zero, output1
All non -zero bits are com bined Can be used to pack two num bers into one int
8/18/2019 Max 43 Reference
26/524
26
|| If either of two num bersis non- zero, output 1Input
int If the number ineither inlet is not 0, then the output is1. If the number inboth ofthe inlets is 0, then the output is0. A number in the left inlet triggers the output.
float Converted to int.
bang In left inlet: Performs the operation with the numbers currently stored. If there isno argument,|| initially holds0.
list In left inlet: If either the first or second number is not 0, then the output is1. Oth-erwise, the output is0.
Arguments
int Optional. Sets an initial value to be stored by||. A number in the right inletchanges the value set by the argument.
Output
int If either the number in the left inletor the number in the right inlet (or specifiedby the argument) is not 0, then the output is1. Otherwise, the output is0.
Examples
See Also
& Bitwise intersection of two numbers&& If both numbers are non-zero, output 1
| Bitwise union of two numbers Tutorial 15 Making decisions with comparisons
One of the num bers is not 0 Used to combine com parisons
8/18/2019 Max 43 Reference
27/524
8/18/2019 Max 43 Reference
28/524
28
>> Shift all bitsto the right Input
int In left inlet: All bits of the number, in binary form, are shifted to the right by a cer-tain number of bits. The resulting number is sent out the outlet.
In right inlet: The number is stored as the number of bits to right-shift the num-
ber in the left inlet.
float Converted to int.
bang In left inlet: Performs the bit-shift with the numbers currently stored. If there is noargument,>> initially holds0 as the number of bits by which to shift.
list In left inlet: The first number is bit-shifted to the right by the number of bits spec-ified by the second number.
Arguments
int Optional. Sets an initial value for the number of bits by which to shift rightward.
Output
int The number in the left inlet is bit-shifted to the right by a certain number of bits. The number of bits by which to shift is specified by the number in the right inlet. The output is the resulting bit-shifted number.
Examples
Sam e effect as dividing by a power of 2
See Also
!/ Division object (inlets reversed)
8/18/2019 Max 43 Reference
29/524
abs O utput the absolutevalue of the input
29
Input
int The absolute (non-negative) value of the input is sent out the output.
float Converted to int, unlessabs has a float argument.
intorfloat Optional. Float argument forces a float output.
Arguments
int orfloat Optional. Float argument forces a float output.
Output
int The absolute value of the input.
float Only if there is an argument with a decimal point.
Examples
See Also
expr Evaluate a mathematical expression Tutorial 14 Sliders and dials
Output is nonnegative Used here to invert input
8/18/2019 Max 43 Reference
30/524
30
absolutepath Convert a file nam eto an absolute pathInput
any symbol A file name or path as a symbol. Input pathnames can contain slashes, colons, orbackslashes as separators.Theabsolutepath object converts a file name or path toan absolute path, resolving any aliases in doing so.
Arguments
None.
Output
any symbol If the incoming file name or path is found, the output is an absolute path.The out-put pathnames contain slash separators.
Absolute pathnames look like this:
“C:/Max Folder/extras/mystuff/mypatch.pat”
Theconformpath object can be used to convert paths of one pathtype and/orpathstyle to another.
If the file is not found,absolutepath outputs the symbol notfound.
Examples
See Also
conformpath Convert paths of one pathtype and/or pathstyle to anotherdropfile Define a region for dragging and dropping a file
opendialog Open a dialog to ask for a file or folderrelativepath Convert an absolute to a relative pathsavedialog Open a dialog to ask for a filename for savingstrippath Get a filename from a full pathnameFile Preferences
8/18/2019 Max 43 Reference
31/524
acos A rc-cosine fu nction
31
Input
float or int Input to a arc-cosine function.
bang In left inlet: Calculates the arc-cosine of the number currently stored. If there is noargument,acos initially holds0.
Arguments
float or int Optional. Sets the initial value for the arc-cosine function.
Output
float or int The arc-cosine of the input.
Examples
See Also
acosh Hyperbolic arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine functionatan Arc-tangent functionatan2 Arc-tangent function (two variables)atanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
32/524
32
acosh H yperbolic arc-cosine fun ction
Input
float or int Input to a hyperbolic arc-cosine function.
bang In left inlet: Calculates a hyperbolic arc-cosine of the number currently stored. Ifthere is no argument,acosh initially holds0.
Arguments
float or int Optional. Sets the initial value for the hyperbolic arc-cosine function.
Output
float or int The hyperbolic arc-cosine of the input.
Examples
See Also
acos Arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine functionatan Arc-tangent functionatan2 Arc-tangent function (two variables)atanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
33/524
accum Store, add to,and m ultiply a num ber
33
Input
int In left inlet: Replaces the value stored inaccum, and sends the new value out theoutlet.
In middle inlet: The number is added to the stored value, without triggering out-
put.
In right inlet: The stored value is multiplied by the input, without triggering out-put.
float In left and middle inlet: Converted toint, unlessaccumhas a float argument.
In right inlet: Multiplication is done with floats, even if the value is stored as anint.
bang In left inlet: Outputs the value currently stored inaccum.
set In left inlet: The wordset, followed by a number, sets the stored value to that num-ber, without triggering output.
Arguments
intorfloat Optional. Sets the initial value stored inaccum. An argument with a decimal pointcauses the value to be stored as a float.
Output
int The value currently held byaccum.float Only if there is an argument with a decimal point.
8/18/2019 Max 43 Reference
34/524
34
accum Store, add to,and m ultiply a num ber Examples
See Also
counter Count thebang messages received, output the countfloat Store a decimal numberint Store an integer value
Tutorial 21 Storing numbers
Add to and/ or multiply a stored value Used here to increm ent by different am ounts
8/18/2019 Max 43 Reference
35/524
active Send 1when patcher window is active,0when inactive
35
Input
There are no inlets. Output is triggered automatically when the patcher window isactivated or deactivated.
ArgumentsNone.
Output
int When the patcher window that containsactive is activated,active sends out1.When the window is made inactive,active sends out0.
Examples
Turn on a process or open a gate when the window is m ade active
See Also
closebang Send abang when patcher window is closedloadbang Send abang automatically when patch is loaded Tutorial 40 Automatic actions
8/18/2019 Max 43 Reference
36/524
36
anal M ake a histogram of number pairs received Input
int Reports how many times this number and the previously received number haveoccurred in immediate succession. (The first time a number is received, there hasbeen no previous number, so nothing happens.)
reset Erases the most recently received number from the memory of theanal object. The next number to be received gets stored in its place, to serve as the next “previ-ous” value (but nothing else happens).
clear Erases the memory of theanal object entirely, but retains the most recentlyreceived number to use as the next “previous” value.
Arguments
int Optional. Sets a maximum limit for how many different number pairs can be kepttrack of byanal. The maximum number of different pairs is 1024. If no argument
is present,anal can store up to 128 different pairs.
Output
list The first two numbers in the list are the two most recently received numbers, andthe third number shows how many times that particular succession of two num-bers has been received. This list of three numbers is designed to be used as inputto theprob object, to create a probability matrix of transitions from one numberto another (known as a first-order Markov chain).
Examples
Keep track of num ber pairs and their relative frequency of occurrence;
pass the inform ation to prob to generate similar transitions
See Also
histo Make a histogram of the numbers receivedprob Make weighted random series of numbers
8/18/2019 Max 43 Reference
37/524
append A ppend argum ent sat the end of a m essage
37
Input
set The wordset, followed by any message, will replace the message stored inappend,without triggering output.
anything else The message stored inappend is appended, preceded by a space, to the end of any
message that is received in the inlet, and the combined message is sent out theoutlet.
Arguments
anything Optional. Sets the message that will be appended to the end of incoming mes-sages.
Output
anything The message received in the inlet is combined with the message stored inappend,
and then sent out the outlet.
Examples
Symbols can be combined into m eaningfu l messages with append
See Also
prepend Put one message at the beginning of another Tutorial 25 Managing messages
8/18/2019 Max 43 Reference
38/524
38
asin A rc-sine function
Input
float or int Input to a arc-sine function.
bang In left inlet: Calculates the arc-sine of the number currently stored. If there is noargument,asin initially holds0.
Arguments
float or int Optional. Sets the initial value for the arc-sine function.
Output
float or int The arc-sine of the input.
Examples
See Also
acos Arc-cosine functionacosh Hyperbolic arc-cosine functionasinh Hyperbolic Arc-sine functionatan Arc-tangent functionatan2 Arc-tangent function (two variables)atanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
39/524
asinh Hyperbolic arc-sine function
39
Input
float or int Input to a hyperbolic arc-sine function.
bang In left inlet: Calculates the hyperbolic arc-sine of the number currently stored. Ifthere is no argument,asin initially holds0.
Arguments
float or int Optional. Sets the initial value for the hyperbolic arc-sine function.
Output
float or int The hyperbolic arc-sine of the input.
Examples
See Also
acos Arc-cosine functionacosh Hyperbolic arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine functionatan Arc-tangent functionatan2 Arc-tangent function (two variables)atanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
40/524
40
atan A rc-tangent function
Input
float or int Input to a arc-tangent function.
bang In left inlet: Calculates the arc-tangent of the number currently stored. If there isno argument,atan initially holds0.
Arguments
float or int Optional. Sets the initial value for the arc-tangent function.
Output
float or int The arc-tangent of the input.
Examples
8/18/2019 Max 43 Reference
41/524
atan A rc-tangent function
41
See Also
acos Arc-cosine functionacosh Hyperbolic arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine function
atan2 Arc-tangent function (two variables)atanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
42/524
42
atan2 A rc-tangent function(two variables)Input
float or int In left input: x value input to an arc-tangent function.
In right input: y value input to an arc-tangent function.
bang In left inlet: Calculates the arc-tangent of the numbers currently stored. If thereare no arguments,atan2 initially holds0 for both input values.
Arguments
float or int Optional. Two ints may be used to set the initial value for the arc-tangent func-tion.
Output
float or int The arc-tangent of the input values (i.e. Arc-tangent( y/ x)).
Examples
8/18/2019 Max 43 Reference
43/524
atan2 A rc-tangent function(two variables)
43
See Also
acos Arc-cosine functionacosh Hyperbolic arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine function
atan Arc-tangent functionatanh Hyperbolic arc-tangent functioncos Cosine functioncosh Hyperbolic cosine functionsin Sine functionsinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
44/524
44
atanh Hyperbolic arc-tangent function
Input
float or int Input to a hyperbolic arc-tangent function.
bang In left inlet: Calculates the hyperbolic arc-tangent of the number currently stored.If there is no argument,atanh initially holds0.
Arguments
float or int Optional. Sets the initial value for the hyperbolic arc-tangent function.
Output
float or int The hyperbolic arc-tangent of the input.
Examples
See Alsoacos Arc-cosine functionacosh Hyperbolic arc-cosine functionasin Arc-sine functionasinh Hyperbolic Arc-sine functionatan Arc-tangent functionatan2 Arc-tangent function (two variables)cos Cosine functioncosh Hyperbolic cosine functionsin Sine function
sinh Hyperbolic sine functiontan Tangent functiontanh Hyperbolic tangent function
8/18/2019 Max 43 Reference
45/524
bag Store a collectionof num bers
45
Input
int In left inlet: The number is either added to or deleted from the collection of num-bers stored inbag, depending on the number in the right inlet.
In right inlet: The number is stored as an indicator of whether to include or delete
the next number received in the left inlet. If non-zero, the number received in theleft inlet is added to thebag. If 0, the number is deleted from thebag.
No output is triggered by a number received in either inlet.
float Converted to int.
bang In left inlet: Causesbag to send all its numbers out the outlet.
clear In left inlet: Deletes the entire contents of thebag.
list In left inlet: If the second number is not 0, the first number is included in thebag.If the second number is 0, the first number is deleted from thebag.
send In left inlet: The wordsend, followed by the name of areceive object, sends theresult of abang message to allreceive objects with that name, instead of out thebag object’s outlet.
length In left inlet: Reports how many numbers are currently stored in thebag.
cut In left inlet: Sends out the oldest (earliest received) number stored in thebag, anddeletes it from thebag.
Arguments
any symbol Optional. Causesbag to store duplicate numbers. If there is no argument,bag willstore only one of each number at a time. The argument must not be a number.
Output
int Whenbang is received in the left inlet, all the numbers stored inbag are sent outone at a time, in reverse order from that in which they were stored.
Whencut is received in the left inlet, the oldest stored number is sent out.
Whenlength is received in the left inlet, the number of items in thebag is sent out.
8/18/2019 Max 43 Reference
46/524
46
bag Store a collectionof num bersExamples
See Also
coll Store and edit a collection of different messagesfunbuff Store x,y pairs of numbersoffer Store x,y pairs of numbers temporarilyData Structures Ways of storing data in Max
Store a collection of num bers Used here to detect held notes
8/18/2019 Max 43 Reference
47/524
bangbang / b Send a bangtom any places, in order
47
Input
anything Causes abang to be sent out all outlets, in right-to-left order.
Arguments
int Optional. Sets the number of outlets. Limited between 1 and 10. Any numbergreater than 10 is set to 10; any number less than 1 is set to 2. If there is no argu-ment, there will be 2 outlets.
float Converted to int.
Output
bang When a message is received in the inlet,bangis sent out each outlet, in order fromright to left.
Examples
See Also
button Flash on any message, send abangtrigger Send input to many places, in order Tutorial 7 Right-to-left order
O rder is norm ally right- to-left Order is specified by bangbang
8/18/2019 Max 43 Reference
48/524
48
bendin Output received M ID I pitch bend valuesInput
(MIDI) bendin receives its input from a MIDI pitch bend message received from a MIDIinput device.
enable The messageenable 0 disables the object, causing it to ignore subsequent incoming
MIDI data. The wordenable followed by any non-zero number enables the objectonce again, even if the entire patcher window has had its MIDI disabled by anenable message to apcontrol object.
port The wordport, followed by a lettera-zor the name of an MIDI port or device, setsthe port from which the object receives incoming pitch bend messages. The wordport is optional and may be omitted.
(mouse) Double-clicking on abendin object shows a pop-up menu for choosing a MIDIport or device.
Argumentsa-z Optional. Specifies the port from which to receive incoming pitch bend messages.
If there is no argument,bendin receives from all channels on all ports.
(MIDI name) Optional. The name of a MIDI input device may be used as the first argument tospecify the port.
a-z andint A letter and number combination (separated by a space) indicates a port and aspecific MIDI channel on which to receive pitch bend messages. Channel num-bers greater than 16 will bewrapped around to stay within the 1-16 range.
int A number alone can be used in place of a letter and number combination. Theexact meaning of the channel number argument depends on the channel offsetspecified for each port in theMIDI Setup dialog.
Output
int If a specific channel number is included in the argument, there is only one outlet. The output is the incoming pitch bend value from 0-127 (the most significantbyte of the MIDI pitch bend message) on the specified channel and port.
If there is no channel number specified by the argument,bendin will have a sec-ond outlet, on the right, which will output the channel number of the incomingpitch bend message.
8/18/2019 Max 43 Reference
49/524
bendin Output received M ID I pitch bend values
49
Examples
Pitch bend m essages can be received from everywhere,
a specific port, or a specific port and channel
See Also
bendout Transmit MIDI pitch bend messagesctlin Output received MIDI control valuesmidiin Output received raw MIDI datanotein Output received MIDI note messagesrtin Output received MIDI real time messagesxbendout Prepare extra precision MIDI pitch bend messagesxbendin Interpret extra precision MIDI pitch bend messagesUsing MIDI Using Max with MIDIPorts How MIDI ports are specified Tutorial 16 More MIDI ins and outs
8/18/2019 Max 43 Reference
50/524
50
bendout Transmit M IDI pitch bend m essagesInput
int In left inlet: The number is transmitted as a MIDI pitch bend value on the speci-fied channel and port. Numbers are limited between 0 and 127.
In right inlet: The number is stored as the channel number on which to transmit
the pitch bend messages.
float Converted to int.
list In left inlet: The first number is the pitch bend value, and the second number isthe channel, of a MIDI pitch bend message, transmitted on the specified channeland port.
enable The messageenable 0 disables the object, causing it not to transmit MIDI data. Thewordenable followed by any non-zero number enables the object once again, evenif the entire patcher window has had its MIDI disabled by anenable message to a
pcontrol object.
port In left inlet: The wordport, followed by a lettera-z or the name of a MIDI outputport or device, specifies the port used to transmit MIDI messages. The wordport is optional and may be omitted.
(mouse) Double-clicking on abendout object shows a pop-up menu for choosing a MIDIport or device.
Arguments
a-z Optional. Specifies the port for transmitting MIDI pitch bend messages. Channelnumbers greater than 16 received in the right inlet will bewrapped around to staywithin the 1-16 range. If there is no argument,bendout initially transmits out porta, on MIDI channel 1.
a-z andint A letter and number combination (separated by a space) indicates a port and aspecific MIDI channel on which to transmit pitch bend messages. Channel num-bers greater than 16 will bewrapped around to stay within the 1-16 range.
(MIDI name) Optional. The name of a MIDI output device may be used as the first argument tospecify the port.
int A number alone can be used in place of a letter and number combination. Theexact meaning of the channel number argument depends on the channel offsetspecified for each port in theMIDI Setup dialog.
Output
(MIDI) There are no outlets. The output is a MIDI pitch bend message transmitteddirectly to the object’s MIDI output port.
8/18/2019 Max 43 Reference
51/524
bendout Transmit M IDI pitch bend m essages
51
Examples
See Also
bendin Output received MIDI pitch bend messagesmidiout Transmit raw MIDI dataxbendout Prepare extra precision MIDI pitch bend messagesxbendin Interpret extra precision MIDI pitch bend messagesUsing MIDI Using Max with MIDIPorts How MIDI ports are specified Tutorial 16 More MIDI ins and outs
Letter argum ent t ransmits
to only one port
Otherwise, num ber specifies
both port and channel
8/18/2019 Max 43 Reference
52/524
52
bondo Synchronize agroup of m essagesInput
any message In any inlet: The input is stored in the location corresponding to that inlet, and causes anything previously stored to be sent out its corresponding outlet. If nomessage has yet been received in a particular inlet,0 is sent out of the correspond-ing outlet.
bang In any inlet: Sends out all stored messages immediately.
set In any inlet: The word set, followed by any message, stores the input in the loca-tion corresponding to that inlet without triggering any output.
Arguments
int Optional. The first argument specifies the number of inlets and outlets. Thedefault number of inlets and outlets is 2. The second argument specifies a numberof milliseconds to delay when a message is received before sending messages out
the outlets.
Output
any message Anything stored in an inlet is sent out the corresponding outlet numbers. Outputis immediate if triggered by abang. If output is triggered by a message, and a sec-ond argument has been typed in, output will be delayed by the number of milli-seconds specified in the second argument.
Examples
bondocan syn chronize m essages arriving from different sources
See Also
buddy Synchronize arriving data, output them togetheronebang Traffic control forbang messagespack Combine numbers and symbols into a listthresh Combine numbers into a list, when received close together
8/18/2019 Max 43 Reference
53/524
borax Report current in form ationabout note-ons and note-offs
53
Input
int In left inlet: The number is the pitch value of a MIDI note-on message or note-offmessage (note-on with a velocity of 0). The pitch is paired with the velocity in themiddle inlet.borax ignores note-on messages for pitches it is already holding, andignores note-off messages for pitches that have already been turned off. If the note
is not a duplicate,borax sends out the pitch and velocity values, as well as otherinformation.
In middle inlet: The number is stored as the velocity, to be paired with pitch num-bers received in the left inlet.
float In middle inlet: Converted toint.
list In left inlet: The second number is stored as the velocity, and the first number isused as the pitch, of a pitch-velocity pair. If the note is not a duplicate,borax sendsout the pitch and velocity values, as well as other information.
delta In left inlet: Causes thedelta tim e (the time elapsed since the last note-on) and thedelta count (the number of delta times that have been reported) to be sent out.
bang In right inlet: Resetsborax by sending note-offs for all notes currently being held,erasing theborax object’s memory of all notes received, and setting its countersand its clock to 0.
Arguments
None.
Output
int Out left outlet: Each note-on received byborax is assigned a unique number, equalto the total count of note-ons received (since the last reset). That number is sentout when the note-on is received, and the same number is sent out when the noteis turned off.
Out 2nd outlet: Each note is also assigned a unique voice number, equal to thelowest available number. (A voice becomes available when the note assigned to itis turned off.) That number is sent out when the note-on is received, and the same
number is sent out when the note is turned off.
Out 3rd outlet: The number of notes being held byborax is sent out each time anote-on or a note-off is received.
Out 4th outlet: The pitch of the note-on or note-off is sent out.
Out 5th outlet: The velocity of the note-on or note-off is sent out.
8/18/2019 Max 43 Reference
54/524
54
borax Report current inform ationabout note-ons and note-offsOut 6th outlet: When a note-off is received, the total count of all completed notes(since the last reset) is sent out.
Out 7th outlet: When a note-off is received, the duration of that note, in millisec-onds, is sent out.
Out 8th outlet: Each time a delta time is reported, the total count of delta times issent out.
Out right outlet: When a note-on is received, the delta time is sent out (the timeelapsed since the previous note-on, in milliseconds). Adelta message in the leftinlet causes the same output.
Abang received in the right inlet causesborax to provide note-offs for any notes itcurrently holds. These note-offs trigger the same outputs as if they had actuallybeen received.
Examples
borax provides extensive inform ation about the notes passing through
See Also
midiparse Interpret raw MIDI datapoly Allocate notes to different voices
8/18/2019 Max 43 Reference
55/524
bpatcher Embed a v isiblesubpatch inside a box
55
Input
anything The number of inlets in abpatcher object is determined by the number ofinlet objects contained in its subpatch window. If the patch being used in abpatcher containsinlet objects, they will appear in left-to-right correspondence as inlets inthebpatcher object’s box.
offset If the subpatch being used in thebpatcher contains athispatcher object connectedto one of itsinlet objects, the view of the subpatch can be changed by anoffset message received in the corresponding inlet ofbpatcher. The wordoffset must befollowed by two ints, specifying the number of pixels by which the upper left cor-ner of the subpatch is to be offset horizontally and vertically within the bpatcher.In this way, a singlebpatcher can be used to give different views of the subpatch.User interface objects in the subpatch that are partially outside thebpatcher object’s box will redraw completely (even outside the bounds of thebpatcher) inresponse to messages received in their inlet. It is therefore advised that user inter-face objects in the subpatch be either completely inside or completely outside the
bpatcher object’s box.
border If the subpatch being used in thebpatcher contains athispatcher object connectedto one of itsinlet objects, the wordborder with any non-zero number in that inletcauses a black border to be drawn around thebpatcher. The messageborder 0 erasesthe border of thebpatcher (the default appearance).
(mouse) When the window containing thebpatcher is locked (or the Command key onMacintosh or Control key on Windows is held down) and the mouse is clickedinside thebpatcher object’s box, the gesture is handled by the patch inside the box.
If the Shift and Command keys on Macintosh or Shift and Control keys on Win-dows are held down while clicking on abpatcher, dragging the mouse moves theupper-left corner of the visible part of the patch inside the box. The Assistancearea of the patcher window shows the pixel values of the offset. IfEnable Drag-Scrolling is unchecked in thebpatcher Inspector window, this feature is disabled.
If the Command and Option keys on Macintosh or Control and Alt keys on Win-dows are held down while clicking in abpatcher, a pop-up menu allows you toopen the original file of the patch contained inside the box in its own window, orchange the patch currently contained inside the box in its own window.
Inspector The behavior of abpatcher object is displayed and can be edited using its Inspec-tor. If you have enabled the floating inspector by choosingShow FloatingInspector from the Windows menu, selecting anybpatcher object displays thebpatcher Inspector in the floating window. Selecting an object and choosingGetInfo… from the Object menu also displays the Inspector.
8/18/2019 Max 43 Reference
56/524
56
bpatcher Embed a v isiblesubpatch inside a box Thebpatcher Inspector lets you set the following attributes:
Offset specifies the number of pixels by which the left upper corner of the pictureis to be offset horizontally and vertically from the left upper corner of thefpic box.By default the left upper corner of the picture is located at the left upper corner offpic (that is, with an offset of 0,0). This offset can be changed by entering newpixel values into the number boxes. The default is no offset (i.e. 0 horizontal, 0vertical).
Use theOffset number boxes to specify the number of pixels by which the upperleft corner of the subpatch is to be offset horizontally and vertically within thebpatcher object’s display area. The default values are 0 for both horizontal and ver-tical offsets.
Checking the Border checkbox causes a black border to be drawn around thebpatcher. The default appearance is unchecked (no border).
TheEmbed Patcher in Parent checkbox allows you to embed the subpatch and saveit as part of the main patch (just as with apatcher object) instead of the subpatchbeing saved in a separate file. The default is unchecked (the subpatch is saved as aseparate file).
Checking theEnable Drag-Scrolling checkbox allows you move the upper-left cor-ner of the visible part of the patch inside the box by holding down the Shift andCommand keys on Macintosh or Shift and Control keys on Windows while click-ing on abpatcher, and dragging the mouse. The default value is unchecked (drag-scrolling is disabled).
ThePatcher File option lets you choose a patcher file for thebpatcher to use byclicking on theOpen button. The current file’s name appears in the text box to theleft of the button. You can also choose a file by typing its name in this box, or bydragging a file icon from the Finder into this box.
The Argum ents to Patcher lets you input arguments to your patcher which will besaved along with the main patch.
The Revert button undoes all changes you’ve made to an object’s settings since youopened the Inspector. You can also revert to the state of an object before youopened the Inspector window by choosingUndo Inspector Changes from the
Edit menu while the Inspector is open.
Arguments
None.
8/18/2019 Max 43 Reference
57/524
bpatcher Embed a v isiblesubpatch inside a box
57
Output
If the patcher being used in abpatcher containsoutlet objects, they will appear incorresponding left-to-right order as outlets in thebpatcher object’s box.
Examples
See Also
patcher Create a subpatch within a patchpcontrol Open and close subwindows within a patcherthispatcher Send messages to a patcher
Tutorial 27 Your object Tutorial 28 Your argumentEncapsulation How much should a patch do?
View the contents
of a subpatcher
T he contents of this patch
can be w indowed...
...using offset m essages to asmall bpatcher containing it
8/18/2019 Max 43 Reference
58/524
58
bucket Pass a num ber from outlet tooutlet, out each one in turnInput
int The numbers currently stored inbucket are sent out, then each number is movedone outlet to the right and the new number is stored to be sent out the left outletthe next time a number is received.
float Converted to int.
list Only the first number in the list is used.
bang All stored values are sent out, but their position is not shifted.
freeze Suspends thebucket output, but new incoming numbers continue to shift thestored values internally.
thaw Resumesbucket output.
roll The wordroll, followed by any number, causes bucket to use the value stored in itsrightmost outlet as input; thus, it sends its output, shifts all stored values to theright, then stores the value which had been in the rightmost outlet in the leftmostoutlet (as if it had been received in the inlet).
l2r Setsbucket to shift its stored values from left to right (the default) whenever itreceives a number in its inlet.
r2l Setsbucket to shift its stored values from right to left whenever it receives a num-ber in its inlet, placing the incoming number in the rightmost outlet.
set The wordset, followed by a number, sends that number out each outlet, and stores
the number as the next value to be sent out each of its outlets.
Arguments
int Optional. Sets the number of outlets. If there is no argument, there will be oneoutlet.
Output
int When a number is received, it is not sent out immediately, but the numbers storedinbucket are sent out. The numbers are all moved one outlet to the right, and the
newly received number is stored in the left position.
8/18/2019 Max 43 Reference
59/524
bucket Pass a num ber from outlet tooutlet, out each one in turn
59
Examples
Num bers are passed from one outlet to another
See Also
cycle Send a stream of data to individual outletsdecode Send1 or0 out a specific outlet
gate Pass the input out a specific outletspray Distribute an integer to a numbered outlet
8/18/2019 Max 43 Reference
60/524
60
buddy Synchronize arriving data,output them together Input
any message In any inlet: When data has been received inall its inlets,buddy sends the receivedmessages out their corresponding outlets, then waits until data has arrived againin all inlets.
clear In left inlet: Deletes all values stored in the inlets.
bang In any inlet: Same as the number0.
Arguments
int Optional. Sets the number of inlets (and outlets). If there is no argument, thereare two inlets and two outlets.
Output
any message When a data has arrived in each inlet, it is sent out the outlets, in order from rightto left.
Examples
Outpu t is synchronous, even if input is not synchronous
See Also
bondo Synchronize a group of messagesonebang Traffic control forbang messagespack Combine numbers and symbols into a listswap Reverse the sequential order of two numbers
thresh Combine numbers into a list, when received close togetherunpack Break a list up into individual messages
8/18/2019 Max 43 Reference
61/524
button Flash on any m essage,send a bang
61
Input
color The wordcolor, followed by a number from 0 to 15, sets the color of the center cir-cle of thebutton to one of the object colors which are also available via theColor command in the Object menu. Whenbutton sends abang, it always flashes withthe color yellow.
any message When any message is received in the inlet,button flashes briefly andbang is sentout the outlet. A mouse click on thebutton has the same effect.
Arguments
None.
Output
bang A mouse click or any message in the inlet causesbutton to flash and send outbang.
Examples
See Also
bangbang Send abang to many places, in ordermatrixcrtrl Matrix-style switch controlpictctrl Picture-based controltrigger Send input to many places, in orderubutton Transparent button, sends abang Tutorial 2 bang means “Do it!”
Triggers other messages and processes Converts other messages to bang
8/18/2019 Max 43 Reference
62/524
62
capture Store num bersto view or edit Input
int, float,or symbolNumbers or symbols are stored in the order in which they are received.
list All numbers and/or symbols in the list are stored in order from first to last.
clear Erases the contents of acapture object.
count Sends the number of items collected since the lastcount message out the right out-let of thecapture object.
dump Outputs the contents of thecapture object, one item at a time, out the left outlet.
open Causes the window associated with thecapture object to become visible. The win-dow is also brought to the front. Double-clicking on thecapture object in a lockedpatcher has the same effect.
wclose Closes the window associated with thecapture object.
write The wordwrite, followed by a symbol, saves the contents of thecapture object intoa text file, using the symbol as the filename. The file will be saved in the samefolder as the Max application, unless the symbol is a pathname specifying someother folder (such aswrite “MyDisk:/Documents/Captured Data/outputfile”). The wordwrite by itself causes a standard Save As dialog box to be opened, allowing you toname the file and save it in the desired folder.
Arguments
int Optional. The first argument sets a maximum number of items to store. If there isno argument,capture will store up to 512 items. Once the maximum has beenexceeded, the earliest stored item is dropped as each new item is received.
a,x orm Optional. If the second argument isa, all items will be displayed in ASCII form inthe editing window. If the second argument isx, all numbers will be displayed inhexadecimal form in the editing window.If the second argument ism, numbersless than 128 are displayed in decimal, and numbers greater than 128 are in hexa-decimal. If there is no argument, all items are displayed in decimal.
Output
int, float,or symbolOut left outlet: The captured contents are sent out the left outlet, one at a time, inresponse to thedump message.
Double-clicking oncapture (when the patcher window is locked) opens an edit-ing window in which the stored numbers can be viewed and edited. Editing thewindow does not actually alter the contents of capture, but is useful for cuttingand pasting values into atable or a separate file. (Althoughcapture can continue
8/18/2019 Max 43 Reference
63/524
capture Store nu m bersto view or edit
63
to store items while the editing window is open, the editing window is notupdated. It must be closed and reopened to view the newly stored items.)
int Out right outlet: The number of items received since lastcount message wasreceived is sent out the right outlet in response to acount message.
Examples
See Alsotext Format numbers as a text fileDebugging Techniques for debugging patches Tutorial 34 Managing raw MIDI data
Collect num bers to paste into a table… … or ju st to see w hat’s been going on
8/18/2019 Max 43 Reference
64/524
64
cartopol Cartesian to Polar coordinate conversionInput
float In left inlet: The real part of a frequency domain value to be converted into a polarcoordinate pair consisting of amplitude and phase values.
In right inlet: The imaginary part of a frequency domain value to be converted
into a polar coordinate pair consisting of amplitude and phase values.
int Converted tofloat.
Arguments
None.
Output
float Out left outlet: The magnitude (amplitude) of the frequency represented by the
currently input.
Out right outlet: The phase, expressed in radians, of the frequency represented bythe current input. If only the left outlet is connected, the phase computation is notperformed.
Examples
Convert Polar to Cartesian coordinates
See Also
atan2 Arc-tangent function (two variables)lcd Draw graphics in a patcher windowpoltocar Polar to Cartesian coordinate conversionpow Compute x to the power of y
8/18/2019 Max 43 Reference
65/524
change Filter out repetitionsof a number
65
Input
intorfloat The number is sent out the outlet only if it is different from the currently storedvalue. Replaces the stored value.
set The wordset,followed by a number, replaces the stored value without triggering
output.
mode The wordmode, followed by a+, causeschange to send a1 out its left outlet if thereceived number is greater than the previously received number. In this mode,change does nothing with any other input. The wordmode, followed by a-, causeschange to send out a-1 if the received number is less than the previously receivednumber. In this mode,change does nothing with any other input. The wordmode by itself returnschange to its default mode of sending out received values that dif-fer from the previously received input.
Argumentsintorfloat Optional. Initial value for comparison to incoming numbers. If there is no argu-
ment, the initial value is0.
symbol Optional. A second argument may be+ or-, causingchange to behave as if it hadreceived amode + ormode - message. Subsequentmode messages can change thisbehavior.
Output
int Out left outlet: The number received in the inlet is sent out only if it is different
from the stored value.
Out middle outlet: If the stored value is 0 and the input is not 0,1 is sent out; oth-erwise nothing is sent out.
Out right outlet: If the stored value is not 0 and the input is 0,1 is sent out; other-wise nothing is sent out.
Examples
Filter out un desirable repetitions
8/18/2019 Max 43 Reference
66/524
66
change Filter out repetitionsof a number See Also
peak If a number is greater than previous numbers, output ittogedge Report a change in zero/non-zero valuestrough If a number is less than previous numbers, output it!= Compare two numbers, output1 if they are not equal
Tutorial 15 Making decisions with comparisons
8/18/2019 Max 43 Reference
67/524
clip Lim it num berswithin a certain range
67
Input
int orfloat In left inlet: The number is sent out the outlet, constrained within the minimumand maximum limits specified by the arguments, inlets, or by aset message. If thenumber received is afloat, it will be sent out as afloat.
In middle inlet: Minimum limit for the range of the output.
In right inlet: Maximum limit for the range of the output.
list Each number in the list is constrained within the minimum and maximum limits,and the constrained numbers are sent out as a list.
set The wordset, followed by two numbers, resets the minimum and maximum lim-its within which all numbers will be constrained before being sent out the outlet.
Arguments
int orfloat Optional: The first number specifies a minimum limit and the second numberspecifies a maximum limit, within which all numbers will be constrained beforebeing sent out the outlet. If only one argument is present, it is used as both theminimum and maximum limit. If no argument is present, the minimum andmaximum limit is0.
Output
int When anint is received in the inlet, it is constrained within the specified mini-mum and maximum limits, then sent out the outlet. If the received number is less
than the minimum limit, the minimum value is sent out; if the received number isgreater than the maximum limit, the maximum value is sent out.
float If the received number is afloat, it is constrained within the specified minimumand maximum limits, then sent out the outlet as afloat.
list When alist is received in the inlet, each number is constrained within the specifiedminimum and maximum limits, and the numbers are sent out as a list.
Examples
Numbers are always kept w ithin the specified range
8/18/2019 Max 43 Reference
68/524
68
clip Limit num berswithin a certain rangeSee Also
maximum Output the greatest in a list of numbersminimum Output the smallest in a list of numberssplit Look for a range of numbers< Is less than, comparison of two numbers
Is greater than , comparison of two numbers>= Is greater than or equal to, comparison of two numbers
8/18/2019 Max 43 Reference
69/524
clocker Report elapsed t im e,at regular intervals
69
Input
int orfloat In left inlet: Any non-zero number startsclocker. The time elapsed sinceclocker was started is sent out the outlet at regular intervals.0 stopsclocker. If clocker isalready running when it receives a non-zero number, it continues reporting theelapsed time at regular intervals from that new point, but without resetting the
clock time to 0. Theclocker object’s minimum interval time is 0.02 second.
In right inlet: The number is the time interval, in milliseconds, at whichclocker will report the elapsed time. A new number in the right inlet does not take effectuntil the next time output is sent.
bang In left inlet: Startsclocker. If theclocker object is not running, abang message willstart the count. If theclocker object is running, abang message will reset the count.
stop In left inlet: Stopsclocker.
clock The wordclock, followed by the name of an existingsetclock object, sets theclocker to be controlled by thatsetclock rather than by Max’s internal millisecond clock. The wordclock by itself setsclocker back to using Max’s regular millisecond clock.
reset In left inlet: Resets the elapsed time to 0 without stopping or restarting the clock;clocker continues to report the new elapsed time at the same regular interval. Thismessage is meaningless when theclocker is not running, since it always resets to 0anyway when stopped.
Arguments
int Optional. The first argument sets an initial value for the time interval at whichclocker sends out its output. If there is no argument, the initial time interval is setto 5 milliseconds.
Output
int The time elapsed, in milliseconds, sinceclocker was started. The first output isalways0, sent immediately each timeclocker is started.
8/18/2019 Max 43 Reference
70/524
70
clocker Report elapsed time,at regular intervalsExamples
See Also
metro Output abang message at regular intervalssetclock Control the clock speed of timing objects remotelytempo Output numbers at a metronomic tempotimer Report elapsed time between two events Tutorial 31 Using timers
Get the elapsed tim e Generate numbers as a function of tim e
8/18/2019 Max 43 Reference
71/524
closebang Send a bangwhen patcher window is closed
71
Input
There are no inlets. Output occurs when the patcher window is closed.
Arguments
None.
Output
bang Sent automatically when the patcher window is closed.
Examples
See Also
active Send1 when patcher window is active,0 when inactive
button Flash on any message, send abangloadbang Send a bang automatically when patch is loaded Tutorial 40 Automatic actions
Stop a process when window
is about to be closed
… or turn off held notes
and sustain pedal
8/18/2019 Max 43 Reference
72/524
72
coll Store and edit a collectionof different m essagesInput
list The first number is used as theaddress (the storage location withincoll) at whichto store the remaining items in the list (coll can store a list of up to 250 items). Theaddress will always be stored as an int.
intor float The number refers to the address of a message stored incoll. If a message is storedat that address, the stored message is sent out the 1st outlet.
bang Same effect as thenextmessage.
(Get Info…) Acoll object can be set to save its contents as part of the patch that contains it.When the patcher window is unlocked, select thecoll object, chooseGet Info… from the Object menu, and checkSave coll with patcher.
assoc The wordassoc, followed by a symbol and a number,associates the symbol withthe address specified by the number, provided that the number address already
exists. From then on, any reference to that symbol will be interpreted bycoll as areference to the number address. Each number address can have only one symbolassociated with it, except 0, which cannot have an associated symbol. (Note: If thesymbol was already being used as an address, or was already associated with anumber address, the message that was stored at that address is removed.)
clear Erases everything from the collection.
deassoc The worddeassoc, followed by a symbol and a number, removes the associationbetween the symbol and the number address. The symbol no longer has anymeaning tocoll.
delete Functions similarly to the wordremove, except that if the specified address is anumber, all addresses of a greater number are decremented by 1.
dump Sendsall of the stored addresses out the 2nd outlet and all of the stored messagesout the 1st outlet, in the order in which they are stored. Abang is sent out the 4thoutlet when the dump is completed.
end Sets the pointer (used by thegoto,next, andprev messages) to the last address in thecoll.
filetype The wordfiletype, followed by a symbol, sets the file types which can be read and
written into thecoll object. File types are specified are specified using the standardfour-letter type code combination (e.g.filetype ffoo). The messagefiletype with noarguments restores the default file behavior—either Max binary or text file for-mats. File types are mapped to filename extensions on Windows based on themessages to max contained in the file max-fileformats.txt in the init folder, whichis loaded on startup. If you are defining your own filetype, you may want toinclude your own text file in the init folder in order to specify a mapping betweenan extension and your four-letter type code.
8/18/2019 Max 43 Reference
73/524
coll Store and edit a collectionof different m essages
73
flags Normally, the contents ofcoll are not saved as part of the patch when the patcherwindow is closed. The messageflags 1 0 sets thecoll object to save its contents aspart of the patcher that contains it. The messageflags 0 0 causes the contents of thecoll not to be saved with the patcher that contains it.
goto The wordgoto, followed by a number or a symbol, sets a pointer at the addressspecified by the number or symbol. If no such address exists, the pointer is set atthe beginning of the collection. The pointer is set at the beginning of the collec-tion initially, by default.
insert The wordinsert, followed by a number and a message, inserts the message at theaddress specified by the number, incrementing all equal or greater addresses by 1if necessary.
length Counts the number of messages contained incoll and sends the number out the1st outlet. This message works well in conjunction with thegrab object.
max Determines themaximum single numerical value (i.e. not a list or symbol) storedin thecoll and sends the number out the 1st outlet. This message works well inconjunction with thegrab object.
merge The wordmerge, followed by an address and a message, appends its message at theend of the message already stored at that address. If the address does not yet exist,it is created.
min Determines theminimum single numerical value (i.e. not a list or symbol) storedin thecoll and sends the number out the 1st outlet. This works well in conjunctionwith thegrab object.
next Sends the address pointed to by the pointer out the 3rd outlet, and sends the mes-sage stored at that address out the 1st outlet, then sets the pointer to the nextaddress. If the address is a symbol rather than a number,0 is sent out the 3rd out-let. If the pointer is currently at the last address in the collection, itwraps around tothe first address. (Note: Number addresses are stored in ascending order. Symboladdresses are stored in the order in which they were added to the collection, afterall of the number addresses.) If the message received immediately prior tonext wasprev,next sends out the value stored at the address one greater than the one that was just sent out.
nstore The wordnstore, followed by a number and a symbol (or a symbol and a number),followed by any other message, stores the message at the specified numberaddress in thecoll, with the specified symbol associated. (This has the same effectas storing the message at an int address, then using theassoc message to associate asymbol with that number.)
nsub The wordnsub, followed by an address, an item number, and another number orsymbol, replaces one item stored at the address. (Example:nsub pgms 4 7 puts the
8/18/2019 Max 43 Reference
74/524
74
coll Store and edit a collectionof different m essagesnumber7 in place of the 4th item of the message stored at the addresspgms.)Number values and symbols can both be substituted in this manner.
nth The wordnth, followed by an address and a number, gets thenth item (specifiedby the number) from the message at that address, and sends it out the 1st outlet.(Example:nth pgms 4 outputs the 4th item in the message stored at the addressnamedpgms.)
open Causes a text edit window associated with thecoll object to become visible. Thewindow is also brought to the front.
prev Causes the same output as the wordnext, but the pointer is then decrementedrather than incremented. If the pointer is currently at the first address in the col-lection, itwraps around to the last address. If the message received immediatelyprior toprev wasnext,prev sends out the value stored at the address one less thanthe one that was just sent out.
read The wordread with no arguments puts up a standard Open Document dialog boxfor choosing a file to load intocoll. Ifread is followed by a symbol filename argu-ment, the named file is located and loaded intocoll.
readagain Loads in the contents of the most recently read file. If no priorread orreadagain message has been received by thecoll,readagain is treated as aread message, and anOpen Document dialog box is displayed.
refer The wordrefer, followed by the name of anothercoll object, changes thecoll receiv-ing the message to refer to the data in the namedcoll object.
In addition to reading messages in from another file and storing messages via theinlet, one can also enter messages incoll by typing. Double-clicking with themouse on thecoll object displays the contents as text in an editing window whichthe user can modify.
In order to edit a collection by hand or read in from another file, it is essential toknow the correct text format for the contents of acoll object. Each message isstored in thecoll object on a separate line. The format of each line is as follows: theaddress (an int or a symbol), any symbols associated with that address (if theaddress is an int), a comma (to separate the address from the data it contains), thedata (anything), and a semicolon to indicate the end of each line. In a line such as
3 reset, set 4.7;
3 is the number of the address,reset is a symbol associated with that address, andthe message it contains isset 4.7.
8/18/2019 Max 43 Reference
75/524
coll Store and edit a collectionof different m essages
75
Here is how we would store the numbers 100, 200, 300, and 400 with theaddresses 1, 2, 3, and 4.
1, 100;2, 200;3, 300;4, 400;
remove The wordremove, followed by a number or a symbol, removes that address and itscontents from the collection.
renumber Makes the numbers associated with the data in thecoll object consecutive andincreasing. The argument to the renumber message specifies the starting numberaddress for the data. Here’s a before and after example forcoll sent the messagerenumber 1.
Before After
4, apple; 1, apple;6, banana; 2, banana;3, cherry; 3, cherry;9, durian; 4, durian;
sort Thesort message takes two arguments. If the first argument is-1, the items in thecoll are sorted in ascending order. If the first argument is1, the items in thecoll aresorted in descending order.
The second argument specifies what is used to sort the contents of thecoll. If thesecond argument is-1, the index (or symbol) associated with the data is used. If
the second argument is not present or0, the first item in the data is used. If thesecond argument is1 or greater, the second (or greater) item in the data is used.
store The wordstore, followed by some symbol (usually a word), followed by a message,stores the message at an address named by the symbol. (Example:store triad 0 4 7 will store the list0 4 7 at an address namedtriad.)
sub Same asnsub, except that the message stored at the specified address is sent outafter the item has been substituted.
swap Theswap message takes two symbols or two numbers as addresses, and exchangesthe data associated with each address. For example, if thecoll contains
1, 400;2, 700;
swap 1 2 would change thecoll to
1, 700;2, 400;
8/18/2019 Max 43 Reference
76/524
76
coll Store and edit a collectionof different m essagessubsym Changes the symbol associated with data. The first argument tosubsymis the new
symbol to use, and the second argument is the symbol associator to replace. Forinstance, if thecoll contains
jill, 40 50 60;
subsymjack jill will change thecoll to
jack, 40 50 60;
symbol The symbol refers to the address of a message stored incoll. If a message is storedat the address named by the symbol, the message is sent out the 1st outlet. Thesymbol may, but need not necessarily, be preceded by the wordsymbol.
wclose Closes the window associated with thecoll object.
write Calls up the standard Save As dialog box, enabling the user to save the contents of
coll as a separate file. If the wordwrite is followed by a symbol, the contents of thecoll are saved immediately in a file, using the symbol as the filename.
writeagain Saves the contents of thecoll into the most recently written file. If no priorwrite orwriteagain message has been received by thecoll,writeagain is treated as awrite mes-sage, and a Save As dialog box is opened.
Inspector
The behavior of acoll object is displayed and can be edited using its Inspector. Ifyou have enabled the floating inspector by choosingShow Floating Inspector
from the Windows menu, selecting anycoll object displays thecoll Inspector in thefloating window. Selecting an object and choosingGet Info… from the Objectmenu also displ