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

counter Reference

keep count based on input events

counter

Examples

Inlets

input [bang]

When any event message (bang or number) is received in the left inlet, add the inc value to the current count.

direction [number]

Set Direction: 0 = Up, 1 = Down, 2 = UpDown

resetnext [number, bang]

A number received in the middle inlet will be output the next time the left inlet receives an event message. Note that this value can be outside the current limits of the counter.

resetnow [number, bang]

A number received in the right-middle inlet sets the internal state of the counter and is immediately sent out the left outlet.

maximum [number]

Sets the maximum count value.

Outlets

output [number]

Outputs the current count value whenever the left inlet receives an event message (or when the middle-right inlet receives a number).

underflow [bang, number]

The left-middle outlet sends a number or bang (depending on the carryflag attribute) any time the minimum count is reached. Note this only applies when using direction 1 (down) or 2 (up/down).

overflow [bang, number]

The right-middle outlet sends a number or bang (depending on the carryflag attribute) any time the maximum count ( limit ) is reached. Note this only applies when using direction 0 (up) or 2 (up/down).

carry [number]

Tracks the total number of times that counter has reached the counting limit. If using direction 2 , reaching both the minimum and the maximum values will add to the carry count.

Fixed Attributes

These attributes must be set in the object box and determine the behavior of the object at runtime.

inc [number] (default: 1)

Determines the amount that will be added to the count each time a new event message is received in the left inlet.

Dynamic Attributes

These attributes can be modified in the code during execution using the set object

carryflag [enum] (default: numeric)

Set underflow/overflow output type Possible values:

0 = 'numeric'
1 = 'bang'

direction [number]

Set Direction: 0 = Up, 1 = Down, 2 = UpDown

input [bang]

When any event message (bang or number) is received in the left inlet, add the inc value to the current count.

maximum [number]

Sets the maximum count value.

minimum [number] (default: 0)

Set the minimum value for the counting range.

resetnext [number, bang]

A number received in the middle inlet will be output the next time the left inlet receives an event message. Note that this value can be outside the current limits of the counter.

resetnow [number, bang]

A number received in the right-middle inlet sets the internal state of the counter and is immediately sent out the left outlet.

See Also

Name Description
counter Keep count based on bang messages
accum Additive accumulator
counter~ counter~
tempo tempo
splineinterp~ Catmull-Rom spline interpolation