[Csnd] negative p3 and its documentation

hi all -

after some surprises in using a negative p3 in the score i think this is important to understand:
1. only one instance of such an instrument can be active (because this feature was designed for quasi legato).
2. if only a negative duration is present in the score, csound will terminate immediately:
a) the score
  i 1 0 -1 400
will terminate immediately.
b) the score
  i 1 0 -1 400
  i 1 3 -1 500
will terminate after three seconds.
(only adding something like "e 60" replaces the first instance of instrument 1 by the second.)

i think this is consistent, but also surprising.
i had a look in the reference manual, but found no documentation.
is it somehow hidden, or should we add it?

cheers -
  joachim

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

Hi,

Nice observations. Actually, it looks like I expect it to behave. Do note that you can initiate several instances with infinite duration if you use fractional instr numbers.
i 1.1 0 -1 400

i 1.2 0 -1 400


I think the termination on the last infinite event also makes sense, since the score then contains no more information.

As you suggest, it might be good to check if the manual documents the behaviour clearly enough.

all best
Øyvind

tir. 13. feb. 2024 kl. 10:52 skrev joachim heintz <jh@joachimheintz.de>:

hi all -

after some surprises in using a negative p3 in the score i think this is
important to understand:

  1. only one instance of such an instrument can be active (because this
    feature was designed for quasi legato).
  2. if only a negative duration is present in the score, csound will
    terminate immediately:
    a) the score
    i 1 0 -1 400
    will terminate immediately.
    b) the score
    i 1 0 -1 400
    i 1 3 -1 500
    will terminate after three seconds.
    (only adding something like “e 60” replaces the first instance of
    instrument 1 by the second.)

i think this is consistent, but also surprising.
i had a look in the reference manual, but found no documentation.
is it somehow hidden, or should we add it?

cheers -
joachim

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

As an aside, for projects meant to run indefinitely, I find it useful
to use --daemon mode. This could be done in CsOptions:

<CsoundSynthesizer>
<CsOptions>
--daemon
</CsOptions>
<CsInstruments>

sr = 48000
ksmps = 1
nchnls = 2
0dbfs = 1

instr 1
asig = oscili(.25, 440)
out(asig, asig)
endin

</CsInstruments>
<CsScore>
i1 0 -1
</CsScore>
</CsoundSynthesizer>

alternatively no score at all and

schedule(1, 0, -1)

in fact, I rarely use a score these days.

Prof. Victor Lazzarini
Maynooth University
Ireland

cool, thanks.
i did not know about the --daemon option at all.

Is the —daemon option and the negativ p3 in any way documented?
I can’t find it in the manual of the floss.

Greetings,
Philipp

– daemon is a command line flag documented here:
https://csound.com/manual/CommandFlags.html

I assume “does not compile” in this context means there are no events in CsScore(?).

-p3 is documented here:
http://www.csounds.com/manual/html/i.html

A -p3 used in the score will act as a tied note ex. i1 0 -1 or -5 will terminate immediately if i1 is the only instrument but technically still compile, for example printing, running loops, init ftables in the instr etc.). If there are other instruments in the score -p3 acts as an always on instrument until the rest of the score completes. For example with:
i1 0 -1
i2 2 5
instr 1 will remain on for 7 sec.

When used in schedule as Victor wrote the instr runs indefinitely even if there are no other instr playing.

I’m not sure this is specifically documented anywhere although perhaps the Csound manual schedule explanation defines this behavior:

If the duration is zero or negative the new event is of MIDI type, and inherits the release sub-event from the scheduling instruction.

It’s not implicitly obvious to me, I’m sure someone else can better elaborate.

Regards,
Scott

Maybe it makes sense to mention different behaviour of score and schedule here…

Score below will start instrument 1 at time 0s for indefinitely and then stop it at time 2s.

i 1 0 -1
i 1 2 -1

When using schedule below, it will start instrument 1 at time 0s for indefinitely and then restart it at time 2s also for indefinitely

schedule(1, 0, -1)
schedule(1, 2, -1)

To imitate behaviour of a score above, the second schedule needs to be as below and then instrument 1 will be stopped at time 2s. p3 can have arbitrary value

schedule(-1, 2, 0)

Best,

Lovre