Csound Csound-dev Csound-tekno Search About

Re: Question: Envelopes

Date1997-03-13 04:31
FromRussell Pinkston
SubjectRe: Question: Envelopes
>ok the following principal works fine for creating additional (*unlimited*)
stages of envelopes with linen on ppc:
>
>sr=48000
>kr=4800
>ksmps=10
>nchnls=1
>
>instr	1
>k1	  linen 	20000,5,p3,5
>asig	oscil	k1,cpspch(p5),p4
>out	asig
>endin
>
>f1  0  8192  10  1
>i1  0  10  1  6
>i1 10  10 1 6
>e
>
>But isn't there a way I can accomplish the same within orc file. something
like:
>instr	1
>k1	  linen 	20000,5,p3,5   linen  20000,5,p3,5
>asig	oscil	k1,cpspch(p5),p4
>out	asig
>endin
>
>f1  0  8192  10  1
>i1  0  20  1  6
>e
>
>Except of course, a way that works?
>
>
>Incidentally, many thanks to the gentleman that steered me to the soundhack
list. Did subscribe but inadvertantly dumped your address before thank you.
>
>
>yours,
>
>tolve
>
>
>

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

f1  0  8192  10  1
i1  0  20  1  6
e

----------------------------------
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]

Date1997-03-14 03:42
Fromtolve
SubjectRe: Question: Envelopes
hello r.

thanks for your response. sorry but these questions do have a way of
multiplying themselves.

cool suggestion. first, what i really wanted to ask, but didn't clearly:

am 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. certainly not too much of a non-programmer to ask of csound
now is it? nope this is not a DW8000 and i'm not in Kansas. any more.

although, this goal can evidently be achieved by creating numerous
instruments, and commanding each to begin where the previous one left off,
with perhaps a few ties thrown in, i seek a method of giving birth to this
huge undulating desert worm with a single instrument. now that's intuitive.
for my purposes anyway.

any assistance will be greatly appreciated.

oh, and now for that other question you answered. i get this:

error: insufficient required arguments, line 9:
       reinit
1 syntax er

what to do?

yours,

tolve
Creative Dir: Audio
TAOHaus: theater artists' omnibus
Bowling Green Station
PO Box 1062
New York, NY  10274-1062


>>ok the following principal works fine for creating additional (*unlimited*)
>stages of envelopes with linen on ppc:
>>
>>sr=48000
>>kr=4800
>>ksmps=10
>>nchnls=1
>>
>>instr	1
>>k1	  linen 	20000,5,p3,5
>>asig	oscil	k1,cpspch(p5),p4
>>out	asig
>>endin
>>
>>f1  0  8192  10  1
>>i1  0  10  1  6
>>i1 10  10 1 6
>>e
>>
>>But isn't there a way I can accomplish the same within orc file. something
>like:
>>instr	1
>>k1	  linen 	20000,5,p3,5   linen  20000,5,p3,5
>>asig	oscil	k1,cpspch(p5),p4
>>out	asig
>>endin
>>
>>f1  0  8192  10  1
>>i1  0  20  1  6
>>e
>>
>>Except of course, a way that works?
>>
>>
>>Incidentally, many thanks to the gentleman that steered me to the soundhack
>list. Did subscribe but inadvertantly dumped your address before thank you.
>>
>>
>>yours,
>>
>>tolve
>>
>>
>>
>
>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
>
>f1  0  8192  10  1
>i1  0  20  1  6
>e
>
>----------------------------------
>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]



Date1997-03-14 04:25
FromEli Brandt
SubjectRe: Question: Envelopes
tolve wrote:
> am 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, 

Okay, this sounds like linseg or expseg.  Csound doesn't have the
notion of "sustain" because it has known note lengths rather than a
keyboard-gate signal.  For linear ADSR, for example, you can do:

kenv    linseg  0, iatk, 1, idcy, isus, idur-(iatk+idcy+irel), isus, irel, 0

(Please forgive possible syntax errors; my Csound is rusty.)

> and with unlimited numbers of different values that i assign,
> one at a time.

But now I'm not so sure that I know what you want.  What do you
mean by "one at a time"?

> nope this is not a DW8000 and i'm not in Kansas. any more.

One possible gotcha: Csound's exponential envelopes are not (except
when approaching zero) what the synth world calls "exponential envelopes".

-- 
   Eli Brandt
   eli+@cs.cmu.edu

Date1997-03-14 16:25
Fromjpff@maths.bath.ac.uk
SubjectRe: Question: Envelopes
Thd manual says that reinit takes a label as an argument which is the
label which starts the special initialisation pass.  This code is
terminated by rireturn or and endin

Also rgoto is a ju,mp only at reinitialisation time.

==John ff



Received: from stork2.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa18765;
          14 Mar 97 16:59 GMT
Received: from goggins.bath.ac.uk by stork.maths.Bath.AC.UK id aa14703;
          14 Mar 97 16:58 GMT
Received: from hermes.ex.ac.uk by goggins.bath.ac.uk with SMTP (PP);
          Fri, 14 Mar 1997 16:58:36 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (QAA27255);
          Fri, 14 Mar 1997 16:52:36 GMT
Received: from hermes.ex.ac.uk by noether.maths.exeter.ac.uk;
          Fri, 14 Mar 97 16:52:26 GMT
Received: from ella.mills.edu [144.91.3.20] by hermes via ESMTP (QAA27239);
          Fri, 14 Mar 1997 16:52:22 GMT
