The idea was to create a whining sound. So I experimented with Tan wave. After all whining sound is the most annoying sound of all.
Here’s the codes.
//test tan waveform
const int buzzPin = 9;
const double pi = 3.142;
for(float t = 1; t < 4; t= t + 0.001)
double y = 80 * tan (t * pi); //the tan function that create the weird sound
int thisPitch = abs(y);
thisPitch = map(thisPitch,0,1000,500,700);
//thisPitch = constrain (thisPitch,500,700);
//for (int t =0; t < 255; t=t+5)
Next I would like to try instead of “absoluting” the y value, I just map thisPitch from negative number to positive number so basically I just shift the zero value.