signal inverting

Hi I want one very interesting thing to be done.
All of us can hear our own voice with headphone and mic
of the PC. What I want is that some method by which I can
invert the output of MIC after sampled by ADC OR same
effect can be obtained by inverting the signal that is going
to speaker, I want this in real time so that direct sound that is
comming o my ear is canceled by this sound from speake.
Please do reply how small it can be, mey be just a link
on how sounfd is captured in pc.
this I want to do so please tell me how to do this.

thanks in advance…
Shamail

Cut the speaker cable and you will see two wires. They are probably colour coded red and black. Reconnect your speaker but cross over the wires so that red is connected to black and black connected to red. This will invert the signal, however if you are looking for a “voice cancelling” effect, it won’t work.

<<<it won’t work.>>>

Pretty much correct. The speaker sound has to take the room into account because the speaker sound also bounces from chairs and tables in the room. The sound that reaches your ears is not the same sound that left the speakers. You can sometimes help howling or feedback in a theatrical performance by reversing the phase of the speakers with the wire trick.

By the way, if you reverse only one speaker in a two-speaker system, you can get interesting phasing effects, like the last part of this:

http://www.kozco.com/tech/soundtests.html

Download the “Left-Right” clip and play it into headphones. The last part has one speaker intentionally reversed–in post production, not in real time.

Koz

I may be wrong in thik that reconnecting the wire me flip the speakers right <->left. but irrespective of that will work or not Now I want to know how to reverse
that red-black wire through some peace of software.

And I know that a lot of thing to be taken into account to cancel the audio but I wrote all that message so that one can understant what I want to do, I want just a method by which i can hear sound with inverted waveform. May be I can test it in some outside field not in the room I just wanted to test the effet.

Audacity does not do real-time audio processing, but before you spend a load of time finding a way to do it I was wanting to point out that it would probably not achieve the desired noise cancelling effect.

Most pro-quality mixing desks include a “phase reversal” button on each channel. What this button does is to invert the signal (turn it upside down so that when the input goes +ve the output goes -ve and when the input goes -ve the output goes +ve). This is what you want to do?

The way that mixing desks achieve this is with hardware as that is the best method. It is simple, accurate, and has the lowest possible distortion or time lag effects.

You can easily make a hardware switch to achieve this (which does not require you to cut your speaker cable):
Assuming that your speaker connector is a stereo mini-jack connector, buy the following items:
one mini-jack plug
one mini-jack socket
two double pole single throw switches
one box to put the bits in
some wire.

There are three connectors on stereo jack plug - one is connected to the tip, one to the ring just behind the tip, and the third goes to the sleeve. The tip connection is for one channel (right) and the ring for the other channel (left). The sleeve is the common (earth) connection for each channel.

Connect a red wire from the “tip” connection of the mini-jack socket, a white wire to the ring, and 2 black wires to the sleeve.
Repeat this for the mini-jack plug.

You then need to connect the wires to the switches such that when switched one direction each colour on the mini-jack connects to the corresponding colour of the socket, but when switched the other way the red wire from the plug goes to the black wire of the socket, and the black from the plug goes to the red of the socket, and the white/black pair swap over in the same manner. Here’s a diagram for the wiring up the switches:
switch.gif
Why you won’t get noise cancelling:
The wavelength of sound is in the range of about 2 cm to 15 metres (in air at sea level). A frequency of 344 Hz has a wavelength of 1 metre, but a frequency of 440 Hz has a wavelength of about 78 cm, and a frequency of 1 kHz has a wavelength of 34.4 cm.
If you are half a wavelength away from a speaker, by the time the sound reaches you it will be inverted. If you then move away from the speaker to twice that distance, the waveform will be “right way up” again.

Putting some actual figures in: At a distance of 500 cm, a frequency of 344 Hz will be inverted, but a frequency of 688 Hz will not be inverted as it is one full wavelength away.

Now compound the situation with reflections from the room and everything in the room and you will appreciate that phase of the sound that you hear is a complex mixture of inverted, non-inverted, and everything in between.

You can achieve some degree of noise cancellation using headphones, since the headphone speaker is very close to your ear, hence frequencies below about 1 kHz are essentially “in-phase”. Your microphones need to be also located in the same position as the speakers (just a few millimetres from your ear). The problem with this is that the microphones will then pick up the sound from the headphones, but what you want is the sound outside of the headphones, which is why noise cancelling headphones need to be cleverly designed and constructed.

Thank you all for such a meaningful help