need a programming concept for Wave Shield

Using a photo resistor I am making a night light that will activate my led mood lamp when the light falls below a threshold.

Ok that is easy, here is the hard part (at least for me).

I also want it to play a wave file when the light falls below a threshold but I want to play it only one time. When the light in the room transitions from bright to dark then the file will only play once. It would not play again until there was another bright to dark transition. In electronics we would call this an "edge trigger".

So to summarize the goal is to play the wave file only once during the transition from a high light level to a low light level. I do not want the wave file to play the entire time that the room is dark.

Any ideas?

Have two flags: IsItDark and HaveIPlayedSound
Have a variable: PhotoResValue

in setup()
set IsItDark to false.
set HaveIPlayedSound to false.

in loop()
Read photo resistor into PhotoResValue.
If PhotoResValue has passed your light->dark threshold, set IsItDark to true.
If IsItDark is true and HaveIPlayedSound is false, play sound and set HaveIPlayedSound to true.
If PhotoResValue has passed your dark->light threshold, set both IsItDark and HaveIPlayedSound to false.

Put more generally you have to program a "state machine" - what you do depends on the current state (as held in the variables) and the current observations. Sometimes you respond by changing the state variables.

So you write the code in loop to always take account of the current state. Some states will "time out", which means you need to track the elapsed time since the state was entered in order to leave that state when appropriate - those states will need an unsigned long variable to hold the time they started.