Cabbage Logo
Back to Cabbage Site

Table weirdness

I’ve got some tables that I am passing into an instrument, and I can’t quite figure out why one version of this program works, while the other does not.

Basically, my problem revolves around the size of the tables. Because what I am using them for, it should work with tables of even or odd sizes. In my first program (the one with only two tables) everything seems to count properly for both odd and even sizes. But in the second, the tables that are odd sized get truncated at the next lower index.

tabletest.csd (761 Bytes)
tablecheck.csd (1.2 KB)

Screen Shot 2023-02-05 at 8.49.33 AM

If you notice, in the first screen dump, the first table has 8 elements, and the second has 7. Both indices are counting properly (the first 0-7, and the second 0-6). In the second screen dump, the first table has 6 elements, and it counts 0-5. But the other three tables have an odd number of elements (5, 3, and 5, respectively), but their indices only range from 0-3, 0-1, and 0-3.

I’m using the most recent release of csound and 2.9 Cabbage.

Not sure why I didn’t check this before, but it appears that ftlen is returning the wrong sizes in the second program, the odd sized tables are one smaller than they should be…

I’m submitting this to the Csound list…

Ok, the answer is to make the table sizes negative. This turns off the check for the power of two + 1 requirement.

Thanks, Jeanette!

1 Like