triggering sound and led in response to LDR

Ive tried looking at states and state detection and I get how they work, Im just still struggling to apply it to using an analogue read. Not sure how to make the mp3 sound for 1 second only when the analogue read first gets a reading of over 4.0 and then not play anything else until the analogue read drops bellow a certain reading. Ive tried using millis and states, im just confused on the appropriate way of using them in this context.

void loop(){

currentMillis = millis(); 

b=analogRead(A5);
b=b*5/1023;

Serial.println(b); //prints the values coming from the sensor on the screen

if(b>=4.0&&b<=5.00)

{digitalWrite(5,HIGH);

myDFPlayer.play (1); 

delay (300);

}

still having to use a delay at the moment, and this obviously just loops round and round while its receiving this analogue read

Not sure how to make the mp3 sound for 1 second only when the analogue read first gets a reading of over 4.0 and then not play anything else until the analogue read drops bellow a certain reading.

Unless you save the current reading as the previous reading (or the current state as the previous state), you will never be able to do that.

If you HAD looked at the state change detection example, the fact that the example has variables for the current and previous readings should have been obvious.

Your code does not.