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

shape~ Reference

Time-scaled Breakpoint Envelope Generator

shape~

Description

An envelope for the shape~ object can be defined using the same format as the line~ or zigzag~ objects (and edited graphically by connecting a function object). Unlike line~ the time values of shape~ are normalized so that the output occurs within signal ramp of a phasor from 0 to 1 (or 1 to 0). This means you can trigger the output sample-accurately and determine the time of the function by using different ramp durations (or phasor~ frequencies).

Arguments

None.

Attributes

constant [int]

Sets the number of initial segments of the envelope that will be played at a constant time based on their millisecond time values independent of the input ramp duration. The default value for constant is zero, meaning none of the segments will be played with a constant time -- all segments will be scaled. If constant is 1, the first ("attack) segment will have a constant time and the remaining segments will be scaled to occupy the part of the incoming ramp starting when the input value when the constant portion of the output ends. For example, if the first segment is constant and it ends when the input is equal to 0.5, the remaining part of the envelope will be re-normalized to fit into the space between 0.5 and 1.
Note that the constant attribute only works with ascending ramps and can only designate segments at the beginning of an envelope.

curvemode [int]

Sets whether shape~ plays curved breakpoints and how it interprets incoming lists. Possible values:

0 = 'Off' ( No curved breakpoints )
When curvemode is disabled (Off), shape~ interprets incoming lists to set its breakpoints as time, alue pairs. If any curved breakpionts were previously set, they are played as linear ramps.

1 = 'On' ( Use curved breakpoints )
When curvemode is enabled (On), shape~ interprets incoming lists to be triplets consisting of time, value, curvature. All curved breakpoints are output with their curvature.

2 = 'Auto' ( Use connected function mode setting )
When curvemode is set to Auto, shape~ determines how to interpret incoming lists on the basis of the mode attribute of a connected function or mc.function object. If mode is set to 0 (Linear), lists are interpreted as time, value pairs. If mode is set to 1 (Curve), lists are interpreted as time, value, curvature triplets. If any segments contain non-zero curvature, they are played with their curvature.
In order for Auto mode to work properly, the function object must have its second outlet directly connected to the left inlet of shape.

Common Box Attributes

annotation [symbol]

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

background [int] (default: 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] (default: 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] (default: 0)

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

jspainterfile [symbol]

JS Painter File

patching_rect [4 floats] (default: 0. 0. 100. 0.)

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

position [2 floats]

g/s(set)

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] (default: 0)

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

presentation_rect [4 floats] (default: 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]

g/s(set)

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]

g/s(set)

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

Converted to float

float

Arguments

initial-value [float]
float in the left inlet defines the the initial value of the function. Without a subsequent list message, a single float does not cause a new function to be defined (or the existing function to be replaced).

list

Arguments

breakpoints [list]
list message defines the breakpoint function used by shape~. There are two options for the format of the list, depending on the setting of the curvemode attribute. When curvemode is disabled, the format of the list is in value, time pairs where the first number is a destination value and the second number is the time in milliseconds it takes to get to that value from the previous value. This format (along with an initial float value0) is produced by the second outlet of the function object. The millisecond time values are normalized; in other words, they are divided by the total length of the function. Longer times between breakpoints will be longer than shorter times but the exact times will be dependent on the duration of the incoming ramp.
When curvemode is enabled, the list format starts with the initial float followed by triplets of numbers -- value, time, curvature-- for each breakpoint. The curvature value ranges from -1 to 1.

signal

shape~ starts its output when the input ramp either turns on or resets.

See Also

Name Description
function Breakpoint function editor
curve~ Exponential ramp generator
line~ Linear signal ramp generator
mc.pattern~ Signal Pattern Sequencer and Recorder
phasor~ Generate sawtooth signals
ramp~ Trigger a Single Ramp With an Audio Signal
techno~ Signal-driven step sequencer
zigzag~ Linked list function editor