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

round~ Reference

Round an input signal value

round~

Description

Use the round~ object to round a signal input to an integer multiple.

Examples

round~ takes floating-point signals and rounds them to a specific increment

Discussion

You can set the object's 'nearest' attribute to determine whether or not it rounds to the absolute nearest integer multiple, or the nearest integer multiple between the value and zero (for positive numbers this will round down). By default this is on.

Arguments

int or float [number]

Optional

Sets the value to which the input signal will be rounded. The default value is 0. (no modification).

Attributes

nearest [int]

When set to 1 (the default), the round~ object will round to the nearest multiple of the specified signal value.

Note: This attribute does not set the rounding step (which is set using round~ object's right inlet), It specifies that rounding to the nearest signal value will occur. Here are some examples:

With the rounding interval set to 3 and the nearest attribute set to 1:
an input signal value of 5.8 will return 6
an input signal value of 3.7 will return 3
an input signal value of -1 will return 0
an input signal value of -2.7 will return -3

With the rounding interval set to 3 and the nearest attribute set to 0:
an input signal value of 5.8 will return 3
an input signal value of 3.7 will return 3
an input signal value of -1 will return 0
an input signal value of -2.7 will return 0

Common Box Attributes

Messages

int

Arguments

rounding-multiple-specifier [int]
In right inlet: an int will cause the input to be rounded to the nearest multiple of the specified number. If a signal is attached to the inlet, int messages are ignored.

float

Arguments

rounding-multiple-specifier [float]
In right inlet: a float will cause the input to be rounded to the nearest multiple of the specified number. If a signal is attached to the inlet, float messages are ignored.

signal

In left inlet: A signal whose values will be rounded.

In right inlet: A signal whose value is used for rounding. Signal values received in the left inlet will be rounded to either the absolute nearest integer multiple or the nearest integer multiple between the value received in this inlet or 0 (see the nearest message for more information).

Output

signal

The rounded input signal.

See Also

Name Description
rampsmooth~
slide~
trunc~
round