To start with, I'm pretty new to DSP, so forgive me failing to understand any basic concepts.

I'm working with an iOS app that depends on the input from the analog audio jack whilst monitoring the signal through output (headphones, etc). Unfortunately, iOS devices suffer from crosstalk given a high enough volume due to the proximity of the output and input leads.

Garageband on iOS provides something called "Crosstalk prevention" for monitoring guitar audio playback through its amp modelling. I've no idea how they do it but it's something I'd like to do in my app.

I've access to the output signal, and I perform a FFT on the input signal (to perform spectral noise gating) anyways, so anything that uses fourier transforms might be good since I'm doing that operation. It's difficult for me to find any solutions as DSP is pretty new to me.

  • $\begingroup$ What is the path through which the output signal can bleed into the input? Only through the iPhone internal circuitry as you seem to suggest, or because the input is connected to a microphone or pickup recording near the speaker playing the modified sound (as in the amp modelling scenario you describe). $\endgroup$ – pichenettes Aug 18 '13 at 8:44
  • $\begingroup$ Internal circuitry, it seems. It looks to be a common problem when using a guitar adapter that uses the analog jack. $\endgroup$ – user2617130 Aug 18 '13 at 17:39
  • $\begingroup$ Do I need to provide additional information? $\endgroup$ – user2617130 Aug 20 '13 at 22:14

If I understand correctly what you are trying to achieve is usually called Acoustic Echo Cancellation. In many cases, so-called adaptive filtering algorithms, such as the (normalized) least-mean-squares ([N]LMS) algorithm, can be used effectively. In this context, I can really recommend the book Adaptive Signal Processing by Widrow and Stearns. I'm sure you'll find a number of ready-to-use implementations of the (N)LMS algorithm to experiment with on the internet. (Have an eye on the filter order - it needs to be high enough to capture the length of your crosstalk path.)

Furthermore, as you mentioned that you are already working in the frequency domain, you can have a look on algorithms that are called (you guessed it) frequency-domain LMS algorithms. They originate, via so-called block LMS algorithms, from the classical LMS algorithms. In this context, I really liked the paper by Shynk: Frequency-domain and multirate adaptive filtering.


It's been some years since I've ended the project, so I'd figure I'd revisit my own question in case someone is running into the same problem.

The main contributor in cancelling the crosstalk on an iOS device was deceptively simple; invert your audio samples into the other audio channel (play your normal audio into the left channel, play the same audio but inverted into the right channel).

Both channels will sound exactly the same, but cancel out a lot of the crosstalk in the audio hardware before being output to the speakers/headphones/etc. This will make the application essentially mono, but it's a decent price to pay seeing how well it worked.

This will not cancel it out all the crosstalk, however. A software solution would probably still be needed.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.