Reputation: 379
I'm using Novocaine for frequency detection - and it works fine. I highly appreciate the Novocaine framework, as it is performant and easy to use.
Anyhow, there's only one issue: capturing the sound from the iPhone/iPad microphone, I want to disable the speaker output in order to prevent acoustic feedback (noise). How can I do that? Until now, I've tried in vain to change the audio output route. Any ideas are highly appreciated!
Of course, I've found out that independently of the Novocaine framework I can disable the hardware sound - but when I do that, the user gets a kind of tooltip ("sound disabled") which can be annoying to the user. I prefer to disable the sound temporarily as soon as the user hits the "capture sound" button without taking notice of it.
Upvotes: 1
Views: 239
Reputation: 379
The solution is trivial and I found it out nearly accidentally:
in the output block
[audioManager setOutputBlock:^(float *data, UInt32 numFrames, UInt32 numChannels)
{ ... }
I simply set the output data to zero - after having analyzed (with FFT or convolution or cross correlation or what else) the data:
// silence the sound in order to disable sound feedback
for(int i=0; i<numFrames; i++) {
data[i] = 0.0;
}
That's it!
Upvotes: 1