# Handling Phase Shift with ANC

I've been working on a circuit to do active noise cancellation, but I'm worried about controlling the phase. Here are my assumptions, and I'd love some help understanding 1)what of my assumptions are wrong, and 2) what should I/should I not worry about with regards to potential problems (listed below)?

This whole ANC will be mono, to simplify things.

If I feed the output of the microphone directly into an inverting op-amp, I should get exactly (?) $$\180^0\$$ phase shift. So if the microphone and the speaker were in the exact same location (and we considered nothing else in the signal path), it should be a "perfect" ANC. That said, the microphone and the circuit will not be in the exact same place, for calculation sake we'll say they'll be 1 meter apart. For a very low frequency, like 20hz, that's 1/15000000 of a wavelength, which probably doesn't make much difference. For a frequency much higher, say 20khz, that's a difference of 1/15000 which is considerably higher, but I don't know if that's high enough to warrant me worrying about it.

If that IS concerning enough that I'll want to worry about it, what approach should I take - do I want to try to impose a uniform phase shift across all frequencies, or do I want a uniform time delay? I get confused whenever I try to think through it.

Let's complicate the problem further: My speaker (singular, not mega-high-quality) probably can't produce 20hz very well - so I'll want to throw a high-pass filter on the output of the inverting op-amp. Again, my speaker can't produce 20khz very well, so I'll want to put a low-pass filter on. Now I've got a band-pass filter, which imposes some weird phase shifts depending on the exact selection of components. Is THIS a big enough concern that I need to compensate for it? If so, how do I go about it?

I've been looking at an analog solution, but if digital is easier I'm not opposed to it - I just wanted to try analog since I haven't ever approached a problem like this before. Thanks for the input!

These are the design requirements of a good speakerphone to eliminate the sidetone from the mic. But in a speakerphone, the latency from mike to the speaker is a short delay and wavelength so the phase shift in the mic and speaker is fairly easy to measure and compensate with something to get 180deg.

With non-flat phase response mic and speaker with wall reflections so it MUST be a noise cancelling mic that will not pickup speaker sounds. This means with feedback there will always be a frequency with sufficient feedback gain to cause it to howl or oscillate. Then you have two choices, I think.

1. Use two cheap mics in differential phase mode such that your voice is in between the two mics. The low-frequency response is cut off due to the wavelength between the mics, unless it is offset so you speak in one and use the other to cancel far-field sounds without disturbing the feedback to both. THen the gain is controlled by the drain resistor which may need to be tuned.

2. A cheap passive mic noise cancellation with breathing mesh cloth on the back. The may or may not balance of pressure on the mic depending on the random quality of electret or MEMs mics.

The catch is it only picks up near-field acoustic pressure, with your voice near the corner of your mouth with a steady position on a headset.

• Thank you! I think I understand the proposed solution #1. This is intended to cancel out some highway noises, so I’d have one mic, then the speaker, then a second mic after the speaker, and measure the difference between them before inverting, or...? Apr 12, 2019 at 14:06
• A half octave parametric equalizer may help tune the response or an old PC driven sound system with a software EQ like Audacity with record active and sound drivers to enable mic over speakers. Apr 12, 2019 at 14:38
• I see. Here you need a mic away from the fence or road but near where you want to cancel road noise with the speakers but not pick up local sounds. Then measure amplitude and phase driving speakers with a swept frequency and try to equalize amplitude and phase with a filter with 180 deg inversion over the most offending bandwidth in a few octaves or 1 decade. Doing more than this will be difficult or impossible without a precision phase and gain controlled filters. Measure the spectrum of noise using Audacity to match the filter to the noise yet compensate for mic+speakers Apr 12, 2019 at 14:41
• So the mics may be near the speakers but facing traffic a wide view and speakers facing the yard in attempt to cacncel out the wall of sound over the fence, which are actually moving points, so it won't be as good as you want. Apr 12, 2019 at 14:43
• I’m up on the second floor, and the majority of the highway noises seem to come trough my window. I think I’ll try to treat it as then”source” even though it won’t be perfect. I’ll measure tonight and see where the worst-offending frequencies are, then try to tune my circuit around that within an octave it two. If I’m understanding your second comment, I should get one mic and just try to invert those offending frequencies? If so, how do you suggest I compensate for phase shift within a low or high pass filter? Apr 12, 2019 at 15:03