sustain Reference

Hold note-off messages for release

sustain

Description

Holds any notes with velocities of 0 until instructed to release them. This provides for sustain pedal-like behavior when working with incoming MIDI notes.

Examples

Like the sustain pedal of a piano, sustain releases all held notes at one time

Arguments

None.

Attributes

repeatmode [int]

Sets the behavior mode for handling repeated note-on messages. There are three modes of behavior:

repeatmode 0: (Historical way) Playing the same note multiple times will not retrigger the played note when the sustain pedal is pressed or after a sustain 1 message is received. This is the default state of the object.
repeatmode 1: (Re-trigger) Playing the same note multiple times will send a note off message and retrigger the played note no matter what its sustain state is. The sustain object will also keep track of the notes to stop when the sustain pedal is released or a sustain 0 message is received.
repeatmode 2: (Stop last) Playing the same note multiple times will cause the sustain object to keep a count of the number of times the note has been played, holding and sending the accumulated note off messages when the sustain pedal is released or a sustain 0 message is received. Possible values:

0 = 'Historical Way'
1 = 'Re-Trigger'
2 = 'Stop Last'

sustain [int]

Enables (1) or disables (0) sustain mode. Setting this attribute or sending the message sustain 1 or sustain 0 is equivalent to pressing or releasing the sustain pedal.

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

Arguments

input [int]
In left inlet: The number is the pitch value of a pitch-velocity pair. If the velocity value currently held by sustain is not 0, then the pair is sent out immediately. If the velocity is 0, the note-off is either sent out or held, depending on whether sustain is turned on.
In middle inlet: The number is stored as a velocity to be paired with pitch numbers received in the left inlet.
In right inlet: If the number is not 0, sustain is turned on, and all note-offs are held. If the number is 0, sustain is turned off, and all note-offs are sent out immediately.

float

Arguments

input [float]
Converted to int.

list

Arguments

note/velocity pair [list]
In left inlet: A two-item list consisting of a note-velocity pair can be input.

clear

Clears the sustain object's internal memory. No note-off messages are output.

flush

Output all held note-offs.

Output

int

Out left outlet: The pitch value of a pitch-velocity pair.

Out right outlet: The velocity value of a pitch-velocity pair.

Note-on pairs are always sent out immediately. If sustain is turned on, note-offs are held until it is turned off. Otherwise, note-offs are sent out immediately.

See Also

Name Description
MIDI MIDI
flush Output MIDI note-offs for held notes
makenote Generate a note-on/note-off pair
stripnote Filter out note-off messages