[Csnd] Rendering a multichannel file from multiple instances of one instrument

hello everybody!

i try to find a quick solution for rendering a multichannel file, from a instrument that produces a mono signal, but is called in a loop an gets an index from the channel count.

here is a dummy code

instr ctrl_instr
  iCnt init 0
  while (iCnt < 21) do
    event_i(„i“, „signal“, 0, 1, iChannel)
    iCnt += 1
    iChannel += 1
  od
endin

instr signal
  aSig poscil 0.5, 440
  outch p4, aSig
endin

is there an elegant and quick solution for this?

greetings,
philipp

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

ok, thats weird. i reduced my code to a minimal example and it stillt not works like i suggested. i run csound in emacs and it runs forever when i try to render this.
is there something wrong?

<CsoundSynthesizer>
<CsOptions>
-d -odac -3 -W
</CsOptions>
<CsInstruments>

sr = 48000
ksmps = 16
nchnls = 21
0dbfs = 1.0

schedule("ctrl", 0.1, 1)
instr ctrl
  iCnt init 0
  iChn init 0
  while (iCnt < nchnls) do
  event_i("i", "sig", 0, 5, iChn+1)
  iChn += 1
  iCnt += 1
  od
  turnoff
endin

instr sig
  iOutChn = p4
  aSig poscil 0.5, random:i(80, 800)
  outch iOutChn, aSig
endin

</CsInstruments>
<CsScore>
</CsScore>
</CsoundSynthesizer>

Hi Philipp,
maybe you are looking for the fout opcode, as Tarmo mentioned?
Best,
Luís

Csound mailing list Send bugs reports to Discussions of bugs and features can be posted here

Thanks all!

The problem was, Csound was running forever, because of a missing end of score statement!

Greetings,
Philipp