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

change Reference

Filter out repetitions of a number

change

Description

Output a number only if it is different from the stored number and will reset the stored number to that differing input number. Alternate modes of operation also identify greater-than or less-than the conditions.

Examples

Filter out undesirable repetitions

Arguments

initial-value [int or float]

Optional

Sets the initial value for comparison to incoming numbers. If there is no argument, the initial value is 0.

mode [symbol]

Optional

A second argument may be + or -, a change to mode + or mode -. Subsequent mode messages can change this behavior.

Attributes

Common Box Attributes

Messages

int

Arguments

input [int]
The number is sent out the outlet only if it is different from the currently stored value. Replaces the stored value.

float

Arguments

input [float]
Outputs the number only if it is different from the currently stored value. Replaces the stored value.

mode

Arguments

flag (+ or -) [symbol]
Sets the detection mode of change. The word mode, followed by a +, causes change to send a 1 out its left outlet if the received number is greater than the previously received number.
The word mode, followed by a -, causes change to send out a -1 if the received number is less than the previously received number.
The word mode by itself returns change to its default mode of sending out received values that differ from the previously received input.

set

Arguments

stored value [number]
Replaces the stored value without triggering output.

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; otherwise nothing is sent out.

Out right outlet: If the stored value is not 0 and the input is 0, 1 is sent out; otherwise nothing is sent out.

See Also

Name Description
Working with Video in Jitter Working with Video in Jitter
peak
togedge
trough
Max Basic Tutorial 15: Abstractions Max Basic Tutorial 15: Abstractions