Question App idea

sometimes when i am chatting via facebook or whatsapp at late evening i fall asleep,it is not as funny to wake up and see you friends or your girlfriend tell you: you felt asleep again
i am asking if there is any app that could play music or sound after a period of inactivty of the device.if i dont touch screen for X minutes it will play a sound and then when i will need to go sleep i will just disable it
there is any?