[Csnd] Instr score durations

I have a short example below. According to the manual, it says…

https://csound.com/docs/manual/i.html

p3 – Duration time in beats (usually positive). A negative value will initiate a held note (see also ihold). A negative value can also be used for ‘always on’ instruments like reverberation. These notes are not terminated by s statements A zero value will invoke an initialization pass without performance (see also instr).

-n -d ; Initialize the global variables. ksmps = 32 nchnls = 2 0dbfs = 1

instr 99
prints(“starting %d\n”, p4)

if metro(1) == 1 then
printks(“tick (%d)\n”, 0, p4)
endif
endin

i 99 0 10 1 i 99 0 -1 2 i 99 0 z 3 i 99 0 0 4

So, why doesn’t the number 2 instance execute at the k-rate? It used to. It does execute the i-rate.

Mike

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

when using functional syntax, it’s often required to specify the rate, csound makes a guess otherwise,

try replacing

metro(1)

with

metro:k(1)

Nope. Still does not execute the instance started with -1.

Mike

Try

i 99 0 10 1
i 99.1 0 -1 2
i 99 0 z 3
i 99 0 0 4

and you will get your printouts.

The reason is that you start a negative p3 and then immediately it gets replaced by the positive matching p1 following it and
so you only have 2 instances running. If instead you mark the negative p3 with a specific instance number, then it
can only be replaced with a matching p1.

From the same page in the manual

"An instrument may be turned on and left to perform indefinitely either by giving it a negative p3 or by including an ihold in its i-time code. If a held note is active, an i statement with matching p1 will not cause a new allocation but will take over the data space of the held note."

Thanks, Victor. I’ll check it again tonight. This problems arose with using just a single instance of an instr. -1 wouldn’t work at k-rate, and Rory suggested trying ‘z’, which worked.

Just trying to figure out while all of a sudden this is happening.

Mike

What you showed here is the normal behaviour of the software, it has always worked like that.

Depending on how you are running, setting a p3 to -1 may not keep Csound running indefinitely. You may need to use f 0 z or something similar.

Prof. Victor Lazzarini
Maynooth University
Ireland

Ok, was able to try these things again, and I effectively ran each line by themselves, and I didn’t get any different results. 1, 3, & 4 worked, as expected. But 2 still only ran during the i-rate. When I changed the instr called to 99.1, 2 ran as it should have.

Maybe this isn’t exactly as I have been using these things because I normally use named instr’s. But I still swear that I have been able to use -1 to run these instr’s… Anyway, I’ll just start to use the ‘z’ option for the duration in a score.

Mike

You can still use p3 as -1 and it will run, there’s nothing to say it wouldn’t.

However if you have another i-statement (etc) with matching p1 (numbered or named), it will replace the instance instead of starting a new one.

Prof. Victor Lazzarini
Maynooth University
Ireland

I’m not sure what to say, but using -1 does not work for me anymore, unless I use an instr number with a fractional part.

I’m suspecting that my copy of Csound is somehow corrupt. I just install Csound from the Cabbage bundle, so I was thinking about removing Csound altogether, and doing a fresh install.

Mike

Advice from Rory Walsh to my students and me was to:

Install a fresh Csound (it is the latest release), and not to install the Csound that is part of the Cabbage Bundle (which is not as current) as the 6.17 at csound.com

No, that has nothing to do with it. There is no way any issue with Csound would appear as this.

If you run one single instance of instr 1 with -1 it will run until Csound stops running. So the CSD

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
instr 1
out oscili(0dbfs, A4)
endin
schedule(1,0,-1)
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

Will run forever playing a 440Hz sine wave at full amplitude. But in this one

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
instr 1
out oscili(0dbfs, A4)
endin
schedule(1,0,-1)
schedule(1,0,1)
</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

the second instance will take over and run for 1 second.

Equally

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
instr 1
out oscili(0dbfs, A4)
endin
</CsInstruments>
<CsScore>
i1 0 -1
</CsScore>
</CsoundSynthesizer>

will not even run because the performance will end immediately. But if you add f0 z

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
instr 1
out oscili(0dbfs, A4)
endin
</CsInstruments>
<CsScore>
f0 z
i1 0 -1
</CsScore>
</CsoundSynthesizer>

I should have completed: it will run forever like in the first example.

Why?

1 - in the first example, there is no numeric score, Csound runs forever. The scheduled instr 1 with p3=-1 will
run forever.

2 - in the second example, the first instr 1 with p3=-1 instance is immediately replaced by the instance with p3=1

3 - in the third example, the score runs to the end before any performance can be run.

4 - in the fourth example the score requires to run an f statement at time z (which is the end of times as far as we are concerned)
so Csound has to run until then. The i1 0 -1 then turns instrument 1 indefinitely on.

This is the first machine that I’ve used the bundled version. But then again, I only took a month off, and now this is somehow different. My Mac is older so I can’t get access to all the tools I would need to compile everything from scratch. Homebrew no longer supports the version of the Mac system I can get. I keep thinking Linux…

Mike

OK. but you probably should not need to install the Csound bundled with Cabbage 2.8 from September 2021 over the more recent Csound 6.17 from csound.com - Feb2, 2022

Victor, thank you for your patience. I finally understand what it is I am doing wrong.

Mike

I am so happy that you and victor have been working on this and sharing it.

  • maybe a good set of examples for the manual (menno?).

f0 z
always on
turnon
p3 with -1

are always tricky and confusing to many of my students (and me too!)

I posted this to the list a while ago, that is the beta Rory asked for