loopsegp

loopsegp — Control signals based on linear segments.

Description

Generate control signal consisiting of linear segments 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 loopsegp  kphase, kvalue0, kdur0, kvalue1 \
      [, kdur1, ... , kdurN-1, kvalueN]

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

kdur0 ...kdurN-1 - duration of points expessed in fraction of a cycle

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

Examples

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

Example 235. Example of the loopsegp opcode.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o loopsegp.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>
sr=44100
ksmps=1
nchnls=2

; By Mark Van Peteghem 2008

   instr 1
iphase  = p4

kenv      linen 1, 0.1, p3, 0.1
kph_amp   phasor 2, 0
kamp      loopsegp kph_amp, 60, 1, 30, 1, 60
kamp    = ampdb(kamp)*kenv

kph_freq  phasor 2, iphase
klow_freq line 200, p3, 100
kfreq     loopsegp kph_freq, 400, 1, klow_freq, 1, 400

asig      vco2 kamp, kfreq, 2, 0.5

         outs asig, asig

   endin

</CsInstruments>
<CsScore>
i1 0 3 0
i1 + . 0.50
</CsScore>
</CsoundSynthesizer>


Credits

Written by Gabriel Maldonado.

New in Csound 5. (Previously available only on CsoundAV)