Csound Csound-dev Csound-tekno Search About

[Csnd] table opcodes

Date2018-12-23 20:10
FromJohn
Subject[Csnd] table opcodes
More code study shows that if we have a power-of-two table it uses the
fact, but if not resorts to more expensive ways.  So despite the
manual the opcodes are save for any table.  What they do is use floor
operation on the index so small rounding error as in the example in
question give unexpected results.

We could replace all floor operations by a round -- not sure

I notice that
     giTable ftgen 0, 0, 13, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13

    instr Test
      indx = 0
      while indx < 26 do
       iVal table indx, giTable, 0, 0, 1
       print iVal
       indx += 1
      od
    endin
    schedule "Test", 0, 0

produces unexpected results, at least to me.

==John ffitch

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

Date2018-12-23 20:15
FromVictor Lazzarini
SubjectRe: [Csnd] table opcodes
yes, I rewrote these for 6 to remove the need for power of two. I think floor is the correct operation; in any case, if we change it, we will change behaviour.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 23 Dec 2018, at 20:11, John  wrote:
> 
> More code study shows that if we have a power-of-two table it uses the
> fact, but if not resorts to more expensive ways.  So despite the
> manual the opcodes are save for any table.  What they do is use floor
> operation on the index so small rounding error as in the example in
> question give unexpected results.
> 
> We could replace all floor operations by a round -- not sure
> 
> I notice that
>     giTable ftgen 0, 0, 13, -2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
> 
>    instr Test
>      indx = 0
>      while indx < 26 do
>       iVal table indx, giTable, 0, 0, 1
>       print iVal
>       indx += 1
>      od
>    endin
>    schedule "Test", 0, 0
> 
> produces unexpected results, at least to me.
> 
> ==John ffitch
> 
> 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

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

Date2018-12-23 20:20
Fromjpff
SubjectRe: [Csnd] table opcodes
The trouble with floor is rounding error as in the original message of this 
thread.

At least we should correct the manual and give a warning.

On Sun, 23 Dec 2018, Victor Lazzarini wrote:

> yes, I rewrote these for 6 to remove the need for power of two. I think floor is the correct operation; in any case, if we change it, we will change behaviour.
>
> Victor Lazzarini
> Dean of Arts, Celtic Studies, and Philosophy
> Maynooth University
> Ireland
>
>> On 23 Dec 2018, at 20:11, John  wrote:
>>
>> More code study shows that if we have a power-of-two table it uses the
>> fact, but if not resorts to more expensive ways.  So despite the
>> manual the opcodes are save for any table.  What they do is use floor
>> operation on the index so small rounding error as in the example in
>> question give unexpected results.
>>

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

Date2018-12-23 20:36
FromVictor Lazzarini
SubjectRe: [Csnd] table opcodes
But that's surely user error, is it not? If floor is not wanted, then interpolation is what is
needed. Truncating table lookup uses floor not round.

Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

> On 23 Dec 2018, at 20:20, jpff  wrote:
> 
> The trouble with floor is rounding error as in the original message of this thread.
> 
> At least we should correct the manual and give a warning.
> 
>> On Sun, 23 Dec 2018, Victor Lazzarini wrote:
>> 
>> yes, I rewrote these for 6 to remove the need for power of two. I think floor is the correct operation; in any case, if we change it, we will change behaviour.
>> 
>> Victor Lazzarini
>> Dean of Arts, Celtic Studies, and Philosophy
>> Maynooth University
>> Ireland
>> 
>>> On 23 Dec 2018, at 20:11, John  wrote:
>>> 
>>> More code study shows that if we have a power-of-two table it uses the
>>> fact, but if not resorts to more expensive ways.  So despite the
>>> manual the opcodes are save for any table.  What they do is use floor
>>> operation on the index so small rounding error as in the example in
>>> question give unexpected results.
>>> 
> 
> 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

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