On 27.05.2024 12:31, Miller Puckette wrote:

I don't very much like that code -
Me neither, just wanted to address the issue.
but OTOH I'm thinking to use double precision to compute the table this time around, so whatever imprecision there is should be minimal :)

Also, instead of accumulating the phase you should calculate it for every point:

#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif
...
for (int i = 0; i < COSTABSIZE + 1; i++)
    fp[i] = cos(2.0 * M_PI * i / (double)COSTABSIZE);

This should ensure that the table is symmetric, unless the underlying cos() function is broken :)

Christof


M

On 5/27/24 12:25 PM, Christof Ressi wrote:
Sounds good to me!

Just to be sure, you will also try to make the new table symmetric, right? See https://urldefense.com/v3/__https://github.com/pure-data/pure-data/pull/106/files__;!!Mih3wA!HAMS5QHc72XO2BmeG-xaCEGAuhprLD0p-yl4ZcRpMdWPXKdUV3dkeS8H9ab5uVQ-1if6tqkI0Ui7zw$ .





_______________________________________________
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev