setclock
Description
Allows the creation of alternatives to the standard millisecond clock. This includes several modes of timing that change timing activities. Each setclock is associated with a name (its first argument), and this name may be passed as the argument to a "clock" message to numerous objects that use timing in Max, such as metro, line, and pipe.
Examples

Arguments
name [symbol]
Obligatory. The first argument is the name of the setclock object, by which timing objects such as clocker, line, metro, pipe, and tempo can refer to the setclock. Those timing objects -- once they have received the message followed by the name of a setclock object -- use that setclock as their timing source instead of Max's regular millisecond clock. The setclock object need not be in the same patcher as the timing objects that refer to it. More than one setclock object may exist with the same name; setclock objects with the same name share the same clock time information. (Note: Different setclock objects that share the same name argument can have different mode arguments typed in, but they will in fact operate with the mode of whichever setclock was first loaded with that name. Thus, setclock objects with the same name but different modes may behave unpredictably, since the order in which they are loaded by Max is often unknown.)
The second (optional) argument describes the mode of clock operation this setclock object will have. The possible modes for the second argument are:
mode [symbol]
The word setclock object's current clock time is set by a number received in the left inlet, and associated timing objects will follow that clock time just as if it were a regularly progressing millisecond clock. If no second argument is present, the mode is by default.
The word specifies additive mode. A number received in the left inlet is added to the current clock time to determine the new clock time.
The word specifies multiplicative mode. The number received in the left inlet is used as a factor by which all associated timing objects will modify their time settings. For example, a factor of will cause all timing objects that are using the setclock as their clock source to double their time values (that is, to halve their speed). An alternative (and perhaps more truthful) way to conceptualize the behavior of mode is to think of the incoming float as a divisor by which setclock divides the speed at which its own clock time progresses. Thus, when it receives the number it divides its own clock speed by 2.0, causing the objects which are following that clock to progress twice as slowly.
The word specifies interpolate mode. The number received in the left inlet is gradually added to the current time of setclock, over a time period determined by the amount of time elapsed since the previous number was received. During that time period, setclock linearly interpolates to set its clock to the intermediate values.
multiplier [float]
If the second argument is
, an optional third argument specifies a multiplier for the time of all associated timing objects. If no third argument is present, the multiplier is by default.Attributes
Common Box Attributes
Messages
bang
int
Arguments
In right inlet: Sets the time interval, in milliseconds, at which the setclock will report its clock information to associated timing objects. The default is milliseconds.
float
Arguments
(inlet1)
Arguments
clock
Arguments
(mouse)
reset
Arguments
set
Arguments
Output
int
When setclock sends its current time reading out the outlet.
is received in the left inlet,See Also
Name | Description |
---|---|
Timing and Sequencing Events | Timing and Sequencing Events |
clocker | |
metro | |
timer |