playing sound while waiting for input

I want to play a train of tones while simultaneously reading input from an analog in, and then stop the train of tones when the input hits high. what is the best approach for this?

thanks in advance!

albuddah:
I want to play a train of tones while simultaneously reading input from an analog in, and then stop the train of tones when the input hits high. what is the best approach for this?

thanks in advance!

hits HIGH. You mean digital in?

this sort of thing will get you started:

but you need to move stuff out of setup() and into loop(). Remove the delay. And look at millis() and state change detection.