Package MSP

subdiv~

Integer Subdivision of a Phasor

Description

The subdiv~ object evenly subdivides an input phasor signal into any integer number of output phasor signals.

Discussion

The subdiv~ object is sample-accurate when Scheduler in Audio Interrupt is enabled. More details here.

Arguments

subdivisions[int]
optional

A typed-in argument sets the initial number of subdivisions of the input.

Attributes

div[int]

Sets the number of subdivisions (from 1 to 16384)

lockprob[int]

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[atom]

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[atom]

With the prob you can set a pattern of probabilities for each output ramp. Patterns consist 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), send the message prob the argument none or no arguments.
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[int]

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

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[int]

If syncupdate is enabled, changes to the subdivision value will only take effect when either the input or output resets, according to the value of the enum. Possible values:

0 = 'Off' ( No Update Synchronization )
Changes to the subdivision value take effect immediately.

1 = 'Output Reset' ( Update on Output Reset )
Changes to the subdivision value take effect when the output phasor resets.

2 = 'Input Reset' ( Update on Input Reset )
Changes to the subdivision value take effect when the input phasor resets.

Common Box Attributes

Below is a list of attributes shared by all objects. If you want to change one of these attributes for an object based on the object box, you need to place the word sendbox in front of the attribute name, or use the object's Inspector.

annotation[symbol]

Sets the text that will be displayed in the Clue window when the user moves the mouse over the object.

background[int]: 0

Adds or removes the object from the patcher's background layer. background 1 adds the object to the background layer, background 0 removes it. Objects in the background layer are shown behind all objects in the default foreground layer.

color[4 floats]

Sets the color for the object box outline.

fontface[int]

Sets the type style used by the object. The options are:

plain
bold
italic
bold italic Possible values:

0 = 'regular'
1 = 'bold'
2 = 'italic'
3 = 'bold italic'

fontname[symbol]

Sets the object's font.

fontsize[float]

Sets the object's font size (in points). Possible values:

'8'
'9'
'10'
'11'
'12'
'13'
'14'
'16'
'18'
'20'
'24'
'30'
'36'
'48'
'64'
'72'

hidden[int]: 0

Toggles whether an object is hidden when the patcher is locked.

hint[symbol]

Sets the text that will be displayed in as a pop-up hint when the user moves the mouse over the object in a locked patcher.

ignoreclick[int]: 0

Toggles whether an object ignores mouse clicks in a locked patcher.

jspainterfile[symbol]

JS Painter File

patching_rect[4 floats]: 0. 0. 100. 0.

Sets the position and size of the object in the patcher window.

position[2 floats]
write-only

Sets the object's x and y position in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its size unchanged.

presentation[int]: 0

Sets whether an object belongs to the patcher's presentation.

presentation_rect[4 floats]: 0. 0. 0. 0.

Sets the x and y position and width and height of the object in the patcher's presentation, leaving its patching position unchanged.

rect[4 floats]
write-only

Sets the x and y position and width and height of the object in both patching and presentation modes (if the object belongs to its patcher's presentation).

size[2 floats]
write-only

Sets the object's width and height in both patching and presentation modes (if the object belongs to its patcher's presentation), leaving its position unchanged.

textcolor[4 floats]

Sets the color for the object's text in RGBA format.

textjustification[int]

Sets the justification for the object's text. Possible values:

0 = 'left'
1 = 'center'
2 = 'right'

varname[symbol]

Sets the patcher's scripting name, which can be used to address the object by name in pattr, scripting messages to thispatcher, and the js object.

Messages

int

Sets the number of subdivisions (from 1 to 16384)

Arguments:
  • subdivisions [int]

float

Converted to int

Arguments:
  • subdivisions [float]

signal

Drive a subdiv~ object with a signal that ramps from 0 to 1.

See Also

Name Description
phasor~ Generate sawtooth signals
kink~ Distort a sawtooth waveform
line~ Linear signal ramp generator
mc.snowphasor~ Control a Population of Phasors
pong~ Variable range signal folding
rate~ Time-scale the output of a phasor~
swing~ Subdivide a phasor into two unequal phasors
wrap~