[Csnd] Classic vs alternative syntax
Date | 2019-02-21 16:23 |
From | Mauro Giubileo |
Subject | [Csnd] Classic vs alternative syntax |
Hi, I was thinking about the classic Csound syntax vs the alternative one and I was wondering if something like this: aOut someOpcode ... runs faster than: aOut = someOpcode(...) In other terms, does the Csound parser generate exactly the same syntax tree for both the versions? Best Regards, --- |
Date | 2019-02-21 17:21 |
From | john |
Subject | Re: [Csnd] Classic vs alternative syntax |
Simpleexperimemt shows they are not identical.` Instr 2 has a temporary variable created. Similar examplewith kvars are identical. There is code to optimise but it does not always work aparently Ialso saw some errors in the compilation referring to multicore. No idea why I guess it is time to look again. |
Date | 2019-02-21 17:57 |
From | Mauro Giubileo |
Subject | Re: [Csnd] Classic vs alternative syntax |
Ok, so if I understood right, the version in the first instrument should be faster (at least for now), right? And I was thinking, in the second instrument, how does Csound know if the oscil opcode has to return an a-type variable or a k-type? It checks the left-value type of the expression? aout = oscil:a(1000, 440) ; is ':a' not necessary in this case? Regards, --- Il 2019-02-21 18:21 john ha scritto:
|
Date | 2019-02-21 19:52 |
From | Rory Walsh |
Subject | Re: [Csnd] Classic vs alternative syntax |
I think it defaults to a-rate if you leave out the return type? On Thu, 21 Feb 2019 at 17:57, Mauro Giubileo <mgiubileo@computeraltafed.it> wrote:
|
Date | 2019-02-21 20:10 |
From | john |
Subject | Re: [Csnd] Classic vs alternative syntax |
I fixed the multicore issue and revised the assigment optimisation. As far as I can tell the classical and functional cases are the same now. A ever I epect peope to find more nasties in the compilation..... ives me something to do! On Thu, 21 Feb 2019, john wrote: > Simpleexperimemt shows they are not identical.` Instr 2 has a temporary > variable created. Similar examplewith kvars are identical. There is code to > optimise but it does not always work aparently > Ialso saw some errors in the compilation referring to multicore. No idea > why > > I guess it is time to look again. > > > |
Date | 2019-02-21 20:33 |
From | Rory Walsh |
Subject | Re: [Csnd] Classic vs alternative syntax |
Nice work John ;) On Thu, 21 Feb 2019 at 20:10, john <jpff@codemist.co.uk> wrote: I fixed the multicore issue and revised the assigment optimisation. As |
Date | 2019-02-21 21:20 |
From | Mauro Giubileo |
Subject | Re: [Csnd] Classic vs alternative syntax |
So, we can assume that for all the opcodes that can return a/k/i-type variables, the a-type is always the default one when you don't specify it and use the function syntax? --- Il 2019-02-21 20:52 Rory Walsh ha scritto:
|
Date | 2019-02-21 21:23 |
From | Mauro Giubileo |
Subject | Re: [Csnd] Classic vs alternative syntax |
Very nice, thanks! --- Il 2019-02-21 21:10 john ha scritto:
|
Date | 2019-02-22 07:26 |
From | Tarmo Johannes |
Subject | Re: [Csnd] Classic vs alternative syntax |
Hi,
I am afraid this is not the case - it depends which type is declared to be the default one and it can be different in different opcodes. Thus I think it is good practice to always include the desired type in functionlike syntax - otherwise you may get sometimes undwanted behaviour that is hard to detect.
Fotr myself I use old syntax when there is one opcode in a line (since the type is set by variable) like
ivalue random 10, 20
and functionlike when I want to have several opcodes in one line:
kvalue port chnget:k("value"), 0.02, chnget:i("value")
greetings, tarmo
On neljapäev, 21. veebruar 2019 23:20.34 EET you wrote: So, we can assume that for all the opcodes that can return a/k/i-type variables, the a-type is always the default one when you don't specify it and use the function syntax? --- Mauro |
Date | 2019-02-22 10:26 |
From | Rory Walsh |
Subject | Re: [Csnd] Classic vs alternative syntax |
Thanks for clarifying that Tarmo. I wasn't quite sure. On Fri 22 Feb 2019, 07:26 Tarmo Johannes <trmjhnns@gmail.com wrote:
|
Date | 2019-02-22 16:28 |
From | Mauro Giubileo |
Subject | Re: [Csnd] Classic vs alternative syntax |
Thanks, good to know. Now I remember I had some troubles in the past because sometimes I omitted the ":type" in some expressions with function syntax, so I too think that the when you use function syntax is better to always specify the returned type. The problem is that I tend to forget this... :-D An advantage of the classic syntax is that there are no ambiguities on this matter, but you lose the ability to directly use an opcode inside an expression. --- Il 2019-02-22 08:26 Tarmo Johannes ha scritto:
|