title: Play sound when silence in the room; stop sound when voices heard
body: <p>I need some guidance as I may have to shelve development until a later time.</p>
  
  <p>I want to play a sound once the lights are switched off and the room goes dark, then stop the sound once the light is switched back on. I've discovered that Apple doesn't currently provide a way to access the ambient light sensor (not in any way that will get App Store approval).</p>
  
  <p>The alternative I've been working on is to try and detect sound levels (using AVAudioPlayer/Recorder and example code from <a href="http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/" rel="nofollow">http://mobileorchard.com/tutorial-detecting-when-a-user-blows-into-the-mic/</a>. I.e., when I detect voices of people in the room have dropped to a specific level (i.e. silence trying to compensate for background noise), I play my sounds.</p>
  
  <p>However, if the people in the room start talking again and I detect the voices, I need to stop playing the sounds.</p>
  
  <p>Q: is this self-defeating, i.e., the sound generated by the iPhone will essentially be picked up by the iPhone microphone and indistinguishable from any voices in the room? Methinks yes and unless there's an alternative approach to this, I'm at an impasse until light sensor API is opened up by Apple.</p>