Ultrasonic Theremin and interrupts

Hello!
I've been playing around with arduino for quite sometime and I think I've moved past the real beginner projects.

I've got an idea to make a ultrasonic theremin.
I've got two hc-sr04 sensors: one would be pitch control and the other would be volume.

Most of the code that involves these sensors uses the pulsein function, but it wouldn't work for this project. So I've been looking into interrupts. The idea is to use pin change intterupt and measure the clock cycles between the change. That pulse time could be then translated to either pitch or volume.
In the datasheet it says that to get the centimtre value = pulse is us / 58. My theoretical 'playable' range(how far to move your hand from the sensor) would be somewhere between 5-60cm. That corresponds to 290us to 3480us.

For sound generation I've found 1bit DDS, wavetable synthesis, which also uses intterupts.

So...
My question is that, is this possible? The ISR should block intterupts. So if I'm trying to get sensor values, then I wouldn't be able to play sounds at the same time?

I'm sorry for the confusing question, english is my second language.

The resources I've looked at:

http://www.technoblogy.com/show?QVN

All the best!

desmond3:
My question is that, is this possible? The ISR should block intterupts. So if I'm trying to get sensor values, then I wouldn't be able to play sounds at the same time?

Every running ISR handler blocks every other ISR handler from executing.

So if one ISR handler is running while another interrupt request is activated, the other interrupt request will stay "waiting" until the running ISR handler is finished, then the waiting interrupt will become active and run its ISR handler.

If your tone generation is interrupt based, you most likely do not want to disturb the tone generation by other interrupts, as tone distortions will lead to bad sounds.

Most likely you want to:

  • read two parallel adjusted ultrasonic sensors
  • at the same time
  • as often as possible per second (i.e. 25 sensor readings per second)
  • set pitch and volume for the notes
  • sound then actually played from within interrupt routines

I don't see any need for the usage of any interrupt routines with the ultrasonic sensors, while you already use interrupts for sound (pitch and volume) generation.