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

subdiv~ Reference

Predictive subdivision of an input phasor

subdiv~

Examples

Arguments

div [number]

Optional

Sets the number of subdivisions (from 1 to 16384)

syncupdate [enum]

Optional

When syncupdate is enabled, messages to change the values to detect do not take effect until the input phasor resets. A reset is defined as a direction reversal in the signal.

Inlets

input [signal, number]

The signal input to be subdivided

Outlets

output [signal]

The subdivided output

step [signal]

Step Number

stepmessage [number]

The subdivided output

Dynamic Attributes

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

div [number] (default: 1)

Sets the number of subdivisions (from 1 to 16384)

input [signal, number]

The signal input to be subdivided

lockprob [bool] (default: true)

When lockprob is enabled, the cyclic probability pattern is locked to the cyclic duration pattern, so a probability decision is made per duration event. When lockprob is disabled, the probabilities follow the subdivided phasor output. Stated another way, when lockprob is disabled, the probabilities maintain their position within a cyclic duration pattern.

pattern [list]

Establishes a cyclic duration pattern that can modify the duration the phasor output of each step.

Patterns consist of integers 1 and above, permitting you to break up the input into unequal durations. For example, if you are subdividing the input by 3, setting the pattern to 1 2, which will output a phasor that takes 1/3 of the input time followed by a second phasor of 2/3 of the input time.

Note that subdiv~ does not support duration patterns that do not line up with the current input subdivision. As an example, a pattern of 2 2 2 will not produce expected results because the middle element crosses the point where the input resets. You can often avoid this limitation by increasing the subdvision and reducing the rate of the input phasor.

In general, patterns can span multiples of the current subdivision and will work properly as long as they always reset when the input resets. For example, with a subdivision of 3, you will see expected results with a pattern of 2 1 1 2 1 1 1 because the output ramps will always reset when the input resets. If the pattern does not end at input reset boundary, it is padded with a last element. For example, if the subdivision is 5, setting the pattern to 1 2 will result in a third step of 2 before the pattern resets.

prob [list]

With the prob you can set a pattern of probabilities for each output ramp. Patterns consists of 0, 1, or a float between 0 and 1.

When the pattern value is 0, the output of subdiv~ will be a constant 0 for that step. When the pattern value is 1, the output of subdiv~ is the normal phasor ramp. When the value is between 0 and 1, it is taken as a probability of the phasor occurring for that step.

The pattern does not have to have the same length as the number of subdivisions. Example: a pattern of 0 1 0.5 will, over a cycle of three steps, never output the first time, always output the second time, and output the third step half the time.

To clear the pattern (and always output every step), you can optionally send a bang. When both prob probability pattern and a pattern duration multiplier pattern are in use, the prob pattern is consulted whenver a new step in the duration pattern is started.

silentmode [bool] (default: false)

Determines index output for when phasor output is skipped. Possible values include:

0 = 'Hold Previous Step' ( Don't change step number ) When silentmode is set to Hold Previous Step (0), the index output of subdiv~ does not change from the previous step if the phasor output is zero.

1 = 'Output -1' ( Output -1 ) When silentmode is set to Output -1 (1), the index output of subdiv~ is -1 if the phasor output is zero.

syncupdate [enum] (default: off)

When syncupdate is enabled, messages to change the values to detect do not take effect until the input phasor resets. A reset is defined as a direction reversal in the signal.

Possible values:

0 = 'off'
1 = 'output'
2 = 'input'

See Also

Name Description
what~ Generate Impulses for a List of Audio Values
subdiv~ Integer Subdivision of a Phasor
edge~ detect logical signal transitions