[Csnd] Modeling an Analog Envelope
| Date | 2010-11-10 05:11 |
| From | Jim Aikin |
| Subject | [Csnd] Modeling an Analog Envelope |
The other night I started musing about how one might model an analog modular synth in Csound. In trying to model an envelope generator, I find myself puzzled. I'm sure there must be an easy way to do it, using reinit or something.... The desiderata: 1) The "envelope generator module" is an instrument unto itself. It sends its output via a global k-rate variable. 2) This instrument is "always on" while the score is playing. It doesn't start and stop in response to i statements. 3) The envelope starts each time a global trigger signal goes from 0 to 1. (Maybe later it will be gated rather than triggered. That's a refinement I'm not yet ready to tackle.) If a new trigger is received before it finishes moving through its segments, it starts over from the beginning. 4) The envelope does not loop. It cycles through once, reaches its end value, and stays at the end value unless and until a new trigger is received. The thing is, the only envelope generator I've been able to find in Csound that accepts a trigger input is looptseg ... and I don't want a looping envelope. I've tried using reinit, but I can't figure out how to make a reinit pass restart a linseg again from the beginning of its defined contour. Am I approaching it all wrong? How would the experts do this? Thanks in advance! --Jim Aikin |
| Date | 2010-11-10 08:37 |
| From | Victor.Lazzarini@nuim.ie |
| Subject | [Csnd] Re: Modeling an Analog Envelope |
| Attachments | None None |
| Date | 2010-11-10 14:53 |
| From | Joel Ross |
| Subject | [Csnd] Re: Re: Modeling an Analog Envelope |
| Attachments | trigphasor2.csd |
Something I've wanted for a long time is an envelope that has the ability to retrigger, usually I've wanted it for reading soundfile data from an ftable. The best solution I've found involves using syncphasor, and holding the phase at zero with the sync inlet, its not at all elegant, but it works. Heres a csd where I use this for envelope generation, see the 'trigphasor' udo. This only creates the phase, I use a table look up to make it an envelope. Regards, Joel On 10 November 2010 09:37, |
| Date | 2010-11-10 16:07 |
| From | Jim Aikin |
| Subject | [Csnd] Re: Modeling an Analog Envelope |
The solution I found is not entirely elegant, but it works. I created an always-on "envelope generator generator" instrument, which contains very little other than an event opcode. When the trigger signal goes to 1, the generator generator shuts off any existing instances of the envelope generator instrument and starts a new one. Each envelope generator gets its level 0 value from the current output level (which is a global variable), so there shouldn't be any discontinuities in the output. It seems to me that a whole set of retriggering contour generators (linsegre, linsegrer, etc.) would be a nice addition to Csound. I'm not competent to create these myself, or I'd give it a try. The challenge, perhaps, would be to define the behavior that the contour exhibits when a new trigger is received. Does it jump back to level 0, thus introducing a discontinuity in the output? That seems undesirable in many cases, but sometimes it may be what one would want, so a mode parameter would be needed. --JA |
| Date | 2010-11-10 16:43 |
| From | Victor Lazzarini |
| Subject | [Csnd] Re: Re: Modeling an Analog Envelope |
My design for an ADSD would be this:
opcode ADSD,k,iiiik
imax,iatt,idec,isus,ktrig xin
ktime init 0
kv init 0
iper = 1/kr
if (ktrig == 1) then
ktime = ktime + iper
if ktime < iatt then
kt = iatt
kv = imax
else
kt = idec
kv = isus
endif
else
kv = 0
ktime = 0
endif
kenv portk kv, kt
xout kenv
endop
For example, to demonstrate that this works, run this instrument for >
6 seconds.
instr 1
ktrig init 1
kti timeinsts
if kti < 2 then
ktrig = 1
elseif kti < 4 then
ktrig = 0
elseif kti < 6 then
ktrig = 1
else
ktrig = 0
endif
k1 ADSD 1,0.01,0.1,0.8, ktrig
a1 vco2 k1, 440
out a1
endin
When ktrig is high, the envelope runs from Attack-Decay and holds sus,
when ktrig is low it goes to zero in Decay seconds and stays there.
Regards
Victor
On 10 Nov 2010, at 16:07, Jim Aikin wrote:
>
> The solution I found is not entirely elegant, but it works. I
> created an
> always-on "envelope generator generator" instrument, which contains
> very
> little other than an event opcode. When the trigger signal goes to
> 1, the
> generator generator shuts off any existing instances of the envelope
> generator instrument and starts a new one. Each envelope generator
> gets its
> level 0 value from the current output level (which is a global
> variable), so
> there shouldn't be any discontinuities in the output.
>
> It seems to me that a whole set of retriggering contour generators
> (linsegre, linsegrer, etc.) would be a nice addition to Csound. I'm
> not
> competent to create these myself, or I'd give it a try. The challenge,
> perhaps, would be to define the behavior that the contour exhibits
> when a
> new trigger is received. Does it jump back to level 0, thus
> introducing a
> discontinuity in the output? That seems undesirable in many cases, but
> sometimes it may be what one would want, so a mode parameter would be
> needed.
>
> --JA
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Modeling-an-Analog-Envelope-tp3258152p3258924.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-10 20:18 |
| From | Louis Cohen |
| Subject | [Csnd] Modeling an Analog Envelope |
Jim,
I don't see what's not elegant about your solution.
On a related subject, you may be aware that if you use turnoff2 to
shut down instruments, it's wise for the instrument that issues the
turnoff2 opcode to have a higher number than the instruments it's
turning off. I don't know if this applies to using turnoff.
best,
Lou Cohen
On Nov 10, 2010, at 11:07 AM, Jim Aikin wrote:
>
> The solution I found is not entirely elegant, but it works. I
> created an
> always-on "envelope generator generator" instrument, which contains
> very
> little other than an event opcode. When the trigger signal goes to
> 1, the
> generator generator shuts off any existing instances of the envelope
> generator instrument and starts a new one. Each envelope generator
> gets its
> level 0 value from the current output level (which is a global
> variable), so
> there shouldn't be any discontinuities in the output.
>
> It seems to me that a whole set of retriggering contour generators
> (linsegre, linsegrer, etc.) would be a nice addition to Csound. I'm
> not
> competent to create these myself, or I'd give it a try. The challenge,
> perhaps, would be to define the behavior that the contour exhibits
> when a
> new trigger is received. Does it jump back to level 0, thus
> introducing a
> discontinuity in the output? That seems undesirable in many cases, but
> sometimes it may be what one would want, so a mode parameter would be
> needed.
>
> --JA
>
> --
> View this message in context: http://csound.1045644.n5.nabble.com/Modeling-an-Analog-Envelope-tp3258152p3258924.html
> Sent from the Csound - General mailing list archive at Nabble.com.
>
>
> Send bugs reports to the Sourceforge bug tracker
> https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body
> "unsubscribe csound"
>
Send bugs reports to the Sourceforge bug tracker
https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|
| Date | 2010-11-10 22:12 |
| From | joachim heintz |
| Subject | [Csnd] Re: Modeling an Analog Envelope |
this works for me. in my case, the trigger is a button widget in qutecsound. best regards - joachim |