     fht_mag_log(); // take the output of the fht
     uint8_t maxval=0;
     int maxi=0;
-    float noise_val=0;
-    int noise_acc=0;
     //for(int i=0;i<FHT_N/2;i++)
     for(int i=0;i<126;i++)
     {

        maxval=fht_log_out[i];
        maxi=i;
      }
      noise_acc += fht_log_out[i];
    }
    noise_val = noise_acc/126.0f;
    sei();
    int note=maxi;
    // Evaluate a window around the detected note
    float notef = 0;
    int accum=0;

 pinMode(12, OUTPUT);
}


void detect_note(float& note, float& volume)
{
    cli();
    volume=0;
    for (int i = 0 ; i < FHT_N ; i++) { // save 256 samples
      int k = 512-analogRead(A0);
      volume += abs(k);
