Phase shift by arduinofft is not corrected

Start with 1 microphone and 1 frequency = 1kHz, this is for beginning, not tested


#include <arduinoFFT.h>
arduinoFFT FFT;
const uint16_t samples = 128; //= 64 bins
////////////////////////////////////////////////
const double signalFrequency = 1.0917;
//const double samplingFrequency = 10; // google - The Nyquist-Shannon Sampling Theorem 
const double samplingFrequency = 2000;
double phase_shift = 0;
/////////////////////////////////////////////////
double vReal[samples];
double vImag[samples];

void setup()
{
  Serial.begin(115200);
  delay(200);
  Serial.println("Ready");
}

void loop()
{
  ///////////////////////////////////
 for(int i=0; i<SAMPLES; i++)
    {
        microseconds = micros();    
     
        vReal[i] = analogRead(0); // microphone input on A0
        vImag[i] = 0;
     
        while(micros() < (microseconds + sampling_period_us)){
        }
  ////////////////////////////////////
  Serial.println("Phasedeg,  Real,  Imaginary,  Phase");
  for (int phaseDegrees = -179; phaseDegrees < 180; phaseDegrees += 5)
  {
    phase_shift = phaseDegrees * PI / 180.0;
    DoTheFFT();
    Serial.print(phaseDegrees);
    Serial.print("  \t  ");
    if (samples == 64)
      ShowSample(7); // 64 samples
    if (samples == 128)
      ShowSample(14); // 128 samples
  }

  while (1) {}
}

void DoTheFFT()
{
  /* Build raw data */
  double cycles = ((samples * signalFrequency) / samplingFrequency); //Number of signal cycles that the sampling will read
  for (uint16_t i = 0; i < samples; i++)
  {
    /* Build data with positive and negative values*/
    vReal[i] = cos((i * (twoPi * cycles)) / samples + phase_shift);
    vImag[i] = 0.0; //Imaginary part must be zeroed in case of looping to avoid wrong calculations and overflows
  }

  FFT.Windowing(vReal, samples, FFT_WIN_TYP_HAMMING, FFT_FORWARD);  /* Weigh data */
  FFT.Compute(vReal, vImag, samples, FFT_FORWARD); /* Compute FFT */
  // FFT.ComplexToMagnitude(vReal, vImag, samples); /* Compute magnitudes */
  // PrintVector();

}


void PrintVector()
{
  Serial.println("Amplitude,    Real,    Imaginary,   Phase");
  for (uint16_t i = 0; i < (samples / 2) - 1; i++)
  {
    for (int j = 0; j < 1; j++)
    {
      ShowSample(i);
    }
  }
}

void ShowSample(int i)
{
//  Serial.print(((i * samplingFrequency) / samples));
//  Serial.print(",\t");
  float amplitude = sqrt(vReal[i] * vReal[i] + vImag[i] * vImag[i]);
 
 // Serial.print(amplitude);
  //Serial.print("\t");
  Serial.print(vReal[i]);
  Serial.print(",\t  ");
  Serial.print(vImag[i]);
  Serial.print(",\t  ");
  if (amplitude > 1.0)


 Serial.println(atan2(vImag[i], vReal[i]) * 180 / PI);
  //else
    //Serial.println('0');

   // 64 = last bin where is 1kHz signal from A0
    //////////////////////
  Serial.print(vReal[64]);
  Serial.print(",\t  ");
  Serial.print(vImag[64]);
  Serial.print(",\t  ");
  if (amplitude > 1.0)


 Serial.println(atan2(vImag[64], vReal[64]) * 180 / PI);
    //////////////////////
}