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

trough Reference

Output a number if it is less than previous numbers

trough

Description

Compares an input value to the stored value and, if it's smaller it sends the input to the output and sets it as the new trough.

Examples

Find the smallest in a series of numbers... Number in right inlet always sets a new trough

Arguments

value [float]

Optional

The initial value stored in trough is 128. Providing a float argument will cause trough to operate on floating-point values instead of integers.

Attributes

Common Box Attributes

Messages

bang

In left inlet: Sends the currently stored minimum value out the left outlet.

int

Arguments

input [int]
In left inlet: If the input is less than the value currently stored in trough, it is stored as the new minimum value and is sent out.

  (inlet1)

Arguments

trough [int]
In right inlet: The input is stored in trough as the new minimum value, and is sent out.

float

Arguments

input [float]
In left inlet: If the input is less than the value currently stored in trough, it is stored as the new minimum value and is sent out.

  (inlet1)

Arguments

trough [float]
In right inlet: The input is stored in trough as the new minimum value, and is sent out.

Output

int

Out left outlet: New minimum values are sent out. (Numbers received in the right inlet are always the new minimum value.)

Out middle outlet: If the number received is a new minimum value, the output is 1. If the number received in the left inlet is not a new minimum value, the output is 0.

Out right outlet: If the number received is a new minimum value, the output is 0. If the number received in the left inlet is not a new minimum value, the output is 1.

See Also

Name Description
minimum
peak
<
Max Data Tutorial 2: Data Scaling Max Data Tutorial 2: Data Scaling