sd card audio question

I’m trying to make an arduino play a audio file from an sd card at a random interval and then go to sleep.

I have the sketch working to some degree… I get sound when I have the sketch in demo mode, But when I have the arduino sleep it doesn’t make a sound.

I really could use some pointers to the issue

//TMRpcm library is needed

#include <JeeLib.h> // Used for deep sleep

#include "SD.h"
#define SD_ChipSelectPin 10
#include "TMRpcm.h"
#include "SPI.h"

TMRpcm tmrpcm;

ISR(WDT_vect) { // Jeelib Sleepy uses this to wake back up
  Sleepy::watchdogEvent();
}

const bool demoMode = false; // Use this to test your speaker and hear the sounds at 2sec intervals. Set to false for long sleep mode.

const unsigned int sleepTimes[] PROGMEM = {3, 10, 30, 60, 180}; // These are the random sleep intervals: 3min, 10min, 30min, 1hr, 3hr.

unsigned int sleepMinutes = 0;
// This is used to make the cricket do an initial extended
// sleep if you'd like. use anywhere from 0 to 65,535 minutes (45 days!)
// This is good for hiding the payload inconspicuously. ;)

byte repeat = 0; // Used at random to combine noises


void setup()
{
tmrpcm.speakerPin=9;
Serial.begin(9600);
if(!SD.begin(SD_ChipSelectPin))
{
  Serial.println("SD fail");
  return;
}
{
// Do initial sleep if set
  while (sleepMinutes > 0) {
    int sleepTime = 60000;
    Sleepy::loseSomeTime(sleepTime);
    sleepMinutes--;
  }
tmrpcm.setVolume(6);
tmrpcm.play("test.wav");

// Take random reading from empty analog pin to seed the Arduino's pseudo-RNG.
  randomSeed(analogRead(A5));
}
}

void loop() {
  // put your main code here, to run repeatedly:
playAndSleep();
}

void playAndSleep(){
  tmrpcm.play("test.wav");
  
//int chance = random(1, 10); // 1 in 10 chance of making two or three random noises this cycle
//  if (chance == 1) {
//    repeat = random(1, 2);
//  }

//  if (repeat > 0) { // If we're making more than one noise, don't sleep
//    repeat--;
//  }
//  else { // No noises left, time to sleep
    if (demoMode == true) { // If we're in demo mode, don't sleep.
      tmrpcm.play("test.wav");
      delay(2000);
    }
    else { // If not, sleep tight!
      int sleepTime = sleepTimes[random(0, 5)] + random(0, 6); // Get random time from sleepTimes list, and add a random 0-5 minutes.
      // Nighty night
      while (sleepTime > 0) { // sleep one minute at a time
        Sleepy::loseSomeTime(60000);
        sleepTime--;
//      }
    }
  }
 }

.

What exact you want? tell me. upsers

I need the arduino to sleep then at random time play file and then sleep.