Received: from localhost by ella.mills.edu 
          via SMTP (940816.SGI.8.6.9/930416.SGI)	 id IAA13656;
          Fri, 14 Mar 1997 08:51:02 -0800
Date: Fri, 14 Mar 1997 08:51:02 -0800 (PST)
From: Mike Berry 
To: tolve 
Cc: csound list 
Subject: Re: Question: Envelopes
In-Reply-To: 
Message-Id: 
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

	This may seem a little ugly, but you could put in a linseg command
with, say, 20 segments (or however many you needed maximum).  Then read
the coeficients out of tables.  That way each note simply chooses which
env shape by a single p field.  You still have to predetermine all of the
envelopes you would need, but you could add them just to the score, not by
duplicating the instr.  Simply use 0's for the coef's at the end that you
didn't need for that particular shape.

Mike Berry
mikeb@mills.edu
http://www.mills.edu/PEOPLE/gr.pages/mikeb.public.html/mikeb.homepage.html




Received: from stork2.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa18816;
          14 Mar 97 17:03 GMT
Received: from goggins.bath.ac.uk by stork.maths.Bath.AC.UK id aa14867;
          14 Mar 97 17:03 GMT
Received: from hermes.ex.ac.uk by goggins.bath.ac.uk with SMTP (PP);
          Fri, 14 Mar 1997 17:03:17 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (QAA27638);
          Fri, 14 Mar 1997 16:56:12 GMT
Received: from hermes.ex.ac.uk by noether.maths.exeter.ac.uk;
          Fri, 14 Mar 97 16:56:03 GMT
Received: from maila.surrey.ac.uk [131.227.102.8] by hermes 
          via SMTP (QAA27623); Fri, 14 Mar 1997 16:56:02 GMT
Received: from psy.surrey.ac.uk (actually host psy1.psy.surrey.ac.uk)           
          by maila.surrey.ac.uk with SMTP (PP) with ESMTP;
          Fri, 14 Mar 1997 16:55:07 +0000
Received: from PSY1/MAIL_QUEUE by psy.surrey.ac.uk (Mercury 1.21);
          14 Mar 97 16:56:42 GMT0BST
Received: from MAIL_QUEUE by PSY1 (Mercury 1.30); 14 Mar 97 16:54:58 GMT0BST
From: Peter Kearton 
Organization:  Psychology Dept, Surrey Univ. U.K.
To: csound@maths.ex.ac.uk
Date:          Fri, 14 Mar 1997 16:54:37 GMT
Subject:       RE envelope code and reinit
Priority: normal
X-Mailer: Pegasus Mail v3.31
Message-Id: 
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

Hi,
    I tried the code too. What is needed is  the parameter 'start' 
after the 'reinit' to jump to the 'start:' labelled point in the code,

                Pete Kearton



Received: from stork2.maths.bath.ac.uk by omphalos.maths.Bath.AC.UK id aa19949;
          14 Mar 97 23:55 GMT
Received: from goggins.bath.ac.uk by stork.maths.Bath.AC.UK id aa23318;
          14 Mar 97 23:54 GMT
Received: from hermes.ex.ac.uk by goggins.bath.ac.uk with SMTP (PP);
          Fri, 14 Mar 1997 23:54:45 +0000
Received: from noether [144.173.8.10] by hermes via SMTP (XAA16848);
          Fri, 14 Mar 1997 23:50:42 GMT
Received: from hermes.ex.ac.uk by noether.maths.exeter.ac.uk;
          Fri, 14 Mar 97 23:50:35 GMT
Received: from smtp.utexas.edu [128.83.126.2] by hermes via SMTP (XAA16835);
          Fri, 14 Mar 1997 23:50:33 GMT
Received: (qmail-queue invoked by uid 0); 14 Mar 1997 23:49:20 -0000
Received: from unknown (HELO mail.utexas.edu) (128.83.126.1)  
          by smtp.utexas.edu with SMTP; 14 Mar 1997 23:49:20 -0000
Received: from slip-84-3.ots.utexas.edu (slip-84-3.ots.utexas.edu [128.83.219.67]) 
          by mail.utexas.edu with SMTP id RAA12967;
          Fri, 14 Mar 1997 17:49:19 -0600 (CST)
Date: Fri, 14 Mar 1997 17:49:19 -0600 (CST)
Message-Id: <199703142349.RAA12967@mail.utexas.edu>
X-Sender: r.pinkston@mail.utexas.edu
X-Mailer: Windows Eudora Version 1.4.4
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
To: tolve 
From: Russell Pinkston 
Subject: Re: Question: Envelopes
Cc: csound@maths.ex.ac.uk
Sender: owner-csound-outgoing@maths.ex.ac.uk
Precedence: bulk

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]


Date1997-03-14 16:51
FromMike Berry
SubjectRe: Question: Envelopes
	This may seem a little ugly, but you could put in a linseg command
with, say, 20 segments (or however many you needed maximum).  Then read
the coeficients out of tables.  That way each note simply chooses which
env shape by a single p field.  You still have to predetermine all of the
envelopes you would need, but you could add them just to the score, not by
duplicating the instr.  Simply use 0's for the coef's at the end that you
didn't need for that particular shape.

Mike Berry
mikeb@mills.edu
http://www.mills.edu/PEOPLE/gr.pages/mikeb.public.html/mikeb.homepage.html