I wanted to perform an experiment with Active Noise Cancellation. I've downloaded a song from YouTube. I converted it to .wav using FFmpeg. Then I negated it using sox:

sox -v -1 song3.wav song3-negated.wav

As expected, the negated track sounds the same to a human's ear.

I added both songs to two separate decks in VirtualDJ (out of no better ideas).

enter image description here

I play them both at the same time using this VirtualDJ bind:

deck 1 play_pause & deck 2 play_pause

When I use a single output device, the “noise cancellation” does work. The more I increase the deck 2 volume, the quieter the whole song plays (up to a turning point). I believe it proves that the negated wave on deck 2 is as it should be.

Sadly, when I output deck 1 (the non-negated track) to my non-fancy old Creative stereo speakers (50 centimeters / 20 inches in front of me) and deck 2 (the negated track) to my non-fancy Steelseries over-ear headphones (put on my head), the cancellation effect doesn't appear at all. If anything, the overall music feels louder, as the track from headphones plays at the same time as speakers. Tweaking the volume of the negated track doesn't help.

Am I naive? I thought that this is actually the perfect ANC scenario, as no microphone is involved. The track and its negation are played perfectly synchronized, from the same device. What can I do more? Should the negated wave be... processed somehow? Or is this thing just impossible to achieve?

1 Answer 1


It's impossible to achieve.

Your initial cancellation is at phase-accuracy. Two files playing through one output, each inversely-phased to the other.

As soon as you try to do that in the physical domain, from two sound sources, then the speed of sound comes into play.
The speed of sound is approximately 1ms per foot.

Your ears each hear the two sources with different delays - even if that's onlt by the width of your head. if you were to accurately place your head facing one speaker with the other directly behind you at the same distance - to less than a millimetre - your ears would still be able to differentiate the sound sources, because phase-alignment is actually different at different frequencies.
We're talking nano-seconds, but that's what the brain uses for direction information & it's pretty hard to fool.

Even if you spilit your sources to each speaker of a pair of headphones, you still wouldn't get cancellation, as each ear would be getting different information.
The sound would appear to come from a rather confusing "everywhere" but there would be no cancellation.

  • Your calculations match mine. I tried delaying the negated deck by 2 ms, but it also didn't work. While I did expect the results not to be perfect, now I'm confused how ANC in headphones works at all...
    – cubuspl42
    Commented Oct 8, 2022 at 18:16
  • 1
    Noise cancellation in headphones works because the distances are tiny & the measurements are known to the nanometer. Each ear has its own cancellation.
    – Tetsujin
    Commented Oct 8, 2022 at 18:27
  • 1
    The time delay is extremely short, the mic & speaker are as close as possible to each other. The speaker plays an inverse of what the mic is hearing, whilst ignoring the input signal. Your ear is effectively cut off from natural external sounds. As soon as you try to move that from the micro to the macro, there's just too much variance for it to ever work. You could play around with inverting &/or time-shifting one side of a stereo pair & listening to the result on headphones & speakers. It's a 'fun half hour experiment' but will never produce silence.
    – Tetsujin
    Commented Oct 10, 2022 at 7:48
  • 1
    Sure, but only at one point [or at best, plane] in the room, & it will probably fail after the first reflection.
    – Tetsujin
    Commented Oct 10, 2022 at 11:53
  • 1
    @Tetsujin is absolutely right. A 20 kHz sinewave (which is the extreme case) has about 170 mm wavelength in air under "normal" conditions. You have to be extremely precise for it to cancel. You would have to account for the EXACT amplitude and phase, the latter involving the propagation-delay phase shift, the micro-movements of head in relation to the incoming sound (this is to be cancelled) and so on. This is why ANC works only for low frequencies in "speaker systems" and up to maybe 500 Hz in over-the-ear headphone and maybe up to maximum 1 kHz for in-ear plugs.
    – ZaellixA
    Commented Oct 12, 2022 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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