lilypad mp3, randomly- trigger a transistor and -play audio?

finaly i got all components set up like in the pic.

https://forum.sparkfun.com/download/file.php?id=3338

so the programming of this device is new to me and i cant find a good example or tutorial for my needs.

Its about to let the ringer ring so i need the code for transform the digital pin (lets say pin3) of the arduino into an output(thats easy)but then i need the code to tell the arduino to just put out the 3.3V just for 50 milliseconds then 50 ms no output than 50 ms output again and that for 50 seconds. he should do this process randomly every 5 to 60 minutes.

than…if you trigger another digital pin (lets say pin4) during this randomly executed process of 50 seconds ringing he should play one out of 10 different audiofiles.

thats it…

i should know how to do the rest (if you trigger pin4 during no ringing it should play 1 soundfile automaticaly) for my self.

This seems to be easy if you know the basics but i dont know how i can learn this. Maybe anybody can help me writing this or give me some links or other sources of good knowledge about my codingproblem :slight_smile:

thanks in advance