samphold

samphold — Performs a sample-and-hold operation on its input.

Description

Performs a sample-and-hold operation on its input.

Syntax

ares samphold asig, agate [, ival] [, ivstor]
kres samphold ksig, kgate [, ival] [, ivstor]

Initialization

ival, ivstor (optional) -- controls initial disposition of internal save space. If ivstor is zero the internal “hold” value is set to ival ; else it retains its previous value. Defaults are 0,0 (i.e. init to zero)

Performance

kgate, xgate -- controls whether to hold the signal.

samphold performs a sample-and-hold operation on its input according to the value of gate. If gate !- 0, the input samples are passed to the output; If gate = 0, the last output value is repeated. The controlling gate can be a constant, a control signal, or an audio signal.

Examples

asrc  buzz      10000,440,20, 1     ; band-limited pulse train
adif  diff      asrc                ; emphasize the highs
anew  balance   adif, asrc          ;   but retain the power
agate reson     asrc,0,440          ; use a lowpass of the original
asamp samphold  anew, agate         ;   to gate the new audiosig
aout  tone      asamp,100           ; smooth out the rough edges
        

See Also

diff, downsamp, integ, interp, upsamp