A newer version of Max is available. Click here to access the latest version of the documentation

accum Reference

Store, add to, and multiply a number

accum

Description

Stores a value (int or float), then adds or multiplies into it. If the argument is an integer, the multiplication is done in floating-point then converted to integer.

Examples

Add to and/or multiply a stored value....... Used here to increment by different amounts

Arguments

initial [int or float]

Optional

Sets the initial value stored in accum. An argument with a decimal point causes the value to be stored as a float.

Attributes

Common Box Attributes

Messages

bang

In left inlet: Outputs the value currently stored in accum.

int

Arguments

input [int]
In left inlet: Replaces the value stored in accum, and sends the new value out the outlet.

  (inlet1)

Arguments

input [int]
In middle inlet: The number is added to the stored value, without triggering output.

  (inlet2)

Arguments

input [float]
In right inlet: The stored value is multiplied by the input, without triggering output.

float

Arguments

input [float]
In left and middle inlet: Converted to int, unless accum has a float argument.

In right inlet: Multiplication is done with floats, even if the value is stored as an int.

  (inlet1)

Arguments

input [float]
In left inlet: The message ft1, followed by a number, adds the number to the stored value without triggering output.

set

Arguments

input [int]
In left inlet: The word set, followed by a number, sets the stored value to that number, without triggering output.

Output

float

Floats are output only if there is an argument with a decimal point.

int

The value currently held by accum.

See Also

Name Description
counter
float
int