krafter
krafter

Reputation: 1432

Audio feedback issue in an iphone application

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:

  1. Limit max sound volume to prevent feedback from growing.
  2. Use filters, to limit some frequencies.
  3. Subtracting previously output signal from new input signal (which, I think, is the best way, but this isn't perfect. Even if timing is good (I think so) this method spoils the sound too much)

Thanks.

Upvotes: 2

Views: 541

Answers (3)

krafter
krafter

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

Martin Gjaldbaek
Martin Gjaldbaek

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

c.fogelklou
c.fogelklou

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

Related Questions