What you describe sounds perfectly possible.
Have you looked at and tried the examples in the IDE ? They will show you how to read the state of an input and change the state of an output depending on the input state. This will meet many of your requirements.
What hardware do you have to play a sound ?
What type of sound do you have in mind ?
A beep, a series of tones, an MP3 file ?