condition to play audio till user press escape key

I want create a software just like an alarm clock.
It will paly an audio file repeatedly till did not press esc key.
What command should I give as conditions and whoch module should I use?