sash~ Reference

Sample and Hold with Memory

sash~

Description

The sash~ object performs sample-and-hold operations on an input signal but unlike the sah~ includes a buffer (the extra "s" in sash~ is for "storage") that can holds samples of the input. Sample capture and sample output are triggered independently of each other, and sash~ includes a variety of methods for selecting the output sample from the memory buffer.

Arguments

None.

Attributes

advancelevel [float]

Sets the level of the signal connected to the right inlet that will cause the next value in the memory buffer to be used. The next index into the buffer is chosen according to the dir attribute.

dir [int]

Determines how the next memory buffer index is chosen when the advance trigger signal exceeds the advance level.

Possible values:

0 = 'Forward' ( Increment forward )
1 = 'Reverse' ( Increment backward )
2 = 'Random' ( Choose index randomly with replacement )
3 = 'Urn' ( Choose index randomly without replacement )

maxsize [int]

Sets the maximum possible value of the size attribute. The default is 1000 samples. Note that maxsize can only be changed as a typed-in argument.

mode [int]

Determines the interpretation of the advance trigger signal

Possible values:

0 = 'Level' ( Signal exceeds a threshold level )
1 = 'Index' ( Integer value of the advance trigger signal )
2 = 'Subdivision' ( Phasor subdivision of the advance trigger signal )
When the mode attribute is set to Subdivision, the index into the memory buffer is determined by dividing 1 into the current value of the size attribute. For example, if the size is 2, advance trigger signal values below 0.5 will play the first memory buffer sample (index 0), and advance trigger signal values above 0.5 will play the second memory buffer sample (index 1).

samplelevel [float]

Sets the level of the signal connected to the middle inlet that will cause the next value in the left inlet to be sampled and recorded into the memory buffer.

size [int]

Sets the current size of the memory buffer used for recording and output. The size must be greater than 0 and less than or equal to the maxsize attribute.

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

A float in the middle inlet sets the sample trigger level. A float in the right set the level for advancing to the next output value from the memory buffer.

list

A list of values is assigned to the memory buffer. This is useful when there is no signal connected to the sample trigger (middle) inlet. The size of the list can not be larger than the buffer size (maxsize attribute), and the new output size is set to the number of items in the list.

signal

A signal in the left inlet is sampled, triggered by the value of the signal in the middle inlet. The signal connected to the right inlet triggers sash~ to advance to the next output sample from the memory buffer. This happens when sample exceeds the the advancelevel when the mode is set to Advance. When the mode is set to Index, the output sample changes when the integer value of the input changes. When the mode is set to Subdivision, the output sample changes when the input value, divided by the current size, reaches the next divisor.

See Also

Name Description
gate~ Route a signal to one of several outlets
phasor~ Generate sawtooth signals
sah~ Sample and hold a signal
subdiv~ Integer Subdivision of a Phasor
thresh~ Detect signal above a set level