# Gentable : how to set a fixed Y value?

**URL:** <https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874>\
**Category:** Csound Noobs\
**Created:** [1 January 2018 16:06 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874 "2018-01-01T16:06:01Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [1 January 2018 16:06 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/1 "2018-01-01T16:06:01Z")

</div>

Hello,  
Is there a way to fix the values for x and y maximum of the gentable widget ?  
i.e . : x from 0 to 200 and Y from 0 to 1 with no re-scaling of the values when the value of the table are changed.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [1 January 2018 17:12 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/2 "2018-01-01T17:12:53Z")

</div>

I am not sure I follow? Are you taking about what values are displayed, or the values stored in the actual function table?

[edit] `amprange()` any use to you?

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [1 January 2018 20:01 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/3 "2018-01-01T20:01:08Z")

</div>

It is about the displayed values. I think amprange() is the answer but I don’t understand very well how it works.

In short, I am still dealing with envelopes.  
I wish to use the gentable widget to create envelope like @iainmccurdy has done in the gen08 example, but this example requires quite a little effort to understand 🙂 also, this type of envelope is not midi compatible in that way that the durations are fixed.

I am dreaming of a widget which would allow to graphically design an enveloppe using the opcode\_r family (linsegr, transegr,) , provided that the last segment would always be the release one.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 12:38 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/4 "2018-01-02T12:38:47Z")

</div>

Hmm, Iain’s gen08Envelope example is not working for me here. Is it loading Ok for you? I’m getting invalid ftable messages.

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [2 January 2018 12:41 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/5 "2018-01-02T12:41:57Z")

</div>

So do I but the envelopes work anyway. Maybe this is only at init time.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 12:48 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/6 "2018-01-02T12:48:36Z")

</div>

Good to know. Looks like my dev build here has broken something 😒 Let me fix this first and then I’ll try to prepare a simple ADSR env widget for you.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 12:49 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/7 "2018-01-02T12:49:17Z")

</div>

Btw, are you using the latest Windows version from a few days ago?

[edit] if not would you mind trying?

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [2 January 2018 12:53 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/8 "2018-01-02T12:53:12Z")

</div>

I use 2.0.28a version from Xmas : `CabbageCanonicalSetup_Sat_Dec_23_16-59-29_2017.exe`  
Is there a newer version ?

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 12:56 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/9 "2018-01-02T12:56:32Z")

</div>

There have been many 😂 I just checked the latest and it seems to work fine for me, even with the invalid ftable errors. Must be my local build. Phew!

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [2 January 2018 12:57 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/10 "2018-01-02T12:57:04Z")

</div>

I use 2.0.28a version from Xmas : `CabbageCanonicalSetup_Sat_Dec_23_16-59-29_2017.exe`\>.

Just downloaded and installing version of 30 december.

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [2 January 2018 12:59 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/11 "2018-01-02T12:59:45Z")

</div>

At least , the PM synth I just posted is working very well with it.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 13:05 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/12 "2018-01-02T13:05:49Z")

</div>

Don’t worry the later ones should be fine too. I was using a slightly older version of Csound on Linux here which was causing the problems. updating fixed it. I will look at preparing a simple env generator for you later on today. I have to leave things for now. A+

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 16:50 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/13 "2018-01-02T16:50:45Z")

</div>

So I guess what you would like is something like [this](https://joshondesign.com/p/demos/sound/adsrviz/?a=0.142&al=0.807&d=0.161&s=0.351&sl=0.451&r=0.345&instrument=pure&tempo=500). Hmm. How best to implement this is the question. A bit of a challenge to Cabbagers everywhere 😉 I’ll see what I can come up with.

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [2 January 2018 16:59 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/14 "2018-01-02T16:59:46Z")

</div>

Yes, not far from that.It seems to be quite a challenge.  
Somehow, if you try the last synth I posted today, you can have a look at osc2 to 5. There are parameters for envelop using `transegr` opcode.  
Envelope is made of a delay, an attack duration, a maximum peak to reach, a decrease duration, à sustain level and a release segment. Of course, the shapeof the curves are fixed for now.

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 17:39 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/15 "2018-01-02T17:39:21Z")

</div>

It’s very easy if you can use sliders to control segments, but modifying the ADSR with handles seems to be a bit tricky. I tried Iain’s approach of using label and check for mouse positions. It seems a little shaky. Must be a better way. Just use a GEN07 with a gentable is fine, but you can’t guarantee a horizontal sustain level. I’m sure Iain has an eloquent solution for this!

---

<div class="post-metadata">

**Author:** ![rorywalsh](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/rorywalsh/32/165_2.png) [@rorywalsh](https://forum.cabbageaudio.com/u/rorywalsh)\
**Post date:** [2 January 2018 20:10 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/16 "2018-01-02T20:10:14Z")

</div>

The more I worked on this the more I think I followed more or less the same path as Iain did in his example! I will take it as a compliment to my Csound skills 😉 I will now go and see what I can learn from how Iain did it. All I know at the moment is he also uses mouse events too.

[DynamicEnveloper.csd](https://forum.cabbageaudio.com/uploads/default/original/1X/2ec674de0c811f1a6691ee66e20d841731642869.csd) (4.2 KB)

![](https://forum.cabbageaudio.com/uploads/default/original/1X/9044a54e373e47ae9fd80f1e65d7508e659f8819.gif)

---

<div class="post-metadata">

**Author:** ![Karamel1](https://forum.cabbageaudio.com/user_avatar/forum.cabbageaudio.com/karamel1/32/1680_2.png) [@Karamel1](https://forum.cabbageaudio.com/u/Karamel1)\
**Post date:** [3 January 2018 15:30 UTC](https://forum.cabbageaudio.com/t/gentable-how-to-set-a-fixed-y-value/874/17 "2018-01-03T15:30:29Z")

</div>

Thank you a lot @rorywalsh ! I’ll try to develop something based on your code.
