GEN25

GEN25 — Construct functions from segments of exponential curves in breakpoint fashion.

Description

These subroutines are used to construct functions from segments of exponential curves in breakpoint fashion.

Syntax

f # time size 25 x1 y1 x2 y2 x3  ...

Initialization

size -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see f statement).

x1, x2, x3, etc. -- locations in table at which to attain the following y value. Must be in increasing order. If the last value is less than size, then the rest will be set to zero. Should not be negative but can be zero.

y1, y2, y3,, etc. -- Breakpoint values attained at the location specified by the preceding x value. These must be non-zero and must be alike in sign.

[Note] Note

If p4 is positive, functions are post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.

Examples

Here is an example of the GEN25 generator. It uses the file gen25.csd.

Example 1314. Example of the GEN25 generator.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac  ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o gen25.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

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

gisin ftgen 1, 0, 32768, 10, 1
gienv ftgen 2, 0, 1025, 25, 0, 0.01, 200, 1, 400, 1, 513, 0.01	; y value must be >= 0
   
  
instr 1

kcps init 3/p3			;play 3x over duration of note
kndx phasor kcps
ixmode = 1			;normalize to 0-1
kval table kndx, gienv, ixmode
kval =kval*100			;scale up to 0-100
asig poscil 1, 220+kval, gisin	;use table for amplitude
     outs asig, asig
  
endin
</CsInstruments>
<CsScore>

i 1 0 4

e
</CsScore>
</CsoundSynthesizer>


This is the diagram of the waveform of the GEN25 routine, as used in the example:

f 2 0 1025 25 0 0.01 200 1 400 1 513 0.01 - a function which begins at 0.01, rises to 1 at the 200th table location, makes a straight line to the 400th location, and returns to 0.01 by the end of the table

f 2 0 1025 25 0 0.01 200 1 400 1 513 0.01 - a function which begins at 0.01, rises to 1 at the 200th table location, makes a straight line to the 400th location, and returns to 0.01 by the end of the table

See Also

f statement, GEN27

Credits

Author: John ffitch
University of Bath/Codemist Ltd.
Bath, UK

New in Csound version 3.49