ReasonableSynth modified and whistling

Hi,

I modified the synthesize_sineP in ReasonableSynth and I have a high whistling on C2, for example.

I changed this function like this (and raised the sustain to 0.7) :

..
if (amp > 1e-10) {
    int jmax = 100;
    for (int j = 1; j <= jmax; j++) {
        float val = (float)j;
        float res = 1.0/val * amp * sinf ( M_PI * phase * val);
        left[i]  += res;
    }
    phase += fq;
    for (int j = 1; j <= jmax; j++) {
        float val = (float)j;
        float res = 1.0/val * amp * sinf ( M_PI * phase * val);
        right[i] += res;
    }
} else {
    phase += fq;
}
..

It seems that the “high” value of jmax creates whistling (that doesn’t happen, for example, with 2).

I wonder if I have to change some variable types from float to double or to do something else; I am looking for the right way to follow.

The sinf() function takes an argument in radians, by having a large value of jmax you have likely created a nonsensical argument for the sine generating function.