Need help with some arduino code

Hi, I am Nojus…
So, I want to control Adressable LED strip over bluetooth… I did it, but I want to add a function for audio reactive. If you know what I mean… It does not work I send IT number 8 but nothing… What could it be?

Lines that trigger the music react:

       if (val == '8') //Music
       {
       Samples; //Music
//Music


void Samples() {
  for(int i=0; i<N; i++) {
    samples[i] = analogRead(0);
    if(i>0) {
      slope = samples[i] - samples[i-1];
    }
    else {
      slope = samples[i] - samples[N-1];
    }
    
    if(abs(slope) > noiseLevel) {
      if(slope < 0) {
        calculatePeriod(i);
        if(periodChanged == 1) {
          displayColor(getColor(T));
        }
      }
    }
    else {
      ledsOff();
    }
    periodFactor += 1;
    delay(1);
  }
}

void calculatePeriod(int i) {
  if(t1 == -1) {
  
    t1 = i;
  }
  else {
    
    int period = periodFactor*(i - t1);
    periodChanged = T==period ? 0 : 1;
    T = period;
  // Serial.println(T);
   
    t1 = i;
    periodFactor = 0;
  }
}

uint32_t getColor(int period) {
  if(period == -1)
    return Wheel(0);
  else if(period > 400)
    return Wheel(5);
  else
    return Wheel(map(-1*period, -400, -1, 50, 255));
}

void fadeOut()
{
  for(int i=0; i<5; i++) {
    strip.setBrightness(110 - i*20);
    strip.show(); // Update strip
    delay(fadeDelay);
    periodFactor +=fadeDelay;
  }
}

void fadeIn() {
  strip.setBrightness(100);
  strip.show();

  for(int i=0; i<5; i++) {
    //strip.setBrightness(20*i + 30);
    //strip.show();
    delay(fadeDelay);
    periodFactor+=fadeDelay;
  }
}

void ledsOff() {
  fadeOut();
  for(int i=0; i<N_PIXELS; i++) {
    strip.setPixelColor(i, 0, 0, 0);
  }
}

void displayColor(uint32_t color) {
  for(int i=0; i<N_PIXELS; i++) {
    strip.setPixelColor(i, color);
  }
  fadeIn();
}


uint32_t Wheel(byte WheelPos) {
  // Serial.println(WheelPos);
  if(WheelPos < 85) {
   
    return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } 
  else if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } 
  else {
    WheelPos -= 170;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}
       Samples; //Music

That is not a function call. To make it a function call, add the argument list (even if the list is empty):

       Samples(); //Music

I am just a IDIOT sorry… How can you delete a thread?

One more question how do I make it so it deos not turn off when it ends
EX: I send it a 8 but it stops after ~10 seconds. How do I make it so it never stops