[Csnd] how to enter rests in csound scores

Dear community,
I would like to know how to enter rests in Csound as conveniently as possible.
I normally use the python programming language for my purposes, for example:

durs = [1, 1, 0.5, 0.5, 3],split()

To get the start times for the events I use a function created by myself:
start = 0
beats = addtimes(durs,start)
The result will be:
[0, 1.0, 2.0, 2.5, 3.0, 6.0]

But how could I handle rests? What if the durations looked like this:
durs =[1,1,0.5,3]
But the Beats should be:
[0,1,2.5,3.0,6.0]
How do you deal with such difficulties?

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 Stefan,
without a better understanding of your code (ex. are you using a schedule/event to trigger notes/samples? ) then one solution might be to use gating or perhaps a “ghost note” (amplitude of 0) as a placeholder for the rest.

For example, if you have:
durs = [0, 1.0, 2.0, 2.5, 3.0, 6.0, 7.0]
amps = [1, 1, 1, 1, 1, 0]
then 7.0 would be a silent/ghost note which would serve as a rest. Gating would offer the benefit of controlling not only the start time of each note but also the duration, which would also allow rests, but would be slightly more involved.

Best,
Scott