SLOVED, Sound in void loop with time?

Need me to change this code for sound make delay 5s without delay 5s to all void loop code?

if(battery_level < 6.1)
{
  if(sound)
     { 
       delay(250);
       digitalWrite(buzzer,HIGH);
       delay(250);
       digitalWrite(buzzer,LOW); 
       delay(5000);
    }
}

All void loop code stop working 5s, how to change this sound code to repeat every 5s without stop looping code?

See the blink without delay example in the IDE examples:
File -> Examples -> Digital -> Blink without delay

This code working perfect

const byte speakerPin=9;
unsigned long lastPeriodStart;
const int onDuration=1000;
const int periodDuration=6000;

void setup()
{}

void loop()
{
  if (millis()-lastPeriodStart>=periodDuration)
  {
    lastPeriodStart+=periodDuration;
    tone(speakerPin,550, onDuration); // play 550 Hz tone in background for 'onDuration'
  }
}