Skip to content

lpsholdp

Control signals based on held segments.

The segments are delimited by two or more specified points. The entire envelope can be looped at time-variant rate. Each segment coordinate can also be varied at k-rate.

Syntax

ksig lpsholdp  kphase, kvalue0, ktime0  [, kvalue1] [, ktime1] \
               [, kvalue2] [, ktime2] [...]

Performance

ksig - output signal

kphase -- point of the sequence read, expressed as a fraction of a cycle (0 to 1)

kvalue0...kvalueN -- Values of points

ktime0...ktimeN -- Times between points; expressed in fractions of a cycle (see below). The final time designates a ramp between the final value and the first value.

lpsholdp opcode is similar to lpshold; the only difference is that, instead of frequency, a time-variant phase is required. If you use a phasor to get the phase value, you will have a behaviour identical to lpshold, but interesting results can be achieved when using phases having non-linear motions, making lpsholdp more powerful and general than lpshold.

Examples

Here is an example of the lpsholdp opcode. It uses the file lpsholdp.csd.

Example of the lpsholdp opcode.
<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
; For Non-realtime ouput leave only the line below:
; -o lpsholdp.wav -W ;;; for file output any platform

; by Stefano Cucchi 2020

</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1


instr 1

kphase1 phasor 3

kmodulation oscil 0.5, 0.01, 2
kphase2 phasor 3+kmodulation

kamp    linseg 0, 0.2, 1, p3-0.4, 1, 0.2, 0
kfreq1  lpsholdp kphase1, cpspch(p4), 6, cpspch(p5), 10, cpspch(p6), 12
kfreq2  lpsholdp kphase2, cpspch(p4), 6, cpspch(p5), 10, cpspch(p6), 12

a1 = poscil(kamp, kfreq1, 1)
a2 = poscil(kamp, kfreq2, 1)

outch 1, a1
outch 2, a2
endin

</CsInstruments> 
<CsScore>

f1 0 8192 10 1 0 1 0 1 0 1 0 1 0 1
f2 0 4096 10 1 0 1 1 1

i1 0 10 6.09 6.02 7.03

e

</CsScore>
</CsoundSynthesizer>

See also

Linear and Exponential Generators

Credits

Written by Gabriel Maldonado.

New in Csound 5 (Previously available only on CsoundAV)