Generate control signal consisting of held segments delimited by two or more specified points. The entire envelope is looped at kfreq rate. Each parameter can be varied at k-rate.
ksig lpshold kfreq, ktrig, ktime0, kvalue0 [, ktime1] [, kvalue1] [, ktime2] [, kvalue2] [...]
ksig -- Output signal
kfreq -- Repeat rate in Hz or fraction of Hz
ktrig -- If non-zero, retriggers the envelope from start (see trigger opcode), before the envelope cycle is completed.
ktime0...ktimeN -- Times of points; expressed in fraction of a cycle
kvalue0...kvalueN -- Values of points
lpshold is similar to loopseg, but can generate only horizontal segments, i.e. holds values for each time interval placed between ktimeN and ktimeN+1. It can be useful, among other things, for melodic control, like old analog sequencers.
Here is an example of the lpshold opcode. It uses the files lpshold.orc and lpshold.sco.
Example 15-1. Example of the lpshold opcode.
/* lpshold.orc */
; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1
; Instrument #1
instr 1
kfreq line 1, p3, 20
klp lpshold kfreq, 0, 0, 0, p3*0.25, 20000, p3*0.75, 0
a1 oscil klp, 440, 1
out a1
endin
/* lpshold.orc */
/* lpshold.sco */
; Table #1, a sine wave.
f 1 0 16384 10 1
; Play Instrument #1 for five seconds.
i 1 0 5
e
/* lpshold.sco */