[Csnd] Array Limit
Date | 2023-10-29 07:51 |
From | Philipp Neumann |
Subject | [Csnd] Array Limit |
Hello everybody! In my current composition i work with algorithmically generated arrays which are fed to csound for composition parameters. No i have the problem that inside csound there is a limit to the length of arrays (1999). Which annoys me a lot. And i’m asking myself if this is necessary at all? Is there a reason for this? and is there a workaround? Best, Philipp 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 |
Date | 2023-10-29 08:16 |
From | ST Music |
Subject | Re: [Csnd] Array Limit |
Hi Philipp, that indeed seems odd. I don't seem to have that issue. <CsoundSynthesizer> <CsOptions> -odac </CsOptions> ;================================ <CsInstruments> sr = 48000 ksmps = 32 nchnls = 1 0dbfs = 1 instr 1 iArr[] init 5000 kArr[] init 5000 iLen = lenarray(iArr) print iLen iNdx init 0 while iNdx < 5000 do iArr[iNdx] = iNdx iNdx += 1 od printarray iArr kTrig = metro(1) printarray kArr, kTrig endin </CsInstruments> ;================================ <CsScore> i1 0 .1 </CsScore> </CsoundSynthesizer> Am I using them differently than you perhaps? Best, Scott On Sun, Oct 29, 2023, 3:52 a.m. Philipp Neumann <philipp@von-neumann.com> wrote: Hello everybody! |
Date | 2023-10-29 08:24 |
From | Philipp Neumann |
Subject | Re: [Csnd] Array Limit |
Hey Scott! I use ‚fillarray‘ to create and fill the arrays at the same time. Maybe just this opcode has problems with it. I will investigate it. Thanks for trying out! > Am 29.10.2023 um 09:16 schrieb ST Music |
Date | 2023-10-29 08:33 |
From | Philipp Neumann |
Subject | Re: [Csnd] Array Limit |
ok. The problem is indeed the ‚fillarray‘ opcode, which doesn’t accept more values then 1999. Is there a way to fill a array in a other way? i create textfiles which holds the array and in csound i use #include to call them. > Am 29.10.2023 um 09:24 schrieb Philipp Neumann |
Date | 2023-10-29 08:43 |
From | ST Music |
Subject | Re: [Csnd] Array Limit |
Here's one possibility. This is a bit of a mess below & probably needs to be modified to suit your needs. instr 1 iIter init 0 SArr[] init 1 iArr[] init 1 while iIter < 1000 do Sline, iLineNum readfi "/sdcard/text.txt" SArr[iIter] = "10" trim_i SArr, iIter + 2 trim_i iArr, iIter + 2 print iIter iArr[iIter] = strtod(SArr[0]) print iArr[iIter] iIter += 1 if iLineNum == -1 then iIter = 1000 endif od trim_i iArr, lenarray(iArr) - 1 printarray iArr endin You might have to use delimit and/or strsub as well, depending on how your files are formatted. So basically read the text as strings, line by line, and convert to a float or int. On Sun, Oct 29, 2023, 4:33 a.m. Philipp Neumann <philipp@von-neumann.com> wrote: ok. The problem is indeed the ‚fillarray‘ opcode, which doesn’t accept more values then 1999. |
Date | 2023-10-29 10:00 |
From | Philipp Neumann |
Subject | Re: [Csnd] Array Limit |
This seems like a workaround. But could just the ‚fillarray‘ opcode could be modified? Could a developer say something why this opcode is limited to 1999 values? > Am 29.10.2023 um 09:43 schrieb ST Music |
Date | 2023-10-29 10:16 |
From | John ff |
Subject | Re: [Csnd] Array Limit |
There is a boundary at 2000 when there is a strategy change to extended argument form. Looks as if extended structyhas not been programmed for fillarray. Will look when awake ==John ffitch On 29 Oct 2023, 10:01, at 10:01, Philipp Neumann |
Date | 2023-10-29 18:15 |
From | joachim heintz |
Subject | Re: [Csnd] Array Limit |
if you use a textfile as actual input, you might be able to do this: - use GEN23 to read the text file in a function table - and if you prefer arrays over tables, use copyf2array. j On 29/10/2023 09:33, Philipp Neumann wrote: > ok. The problem is indeed the ‚fillarray‘ opcode, which doesn’t accept more values then 1999. > Is there a way to fill a array in a other way? > > i create textfiles which holds the array and in csound i use #include to call them. > >> Am 29.10.2023 um 09:24 schrieb Philipp Neumann |
Date | 2023-10-30 07:25 |
From | Philipp Neumann |
Subject | Re: [Csnd] Array Limit |
This sounds like a really good solution! Thank you Joachim! I will try it. > Am 29.10.2023 um 19:15 schrieb joachim heintz |