The audio problem I am trying to solve can be thought of at a high level like this:
Imagine an interface with a button and a light. To begin interacting, the user presses the button and a sound file starts playing out of the iPhone speaker - looping continuously. The application would then be in an "on" state. Let's imagine the sound file is motor.aiff. So, you get the sound of a motor going continuously after pressing the button.
The next interaction with the application would be the user blowing into the microphone. Let's imagine the microphone has a level of 0 to 1 with 1 being the maximum input level. When the user blows into the microphone, this input level will pass 70% of its max value. While the input level is over the 0.7 threshold, 2 things need to happen:
1. The light on the interface should light up
2. A second sound should start playing in a loop out of the iPhone speaker - mixed with the motor sound
Let's imagine the second sound is bells.aiff. So if the state was "on" and the user blew into the mic they would see a light and hear bells and a motor. If the user were to press the button a second time the application would enter an "off" state, the motor noise would then stop and blowing into the mic would do nothing.
So in sum:
The user presses an "on" button. They start to hear a looping motor sound. If they blow into the mic while the button is "on", they see a light shine and hear bells. If they stop blowing, the bells stop and the light goes out. If they press the button again to enter the "off" state, the motor sound stops, and blowing into the mic does nothing.
On Apr 23, 2009, at 2:55 PM, William Stewart wrote:
um - your "doSomething" - that seems like you are trying to write some kind of compressor - metering is not going to really be the right thing for you anyway I think.
Perhaps you could give a broader sketch of what you want to do and we can suggest something
Bill