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

count~ Reference

Count samples elapsed

count~

Description

Use the count~ object count samples elapsed and thus drive processes tightly synchronized to the sample rate. It outputs a signal increasing by 1 for each sample elapsed. It can be set to loop, and can be used to drive objects such as index~ with sample accuracy.

Examples

Send out a running count of the passing samples, beginning at a given point

Arguments

initial-value [int]

Optional
Unitssamples

Counter initial value

count-limit [int]

Optional
Unitssamples

Set a count limit for a looping counter, or 0 for no count limit. Note that the limit value is never reached.

enable [int]

Optional

Specify whether the count~ object is off (0) or on (1) initially.

autoreset-state [int]

Optional

When enabled, the internal counter is reset to the initial value whenever audio is turned on (see the autoreset message).

Attributes

autoreset [int]

Reset the counter to the initial value when audio turns on

Common Box Attributes

Messages

bang

Reset to initial and begin counting

int

Arguments

initial-value [int]
Set initial value, reset, and begin counting

  (inlet1)

Arguments

count-limit [int]
Set limit value. A value of 0 eliminates the counter limit.

float

Arguments

initial-value/count-limit [float]
Left inlet: Set initial value without reset

Right inlet: Set limit value without reset

list

Arguments

initial-value [int]
count-limit [int]
enable [int]
autoreset-state [int]
Set initial, limit, enable and autoreset state

min

Arguments

initial-count [int]
Set initial value without reset

set

Arguments

initial-count [int]
Set initial value without reset

signal

Enable counting with non-zero signal

stop

Reset to initial value

Output

signal

When the audio is first turned on, count~ always sends out its current initial value. When a bang or int is received, the count begins increasing from the current initial value.

See Also

Name Description
MC MC
index~
mstosamps~
sampstoms~
+=~
counter
MSP Sampling Tutorial 1: Recording and Playback MSP Sampling Tutorial 1: Recording and Playback