[Csnd] Problem with tab_i and decimal p1
Date | 2014-03-10 14:55 |
From | "vallste@libero.it" |
Subject | [Csnd] Problem with tab_i and decimal p1 |
Attachments | TestChains.csd |
Dear List, the attached csd basically spawn a new istance of instr 1000 at every change of the FLcount. The decimal part for the shedule of instr 1000 is wrapped between 1 and 4 (varible ichains in instr 3) and used by instr 1000 to read the corresponding table (giCurChain1, giCurChain2,...) at index 0. Basically it should print: iExtraTime = 1.1 for iChainTable 1 iExtraTime = 2.2 for iChainTable 2 iExtraTime = 3.3 for iChainTable 3 iExtraTime = 4.4 for iChainTable 4 but somehow it seems to read the value of 2.2 for table 3 and 3.3 for table 4. Can someone have a look into it and tell me what I'm doing wrong? Thank you |
Date | 2014-03-10 15:40 |
From | Victor Lazzarini |
Subject | Re: [Csnd] Problem with tab_i and decimal p1 |
well, you’re not doing anything wrong, but I think Csound is. You can add this and you will see: printf_i "%.13f\n", 1, iChainTable instr 1000: p1 = 1000.300 instr 1000: iChainTable = 3.000 2.9999999999995 and if you say round(iChainTable), it will work. Not sure why this is giving the incorrect result, but I will check. ======================== Dr Victor Lazzarini Senior Lecturer NUI Maynooth, Ireland victor dot lazzarini at nuim dot ie On 10 Mar 2014, at 14:55, vallste@libero.it wrote: > Dear List, > the attached csd basically spawn a new istance of instr 1000 at every change of the FLcount. > The decimal part for the shedule of instr 1000 is wrapped between 1 and 4 (varible ichains in instr 3) and used by instr 1000 to read the corresponding table (giCurChain1, giCurChain2,...) at index 0. > Basically it should print: > iExtraTime = 1.1 for iChainTable 1 > iExtraTime = 2.2 for iChainTable 2 > iExtraTime = 3.3 for iChainTable 3 > iExtraTime = 4.4 for iChainTable 4 > but somehow it seems to read the value of 2.2 for table 3 and 3.3 for table 4. > Can someone have a look into it and tell me what I'm doing wrong? > > Thank you > |