Csound Csound-dev Csound-tekno Search About

Re: Question: Envelopes

Date1997-03-14 23:49
FromRussell Pinkston
SubjectRe: Question: Envelopes
Tolve,

Sorry, but I just realized I left the reinit target out of my first suggestion:

>Use this:
>
>instr	1
>idur    =       p3/2
>start:  timout  0,idur,continue
>        reinit
>continue:
>k1	linen 	20000,5,idur,5
>        rireturn
>asig	oscil	k1,cpspch(p5),p4
>out	asig
>endin
>

The reinit statement following the timout should read as follows, of course:

        reinit  start

Now, as to your goal of...

>trying to find most intuitive (hah) method of working with long, complex
>envelopes consisting of, if you will excuse my french, untold stages of
>attack, decay, sustain, and, eventually, release, in unlimited
>combinations, and with unlimited numbers of different values that i assign,
>one at a time.  

...I think the key word (and problem) is "unlimited." As someone else has
pointed out, expseg and linseg are the csound envelope units with the
greatest number of possible stages. (The practical limit may not be a
specific number of arguments, but the number of characters you can fit on
the line, I think. Max may be 255, or something.) If you really want
unlimited numbers of stages, however, I think you're going to have to go
with some form of table look up and reinitialization. In other words, use
gen 2 to fill as large a table as you need with your envelope segment data,
in the format val1 dur1 val2 dur2 val3 dur3 val4 dur4...etc.

ival2   table   0,ienvtable             ;init ival2 to start pt
index   =       1                       ;init index to 1st dur
getnewargs:
ival1   =       ival2                   ;new val1 is old val2
idur    table   index,ienvtable         ;get next duration
ival2   table   index+1,ienvtable       ;get new value2
index   =       index+2                 ;update for next read
kgate   linseg  ival1,idur,ival2        ;or use expseg
        timout  0,idur,continue         ;wait idur seconds
        reinit  getnewargs              ;then reinit
continue:
        rireturn

Hope this helps (and works this time).

Regards,

Russell




----------------------------------
Russell F. Pinkston, D.M.A.
Associate Professor of Composition
Director, Electronic Music Studios
School of Music
The University of Texas at Austin
Austin, TX 78712

[512-471-0865]