[Csnd] (conditionally" looping/repeating envelopes

Hey hey,
I try to build an envelope, which can loop/repeat, either indefinitely or a given number of times. Durations of the envelope stages may be modulated, just like the levels or values at the end of each stage.

I'm currently using trigphasor to achieve that, but I can't get a good setup to switch stages exactly, when the phasor has reached the kEnd value of its current cycle. I also tried checking for times, but with times possibly modulated, I'm not sure how that would work out anyway.

The envelope appears to overshoot sometimes. Say with normal oneshot envelope behaviour, the envelope will rise, then fall, but push back up for a moment, before resting at zero.

Any ideas? did anyone try something similar? Did I overlook an obvious opcode? I did see the loop*seg* opcodes, but they don't seem to fit the bill. How to know at which stage they are? Especially in a multi stage setup?

Any advice is welcome.

Best wishes,

Jeanette

hi -
my first thought is a function table consisting the envelope, and then reading / repeating it at different speed etc.
but probably this is not what you look for?
  joachim

Loopseg https://csound.com/manual/loopseg.html is quite flexible. Would that serve you?

Tarmo

T, 14. mai 2024 20:40 Jeanette C. <julien@mail.upb.de> kirjutas:

Hey hey,
I try to build an envelope, which can loop/repeat, either indefinitely or a
given number of times. Durations of the envelope stages may be modulated, just
like the levels or values at the end of each stage.

I’m currently using trigphasor to achieve that, but I can’t get a good setup
to switch stages exactly, when the phasor has reached the kEnd value of its
current cycle. I also tried checking for times, but with times possibly
modulated, I’m not sure how that would work out anyway.

The envelope appears to overshoot sometimes. Say with normal oneshot envelope
behaviour, the envelope will rise, then fall, but push back up for a moment,
before resting at zero.

Any ideas? did anyone try something similar? Did I overlook an obvious opcode?
I did see the loopseg opcodes, but they don’t seem to fit the bill. How to
know at which stage they are? Especially in a multi stage setup?

Any advice is welcome.

Best wishes,

Jeanette

Do you even know what I like
Just what I’m living for,
What I adore <3
(Britney Spears)

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Hi Joachim and Tarmo,
thanks for the feedback. I think both loopseg and tables won't solve the problem. As I mentioned about loopseg: if you only loop parts of the envelope or want to loop the envelope a certain, fixed number of times, it ges complicated. Especially if the duration of the segments may change.

A similar thing, I think, applies to tables. One could potentially create a good table and use it for one specific envelope shape and modulate all times and all levels in tandem. And each new basic shape would require a new table. So if the relationship between the segment lengths changes.

Loopseg can do most of that.

I think I got a few things with trigphasor under control. There are time limits, which have to be observed very strictly. A segment shorter than one k-cycle cause the whole structure to fall apart... Perhaps a solution can be found after all. It's just more complex than I initially assumed. :slight_smile:

Best wishes and many thanks,

Jeanette

maybe linenv is nearer to what you are looking for?

https://csound-plugins.github.io/csound-plugins/opcodes/linenv.html