Produce anti-noise

Paul McGuire ptmcg at
Tue Feb 3 05:47:01 CET 2004

"Phil Hornby" <phil.hornby at> wrote in message
news:mailman.1146.1075766535.12720.python-list at
> The big problem with this sort of thing is latency - DSPs have a very low
> latency as they are generally designed to do 1 operation per cycle and
> sole purpose is to do the signal processing not worry about all the other
> stuff a normal PC has to worry about - i.e. the OS. Most solutions that
> on a desktop machine would have a dedicated DSP on a PCI card and would
> run on your PC's main CPU as it is not a simple processing power
> issue...more a round trip delay issue... and getting through an OS and an
> Interpreted language would most likely be too much delay... It might be
> possible to do it by wrapping a C API to a Commercial DSP system that
> allow you to configure the hardware to do what you want...
> --
> Phil
> "Requirements - what are they I just hack something together that does
> I think they want" ;)
> In article <bvmlik$kam$06$1 at>, Diez B. Roggisch wrote:
> >> I want to know if the is a way to do something in python to produce
> >> some anti-noise (i.e. I talk in the microphone and the sound go out by
> >> the speakers but with inversed phase).
> >>
> >> So I want to know how to control the microphone and to add some sort
> >> of effect to the sound that enter in and to put it out with that
> >> effect and all this at the same time.
> >
> > AFAIK such things need vast amounts of computational power for very
> > complicated algorithms and very low latencies - a job for specialised
> > code. Its much more complicated than inverting the amplitude (I don't
> think
> > that inverting the phase is possible - AFAIK you can only shift it, and
> > thats not what you want here...)
> >
> > So I seriously doubt that you can do that with python - I even doubt
> > you can do it with you computer. Not so much from the raw computational
> > power side of the thing, but much more from your audio-equipment.
> > Professional noise reduction systems costs several thousands of euro and
> > feature lots of speakers, especially designed, chosen and arranged to
> > reflect the acoustic envrionment of _one_ room, e.g. the inside of a
> > certain car. Then specially adapted algorithms come into play.
> Hmm.  You can buy a $200 set of bose headphones that do it with a simple
> chip and low power.
> I think a regular PC could do this (so long as you know the equations) by
> brute force.  You'd probably want to
> use signal processing libraries rather than pure Python, though.
> --
It turns out that there are a number of EE's out there that are using the
DSPs built into ordinary PC sound cards to do quite a bit of
high-performance signal processing.  This particular link takes you to a
free downloadable real-time software oscilloscope, using the microphone
input as its input signal.

There is also more on this at, or if you Google for
"software radio" and "python", you should find some projects using the sound
card DSP library from Python.

(I know the OP was not talking about radio per se, but I think the signal
processing being done on these projects is pretty amazing, and probably
accessible thru a DLL, and probably more than adequate for the OP's needs
for shifting a signal 180 degrees out of phase.)

-- Paul McGuire

More information about the Python-list mailing list