How can I create anti-noise with code or an application? It doesn't have to be realtime, just sound that is the opposite of the entire soundtrack! So, when you play both together, they will cancel out each other.
-
How is it coded? Also, 'anti-noise' by cancellation implies tight limits on phase error and jitter, so 'play both together' is not simple, in general. There are many audio utilities that can invert audio data, (an mp3, for example). – Martin James Mar 26 '12 at 12:25
-
"many audio utilities that can invert audio data" - Like??? – user1095332 Mar 26 '12 at 12:32
-
http://www.pcworld.com/downloads/file/fid,93293-order,4/description.html – Martin James Mar 26 '12 at 14:05
-
Sorry, I don't see the feature... – user1095332 Mar 27 '12 at 22:30
-
'apply different effects (Amplify, Delay, Equalizer, Fade, Flanger, INVERT, Normalize, Reverse, MultiTapDelay, Silence, Stretch, Vibrato, Echo, Chorus' - my emphasis. – Martin James Mar 28 '12 at 13:03
-
Could not find it in the actual application (it is not in the effects tab), but invert is in Aduacity! – user1095332 Mar 29 '12 at 09:11
2 Answers
If you have pure noise availible try (I have not tried it my self) to fft you can use fftw-3
1 Take some buffer containeing noise only 2 Zero-pad the noise so that its length matches up with the entire signal 3 Calculate the noise spectrum N 4 Calculate the signal spectrum X filter out frquencies in X that are present in N and store the result in Y 6 Recompose y from Y
in Matlab or octave:
n=length(x);
n(1:noise_end-noise_start+1)=x(noise_start:noise_end);
N=fft(n);
X=fft(N);
% Filter noise frquencies
y=ifft(Y);
The idea is to use the spectrum of the noise signal to reduce the noise in the desired signal. When the spectrum of the noise is known, filter these frequencies out.

- 6,717
- 8
- 46
- 88
-
-
1Thanks! It might sound strange, but I need to create an inversion of the entire audiotrack, so when played at the same time: original + inversion = total silence! – user1095332 Mar 29 '12 at 08:51
-
From your description, it sounds like you just need to invert the source signal. If you do that and sum to the original, you'll be sitting at -inf
, no problem.
But, what I think you actually want to do is reduce noise on a signal based on a measurement of the background noise. This is basically accomplished by doing the following:
- Spectral analysis of a selection of noise samples. You get this by running an FFT.
- Conversion of the area you wish to fix from time domain to frequency domain. (Again, FFT.)
- Subtraction of that noise from the original you want to fix up.
You'll end up with something close, but will undoubtedly want to do more work on the signal from there. There's a lot of math involved here, but if you search around Stack Overflow for DSP, you'll find several things to read up on. Hopefully this will get you started.

- 159,648
- 54
- 349
- 530
-
Sorry, it might sound strange, but I need to create an inversion from the entire audiotrack, so when played at the same time: original + inversion = total silence! – user1095332 Mar 29 '12 at 07:53
-
1