Re: [Csnd-dev] [EXTERNAL] Re: [Csnd-dev] expression with multiple outputs
Eduardo Moguillansky <[email protected]> Tue, 23 Sep 2025 11:01:19 +0200
| Newsgroups | gmane.comp.audio.csound.devel |
|---|---|
| Message-ID | <CAHFFssJYuzTucpAgG1g5+8jBezFHNVfVAK1Z_ZL6E2jzBFDXig@mail.gmail.com> |
PR is here: https://github.com/csound/csound/pull/2285 On Mon, Sep 22, 2025 at 9:14 PM Victor Lazzarini < [email protected]> wrote: > Sounds great > Prof. Victor Lazzarini > Maynooth University > Ireland > > On 22 Sep 2025, at 13:59, Eduardo Moguillansky < > [email protected]> wrote: > > > I can add a variant of pan2, if needed > > On Mon, Sep 22, 2025 at 2:45 PM joachim heintz <[email protected]> > wrote: > >> yes what you say is what i had in mind: >> "There could be a section in the manual on inlined opcodes giving >> examples where it can be noted that only opcodes with one output may be >> inlined." >> >> in the case of pan2: might it be an idea to add an array output, as >> eduardo mentioned? >> >> On 22/09/2025 20:42, Victor Lazzarini wrote: >> > What do you have in mind in terms of documentation? >> > >> > There could be a section in the manual on inlined opcodes giving >> examples where it can be noted that only opcodes with one output may be >> inlined. >> > >> > Note that this is a common approach in other languages that have >> multiple outputs. In Python tuples are used to handle this, >> > >> > def fun(): return 1, 2 >> > >> > fun() >> > (1,2) >> > >> > def fun2(a,b): return a, b >> > >> > fun2(fun()) >> > TypeError: fun2() missing 1 required positional argument 'b' >> > >> > fun2(fun()[0], fun()[1]) >> > (1,2) >> > >> > In Csound we can do similarly with arrays. >> > >> > Prof. Victor Lazzarini >> > Maynooth University >> > Ireland >> > >> >> On 21 Sep 2025, at 23:13, joachim heintz <[email protected]> wrote: >> >> >> >> ok --- thanks to all for the explanations and thoughts. >> >> i wonder where is a good place to document it. >> >> or is it already anywhere documented? >> >> >> >>> On 22/09/2025 04:41, Victor Lazzarini wrote: >> >>> It's a can of worms. I have discussed this with Steven and we >> concluded it's a bad idea. >> >>> Prof. Victor Lazzarini >> >>> Maynooth University >> >>> Ireland >> >>>>> On 21 Sep 2025, at 19:25, Hlöðver Sigurðsson <[email protected]> >> wrote: >> >>>> >> >>>> >> >>>> in theory the out could infer the [a,a] after I finish this behemoth >> change regarding struct arrays I could take a look at this >> >>>> >> >>>>> On Sun, 21 Sept 2025 at 17:17, Victor Lazzarini <000010b17ddd988e- >> [email protected] <mailto:000010b17ddd988e-dmarc- >> [email protected]>> wrote: >> >>>> >> >>>> No, we don't have that syntax and we have decided a while ago >> that >> >>>> we would not try to implement it. >> >>>> >> >>>> So in summary, a multi-output opcode cannot be used inline like >> this. >> >>>> >> >>>> Prof. Victor Lazzarini >> >>>> Maynooth University >> >>>> Ireland >> >>>> >> >>>> > On 21 Sep 2025, at 14:35, joachim heintz <[email protected] >> >>>> <mailto:[email protected]>> wrote: >> >>>> > >> >>>> > *Warning* >> >>>> > >> >>>> > This email originated from outside of Maynooth University's >> Mail >> >>>> System. Do not reply, click links or open attachments unless you >> >>>> recognise the sender and know the content is safe. >> >>>> > >> >>>> > my assumption was that if out(a1,a2) works, it should also work >> >>>> if the >> >>>> > two arguments are the outputs of an expression, like here. >> >>>> > >> >>>> > >> >>>> >> On 21/09/2025 22:28, Eduardo Moguillansky wrote: >> >>>> >> pan2 returns two outputs, not an array. So I would say that >> it is a >> >>>> >> limitation in the sense that for that to work one would need >> to >> >>>> add a >> >>>> >> variant of pan2 which returns an array. >> >>>> >> >> >>>> >> On Sun, Sep 21, 2025 at 3:18 PM joachim heintz >> >>>> <[email protected] <mailto:[email protected]> >> >>>> >> <mailto:[email protected] <mailto:[email protected]>>> >> wrote: >> >>>> >> >> >>>> >> nchnls = 2 >> >>>> >> 0dbfs = 1 >> >>>> >> >> >>>> >> instr 1 >> >>>> >> sound:a = pinkish(.1) >> >>>> >> out(pan2(sound,random:i(0,1))) >> >>>> >> endin >> >>>> >> schedule(1,0,1) >> >>>> >> >> >>>> >> error: opcode 'pan2' for expression with arg types ai >> >>>> returns out-args >> >>>> >> != 1, line 14 >> >>>> >> >> >>>> >> is this a limitation, or is it supposed to work? >> >>>> >> >> >>>> >> thanks - >> >>>> >> joachim >> >>>> >> >> >>>> >> >