Which algorithm is used for noise canceling in earphones?

samlowry picture samlowry · Jun 28, 2011 · Viewed 15.5k times · Source

I want to program software for noise canceling in real time, the same way it happens in earphones with active noise canceling. Are there any open algorithms or, at least, science papers about it? A Google search found info about non-realtime noise reduction only.

Answer

Ricky Bobby picture Ricky Bobby · Jun 28, 2011

from This site

Active noise cancelling headphones in addition to all the normal headphone circuitry, have a microphone and additional special circuitry. At a basic level the microphone on the headphone picks up the ambient noise around you and relays it to the special circuitry. The special circuitry interprets the sounds and mimics it in an inverse (opposite) manner. The inverse sound it produces is sent through the headphone speakers and cancels out the ambient noise around you.

All this is based on sound waves interference. When 2 waves of opposite phases interfere the result is no sound. (it works with light too.)

You should have a look at the wikipedia page on waves interference to find the right phase you need to produce to cancel the outside noise

For a sinusoidal system:

Let's take 2 waves :

enter image description here

and

enter image description here

We want to express the resulting wave as :

enter image description here

Given A1 you want to find A2 such that A0 = 0

It means given Phi1 you need to find Phi2 such that A0=0

You can prove that:

enter image description here

And solving A0 = 0 you will get the frequency of the wave you need to create to cancel the noise. It's called destructive interferences.

enter image description here

Sound waves are not in 1 dimension... so you will just get the destructive interference in one direction:

enter image description here

Now you just need to find some stuff of sound signals...


I will try to answer your comment.

First:

A 2D problem is not much more difficult that the 1D.

The outside noise can be approximate as a source situated at the infinity. You will create a destructive noise with a source in your headphones, and you can assume that the amplitude is the same at equal distance of the source .

You need to write that down on a x,y axis (it can be good to use polar coordinates)

enter image description here

and you will be able to get the amplitude on each point on the plan using simple trigonometry formulas like :

:\sin (A + B) = \sin A \cdot \cos B + \cos A \cdot \sin B

:\cos (A + B) = \cos A \cdot \cos B - \sin A \cdot \sin B

:\sin (A - B) = \sin A \cdot \cos B - \cos A \cdot \sin B

:\cos (A - B) = \cos A \cdot \cos B + \sin A \cdot \sin B

Second:

All the delays are modeled in the "Phi" of your destructive source. Can just Adapt the Calculated Phi so it takes the delay into account.

You may need more specific information on sound since my information is very theoretic on any types of waves.