vector<float> vOut_t;
int length = fs*T;
float value;
float K = 2*PI*f1 * T / (log(f2/f1));
float L = T/log(f2/f1);
float t, t2;
for(t=0;t<length;++t)
{
t2=t/fs;
value = exp(t2/L) -1;
value = sin(K*value);
vOut_t.push_back(value);
}
When I send the sweep to the soundcard and listen to it, the beginning (low freqencies ) sounds as expected. But at the end ( high frequencies ) the signal does not only contain the pure sine sweep but also some sort of overlay.
If I generate the sweep in scilab, load it into vOut_t and then send it to the soundcard via ASIO, the sweep sounds perfect.
But at the end ( high frequencies ) the signal does not only contain the pure sine sweep but also some sort of overlay.
My hot guess for today is: Arithmetic overflow. You may have an overflow or precision problem somewhere. Did you tried just replaing "float" with "double"?
you can debug it, by storing the last value in the for loop and comparing the new one to the last. Then break in debugger as soon as the difference is greater than a certain threshold. Since you are doing sine waves, it shouldn't happen, but you may get the strange overlays with this.
Then you know at least an example frequency and you can try to print the intermediate values and see whether it's really some precision/overflow problem or a mistake in your formula.