Reputation: 1432
There is a real time audio app for iphone, that adds some effects (reverb, delay, etc.) to input sound and plays it back. So I'm having a classic amplified audio loop issue. You probably are familiar with this. It happens often when you put the mic close to the loudspeaker (sound from input gets amplified, goes out, gets back in and so on).
It would be great to hear any ideas how to fix this.
(I already tried to:
Thanks.
Upvotes: 2
Views: 541
Reputation: 1432
To help other people trying to solve this issue: AEC plus a combination of high-pass, low-pass filters.
http://speex.org, it's AEC part does the job. High-pass, low-pass filters are quite easy to implement. (see Apple AccelerometerGraph example for LP, HP filter implementations)
Upvotes: 0
Reputation: 3015
You might already know this, but just to be on the safe side - make sure you're routing the output to the right speaker. As it says in the docs when you set the "play and record" audio session category, the default output is the top speaker (the one you put your ear to during a call). There's another speaker at the bottom, and since it's a lot nearer to the microphone, it'll produce a lot more feedback. If you set the "play and record" category it would normally take a manual override to route to the wrong (bottom) speaker, but I thought I'd mention it to be sure.
Upvotes: 1
Reputation: 1801
Your number 3 and number 2 combined are probably the best. Look up adaptive acoustic echo cancellation.
AEC using nLMS is quite easy to implement but takes a bit of CPU. It may work if you use a lower sample rate, depending on how long in ms your echo is.
There is a fast version that uses an FFT for adaption. It doesn't adapt as quickly but will probably be fine on a mobile app where there isn't a long echo tail.
The way AEC works is that it converges on an acoustic model for the echo path between speaker and microphone and then uses that model to subtract the output echo from the microphone input. It knows what is going out, it puts that through the model and obtains a guess as to what the echo will be, then removes that echo from the input. As time goes on, the model gets better and the echo smaller.
Upvotes: 5