×

Announcing: Slashdot Deals - Explore geek apps, games, gadgets and more. (what is this?)

Thank you!

We are sorry to see you leave - Beta is different and we value the time you took to try it out. Before you decide to go, please take a look at some value-adds for Beta and learn more about it. Thank you for reading Slashdot, and for making the site better!

Noise Cancelling in Software?

Cliff posted more than 9 years ago | from the how-well-would-that-work dept.

84

doc_verma wonders: "There are directions to build noise-cancelling devices in hardware, but what would it take to create noise cancelling in software? Since computers have a speaker-of-sorts and can possibly have a microphone, why not take the input from the mic, reverse-phase it via software, and output it through the speaker? A noise-cancelling feature would be great to run on servers in a rack. It would also be a great app to run on your laptop when you are on a plane."

Sorry! There are no comments related to the filter you selected.

Uh, no. (4, Informative)

QuantumET (54936) | more than 9 years ago | (#13813159)

You'd only get noise cancellation at the rough area around the microphone is, assuming you'd account for the speaker-microphone distance. You have to cancel phase _everywhere_ for it to work for a room, and you can't do that, really, without a huge array of speakers, or speakers exactly co-located with noise sources.

So you could do it in software for headphones, since you just need to cancel noise right at the headphones, which is fine. But it's no good for speakers, unless you have very specific configurations of noise sources that lend themselves to simple cancellation. In general, no way.

Re:Uh, no. (1)

hey! (33014) | more than 9 years ago | (#13815648)

You'd only get noise cancellation at the rough area around the microphone is, assuming you'd account for the speaker-microphone distance.

If I recall a Science News article from a few articles, some people were working on systems to cancel noise at specific places in an area, for example at the operator station for a piece of noisy machinery. As you say, you can't do it everywhere, but I don't think it would have to be at the microphone.

I'd imagine in some applications, depending on the shape of the "silent" zone you're looking for you could use a single speaker and an array of microphones, or an array of microphones and an array of speakers.

Re:Uh, no. (4, Informative)

Anonymous Coward | more than 9 years ago | (#13816241)

I am an electrical engineer.

Parent is exactly right. There are two ways to handle noise cancellation. #1 is source cancellation (very hard unless the source is confined). #2 is receiver cancellation (very easy). However, don't expect either method to work at high frequencies.

Sound is a complex beast. Literally. Imagine you could have enough samples to make a 3D spectrum analysis of the sound. What would it look like? You'd see high frequencies "beaming" off of reflective surfaces. You'd see low frequencies "wrapping around" small objects.

To do source cancellation, you have to find a way to negate all of the sound energy before it reaches *any* receiver. Put your computer in a box with a long, narrow air take. Carefully design the intake/exhaust to minimize "port noise". Add noise cancellation *inside* the box. Walk around. You shouldn't hear anything coming out of the box.

If you can't control the source, you have to resort to receiver cancellation. "Why?," you ask. Because if you mess up on the phase, you can/will end up contributing 3dB to the noise source at various frequencies/locations. That's not acceptable.

Receiver cancellation works just like source cancellation, except you put the box around the receiver. In our case, the "box" is headphones. Put a high quality microphone on one side. Feed a phase-inverted signal into the output speakers.

Earlier I mentioned that noise cancellation doesn't work well at high frequencies. Why is that? Delay. At low frequency, the signal changes very slowly. If I'm "off" by 1 microsecond, it won't make any difference to a signal that oscillates at 60Hz. Here's a little exercise for the reader:
F(t) = cos (2 * pi * f * t) - cos (2 * pi * f * (t + d))
In this example, we're considering only one frequency and one point in space. Let f = 60Hz. Let d vary from 0 to 16ms. Observe the results. What happened at 2.79 ms? At 8.33 ms? Nasty, eh? But we're pretty confident our system can handle those latencies without any trouble, so we'll crank this thought experiment up to 4kHz.

Let's do some envelope calculations: our latency has to be under 42 microseconds to do *any* good (i.e. avoid adding to the noise), under 21 microseconds to get a 3dB attenuation, under 4.2 microseconds to get -10dB, and under 0.4 microseconds to get -20dB. No sweat, right? :-)

I'm going to be a bit facetious here and start by examing the CPU aspects. Ok you've got a 3GHz cpu. Let's be "generous" and assume you get about 1.67 instructions/clock. That means you can execute about 5e9 instructions/second (0.2 microseconds/instruction). There's no way you could hope to get any meaningful work done in 2 instructions, so that rules out the possibility of getting -20dB. In fact, there's not much you could hope to do in ~20 instructions, so there goes -10dB. You *might* be able to write a dedicated driver that could handle -3dB. Whooptee freaking doo *twirls finger*. The padding on your headphones probably does a better job. Or just stick some cotton in your ears.

Even if you manage to get your digital hardware up to speed, you've got another problem: the analog hardware. That's right: between your $0.50 microphone and your $0.50 speaker, there's a pretty decent chance that they've got more than a few microseconds of slew error. Even if you bumped those up to $100.00 each, you're still not likely to get it right. In short: don't expect to do -20dB at 4kHz for under a few grand (*).

Last I heard, the $100 sony headphones do about -10dB at 100-400Hz. As far as I can tell, the hardware is only worth about $2, and you're paying $98 in salesman, middleman, marketing and engineer salaries.

(* No, this is not an offer. I wouldn't try building you a pair for less than a million in R&D funds, and even then I couldn't guarantee results.)

Philips HN100s (1)

Andy Dodd (701) | more than 9 years ago | (#13845410)

They work better than the Ryckebush hardware posted in the original article (I would know, I wasted probably $50-100 in building the hardware and trying to tweak it to get it to work well). The Philips HN100s and HN110s (same thing except different style as far as I can tell) are only $15 INCLUDING shipping on eBay if you look hard enough.

Far better battery life than the Ryckebush design (40ish hours on a single AAA instead of 2-3 hours AT BEST on a pair of expensive 9vs), somewhat better cancellation, and far more compact and better looking (important when going through airline security, my homebuilts basically became useless to me after 9/11).

There are too many challenges involved in doing it in PC hardware when it can be done so cheaply with off-the-shelf headphones. In THEORY, PC hardware could deliver incredibly good cancellation using some adaptive noise cancellation techniques, but 99%+ of PC sound cards are not of sufficient quality for this to work. Having sample-accurate synchronization between input and output is critical, but apparently most sound cards just don't do this. (I've looked into doing acoustic echo cancellation for audio conferencing, which has similar hardware requirements. Most PC sound cards just aren't up to the task.)

Re:Uh, no. (0)

Anonymous Coward | more than 9 years ago | (#13847249)

Whoops. I knew there was something fishy in my post, but I had been up a long time and didn't catch it. Upon rereading this, I notice that I was off by a factor of 1000 in the CPU latency paragraph. Where it says 0.2 microseconds/instruction, it should say 0.2 nanoseconds/instruction. That allows you to have a 2000 instruction latency instead of 2 instructions latency, and it pushes the CPU aspect back into the realm of possibility, provided you have an awesome latency guarantee on your interrupt handler and you write a kernel level device driver.

However, in the real world something like RT Linux can only get you about a 10 microsecond response time. That only buys you -6dB at 4kHz. Plus, you'd still be at the mercy of your sound card and analog hardware.

** You may be wondering why I pulled 4kHz out of my behind. Answer: The human ear is most sensitive between 1kHz and 4kHz.

Re:Uh, no. (1)

theLOUDroom (556455) | more than 9 years ago | (#13850784)

Parent is exactly right. There are two ways to handle noise cancellation. #1 is source cancellation (very hard unless the source is confined). #2 is receiver cancellation (very easy). However, don't expect either method to work at high frequencies.

Unless your receiver is moving around.

What we have here (not from the parent but from the submitter of this article) is a failure to understand the technology. Any attempts at active noise cancellation are going to suck ass unless you know exactly where the microphone, speaker and listener are in relation to each other.

Let's do some envelope calculations: our latency has to be under 42 microseconds to do *any* good (i.e. avoid adding to the noise), under 21 microseconds to get a 3dB attenuation, under 4.2 microseconds to get -10dB, and under 0.4 microseconds to get -20dB. No sweat, right? :-)

I don't really agree with your reasoning here. Your latency can be very large as long as the sound is repetitive. All you need is adequate resolution.
In mathematical terms if d = n/f, where n is a positive integer, then:
cos (2 * pi * f * t) = cos (2 * pi * f * (t + d))
because: cos (2 * pi * f * t) = cos (2 * pi * f * (t + n/f))
cos (2 * pi * f * t) = cos (2 * pi * f * t + 2 * pi * n)
and cos ( x + 2 * pi * n) = cos (x) for all integer values of n
therefore: cos (2 * pi * f * t) = cos (2 * pi * f * t)

For example, if I've got a power transformer that's buzzing at 60Hz, I don't need to be able to do a bunch of calculations and respond within N microseconds. I can *predict* what the incoming sound is going to look like very far into the future. All I need is enough resolution in a delay line, which can be and probably already is on the sound card.

Re:Uh, no. (0)

Anonymous Coward | more than 9 years ago | (#13856876)

>>#2 is receiver cancellation (very easy).
>Unless your receiver is moving around.

That's what I said, but you were too busy nitpicking and beating straw men to notice.

>Your latency can be very large as long as the sound is repetitive.

More nitpicking and bad assumptions on your part. Despite the fact that I used the cosine function, I never suggested (or implied) that I was talking about a pure tone signal. Also, what happens if you're a microsecond off of the 2nd period? Answer: the same thing that happens if you're a microsecond off of the first period. Also, remember what I said about the latency inherent in your analog hardware (hint: you might want to go study the complex frequency response of a mechanical speaker).

Two can play the strawman game: While you're busy filtering that transformer, a car just honked. Ooops. Now your filter echoed a phase inverted honk 17 ms later. Oww. My earses! They hurtses! :-(

Re:Uh, no. (1)

theLOUDroom (556455) | more than 9 years ago | (#13861118)

That's what I said, but you were too busy nitpicking and beating straw men to notice.

Sigh, it's not a straw man, as you certainly didn't give the issue proper emphasis. The listener not being at a fixed point is the fundamental reason why this guy's idea won't work.
Latency is a side-issue that only prohibits the canceling of certain types of noise, not all of it.

More nitpicking and bad assumptions on your part.

This is neither nitpicking, nor a bad assumption. It's a freakin big deal since it's the difference between being able to do SOME noise cancllation and being able to do NONE AT ALL.

Also, remember what I said about the latency inherent in your analog hardware (hint: you might want to go study the complex frequency response of a mechanical speaker).

Sigh, you deal with this with filters. Depending on the feedback system you're using, it will automatically become part of the filter response. It's just like dealing with the response of the microphone, and the distances between the mic, speaker, listener, and source.

Two can play the strawman game: While you're busy filtering that transformer, a car just honked. Ooops. Now your filter echoed a phase inverted honk 17 ms later. Oww. My earses! They hurtses! :-(

You ALSO deal with this with filters. (If the sound's not repetitive, don't try cancel it, duh.)

Re:Uh, no. (1)

Ge10 (803950) | more than 9 years ago | (#13824533)

Late to the party, but I'd like to add this.
This only holds if you ignore the fact that the majority of audible sound does not come directly from the source, but from "re-radiated" sound waves emanating from the (metal) exterior of the case.
How is this significant?
Conduction of sound waves through metal is 10-20 times faster than through air(http://www.newton.dep.anl.gov/askasci/phy00/ph y00058.htm [anl.gov] ), so positional phase variation can be ignored (it's scaled by the same factor). This vastly simplifies the whole process in both hardware and software.
Considerations:
- Only one microphone is needed, although there would have to be multiple "speakers" attached to the case with outputs differing in frequency and magnitude content. Fairly easily accomplished in software
- feedback control. A "long range" fft/wavelet based solution would circumvent this, although "random" noise (as opposed to the predictable whine of motors in fans and hdd's) would still remain at low levels.
- damping issues, although we're mainly interested in the higher frequencies lying well above the resonance point of the case and panels

Position dependence (2, Informative)

addaon (41825) | more than 9 years ago | (#13813161)

Do you sit in the exact same relative position to the speakers (within a quarter of a wavelength or so) at all times? If not, that idea's dead.

Re:Position dependence (3, Informative)

Ratso Baggins (516757) | more than 9 years ago | (#13813252)

and further and perhaps more importantly there's time delay. In order for the wave to be present at your ear at the exact same time as the anti-phase wave, the ant-phase must be calculated and delivered in real time. The only real way to do this today is with an analog amplifier because dealing with the signal digitally introduces delay (eg: A/D) which cannot be compensated for (in that, the event is over before the anti-phase signal is produced.

Re:Position dependence (1)

LordMyren (15499) | more than 9 years ago | (#13814505)

Unless the signal can be predicted, which does not seem wholly unlikely. Most background noises are of a fairly constant nature. Record a couple sample sounds and look at the waveforms very close in; a large number of background sounds are repetitive. These are easy to predict and thus could be cancelled, even given the processing delay.

There's going to be some variation. The technique will not be perfect, but it should be able to achieve rather significant cancellation for many noise sources.

Re:Position dependence (0)

Anonymous Coward | more than 9 years ago | (#13814612)

Noise is by definition not constant in nature.

Re:Position dependence (1)

maxwell demon (590494) | more than 9 years ago | (#13836532)

If e.g. the variation is just that the sound phase changed by half a period, you will not hear a difference, but your noise cancellation will turn into noise amplification. And that's assuming you have an otherwise perfectly predictable sound.

quiet fans aren't too expensive (1)

pokka (557695) | more than 9 years ago | (#13813188)

I think it would be cheaper (and better in the long run) in a rack-mount environment to buy quiet, high-quality fans rather than trying to build a device to counter the noise (not that the high-frequency noises caused by most fans would be easy to cancel anyway).

Re:quiet fans aren't too expensive (2, Informative)

karnal (22275) | more than 9 years ago | (#13813411)

The problem with quiet fans in a server-room / rack style environment is that the quiet fans typically don't move a lot of air.

I've got a 2u switch, with some 60mm fans in a small 6 foot rack in my basement. The fans aren't too loud in and of themselves, but they make a hell of a lot of wind noise and turbulence - because they run at 5000rpm. Now, since I can control the air temperature a little better in my situation than you might in a server room (by not having a crapload of equipment in the rack), I could probably replace them with 2500rpm fans.

But I digress. The people who make this equipment have to have high airflow - they can't have their equipment fail on you, the consumer, even if you abuse the room they're in (temperature wise...)

I've also played with 1u servers, with insanely fast, whiney whooshing fans. They are REQUIRED, if you ever feel the heat they move off the back - you'd know why.

In short, in a server room, there's not much you can do about the noise. Just insulate the room and keep the noise on the inside.

Re:quiet fans aren't too expensive (1)

Kaenneth (82978) | more than 9 years ago | (#13815481)

The was an article not to long ago about underclocking systems, where you can save more power/heat than you slow the system down by, percentage wise. Would the users really notice the servers underclocked by 10%?

Re:quiet fans aren't too expensive (1)

RMH101 (636144) | more than 9 years ago | (#13815954)

dude, you find a way to underclock say, an HP DL360, and i'd be impressed.
well, actually, i probably wouldn't: it has potential warranty impact etc and you don't want to go voiding maintenance contracts.

Re:quiet fans aren't too expensive (1)

Rich0 (548339) | more than 9 years ago | (#13824661)

In low-profile servers the fans are also needed for redundancy. I think the 2U HP G3 proliant I've played with had around 7 fans - each pretty noisy. They were hot-swappable, and arranged side-by-side along the entire width of the server. They probably moved a ton of air in this way (no way for air to recirculate), and probably had redundancy factored in so that if one or two failed it wouldn't be the end of the world.

High-end servers can tolerate the loss of just about any part other than the CPU or motherboard, and all of the fault-tolerant parts can be hot-swapped for minimum downtime. Sure, you should have backups, but it is very satisfying emotionally just to pull out the drive with the flashing LED and plug in a new one and not have to touch a setting on the entire system.

Re:quiet fans aren't too expensive (1)

karnal (22275) | more than 9 years ago | (#13835148)

In addition (I know I'm posting way late to this thread) - but I've been told of some really massive boxes that act kind of like the networking switches I'm used to messing with.

You get a passive backplane, add cards. Then you can associate CPU/Memory/Disk or groups of CPU/etc to a certain OS. If one processor fails? There's a spare board to pick up the slack. If a motherboard fails? No problem, spares in the chassis.

That's what I'd call high end! (Please note that some of this is heresay from people better than me who work with this stuff... Apparently high end SUN boxes use this model?)

Bad Idea (1)

poopdeville (841677) | more than 9 years ago | (#13813223)

Don't waste your time implementing this in software. You're not going to be able to get low enough latency to make it work.

Real-time sound (4, Informative)

mbrubeck (73587) | more than 9 years ago | (#13813232)

Your computer's sound input and output are buffered in both software and hardware. This means that there will be a minimum latency measured in tens or hundreds of milliseconds between reading input from the microphone and being able to send corresponding output to the speakers. You can make this latency smaller and more predictable with well-designed hardware, drivers, and applications software, but you'll never be able to do the same "real-time" processing that you can do with dedicated hardware.

Re:Real-time sound (2, Informative)

ivan256 (17499) | more than 9 years ago | (#13813593)

That doesn't matter. You only cancel constant background noise, so you're canceling based on feedback from sound heard earlier. That's how the headphones work too. (You don't think they have instantanious electronics do you? Even anlog signals have latency.) The real problem comes with phase alignment, which will only be possible at certain points, not everywhere. If you use headphones you could probably do noise cancelation in software without a problem. It would just be fussy, and you'd have to tweak the settings all the time to keep the phase right.

Re:Real-time sound (2, Informative)

munpfazy (694689) | more than 9 years ago | (#13814369)

>That doesn't matter. You only cancel
>constant background noise,
> so you're canceling based on feedback
>from sound heard earlier.
> That's how the headphones work too.

But there's a big difference between trying to match the phase of a signal using analog parts with an intrinsic bandwidth of MHz and trying to match the phase of a signal when you're latency is several ms at best and varies wildly depending on what the computer is doing.

If the latency were constant to within a small fraction of the period of the highest frequency you need to cancel, then you could do it. But you'll be hard pressed to get there using a multi-tasking OS on a standard laptop.

To make a super-conservative estimate: let's say you want to compensate for only 100 Hz noise and you demand only that you get the phase right to within 45 degrees. That means you need latency changes to be constant to less than 1.2 ms. That's mighty ambitious for anything but a dedicated real-time system.

One might imagine that if the noise environment changes slowly and you have a great deal of control over everything the computer is doing you might be able to pull it off. But it sure sounds like a lot more work than building it out of dedicated hardware. And the potential for screw-ups - like occasionally getting the phase wrong by more than 90 degrees and generating a positive feedback burst that deafens the user - is pretty scary. You'd have to put some thought into making the system safe.

Re:Real-time sound (1, Insightful)

munpfazy (694689) | more than 9 years ago | (#13814386)

"you're" should of course be "your," to satisfy the grammar fanatics out there.

Re:Real-time sound (2, Interesting)

ivan256 (17499) | more than 9 years ago | (#13816494)

Judicious use of the hardware buffering and some fiddling by the user should be able to overcome the latency deficiency. You just need to write more than your average latency worth of audio to your buffer at a time, and the padding you place at the beginning of your first sample will give you as fine grained control of the phase as you need.

But you'll be hard pressed to get there using a multi-tasking OS on a standard laptop.

It depends on the OS. Some allow you to change kernel code. That lets you do your timing sensitive operations with interrupts disabled. With the right hooks in your DSP driver you may not reduce the latency, but you could practically eliminate the latency jitter (the real problem) during your calculations.

Re:Real-time sound (1)

munpfazy (694689) | more than 9 years ago | (#13823048)

Good points.

You're absolutely right. Still not the easiest way to do it, by any means, but perhaps not so daunting after all.

Re:Real-time sound (2, Interesting)

Aaron Denney (123626) | more than 9 years ago | (#13814383)

> You only cancel constant background noise, so you're
> canceling based on feedback from sound heard earlier. That's how the headphones
> work too.

Actually, it isn't. You can cancel one-tone that way unless you constantly do a
windowed FFT.

> (You don't think they have instantanious electronics do you? Even anlog signals > have latency.)

Not instananeous, but orders of magnitude faster than digital. Most do in fact just invert the signal. Headphones make the sound directional enough so that it can work.

> The real problem comes with phase alignment, which will only be possible at
> certain points, not everywhere.

Correct. With enough speakers and microphones it might be possible over fairly broad areas, but the variable latencies kill you.

Too slow (2, Insightful)

QuietRiot (16908) | more than 9 years ago | (#13813248)

Software would generally be too slow. A DSP-based sound card could potentially be programmed to do phase-inversion and time-slew (to account for distance) but an ordinary desktop machine would generally need to be very fast and incorporate real time extensions in the kernel. This is the reason you generally find hardware-only solutions (and in headphones for the reasons mentioned in a peer post). Of course I could be way off....

Re:Too slow (0, Troll)

Profane Motherfucker (564659) | more than 9 years ago | (#13813997)

Fast like 3 ghz fast? Is that fast enough? People have been saying this stuff for a long time. You can do a lot with 3 ghz. I think that will suffice.

Re:Too slow (1)

gothzilla (676407) | more than 9 years ago | (#13814132)

No, it's not. Sound has to pass through too many places to ever have a low enough latency to work as a sound cancelling device. I have a 3GHz system with a good sound card and I have to set my latency to 0.04 seconds in audio apps to avoid chopping. That's way too long for sound cancellation.
A 40ms cycle equates to a 25Hz tone. You'd be able to cancel anything below 25Hz.
To cancel anything below 10kHz you would have to have less than 0.0001 seconds of latency.

Re:Too slow (1)

Thalagyrt (851883) | more than 9 years ago | (#13814632)

I get 2 ms latency with my Audigy, but that's only for recording purposes using ASIO. Not to mention it eats up a hefty bit of CPU time when I'm doing that, and I'm on a dual 3.2 GHz Xeon system... Outside of my recording software I don't know what kind of latency it gets, probably something like 100 milliseconds.

I'm just reinforcing your point, it's possible to get two milliseconds in software, but anything below that is pushing it. Some of the really high end systems (Echo Layla for example) can get less than one millisecond latency using ASIO or WDM, but those are just that - high end cards which run upwards of $600. This of course doesn't even cover the issue of speaker placement and processor time...

Re:Too slow (1)

Guspaz (556486) | more than 9 years ago | (#13814639)

You can't compare audio editing apps to a dedicated software DSP. One is generalized and probably not optimized for realtime audio work, and the other is the opposite.

You forget also that there are hardware programmable DSPs in modern computers; Creative soundcards, for one thing, and all modern videocards.

I actually recall reading an article a while back on doing audio processing on videocards. This was part of the growing trend of using videocards as math co-processors or DSPs.

Assuming you could do the processing right on the soundcard, and perhaps do this inside a kernel-level driver, you can potentially get extremely low latency. Of course you'd be monopolizing the soundcard.

So you think you're fast....... (2, Interesting)

QuietRiot (16908) | more than 9 years ago | (#13814719)

I'm sure that would be fine. It's your audio capture device, the pipelines on the card, DMA transfers, bus speed/contention, and system schedulers that are the problem. Oh yeah. All *that* stuff.... And then you need to get back through the bus, card pipelines and out through the DAC to generate output. Phew!

Dedicated, you'd probably be fine at 100Mhz or less with the right [embedded : most likely hand coded assembly] software. Most modern desktops have so much crap running all the time however that those precious CPU cycles dissapear very quickly. Even if you could do it, there'd probably be gaps or delays without some nicely written double or triple buffering techniques. These things take time and then therefore kill what you set out to do.....

Actually - If the microphone was placed very close to the source, you may be able to generate some anti-sound "down range" (ie. Your desk) and the latency could be compensated for in that regard. It would take some fine tuning - in fact another microphone at the place where you need the quiet could be used for the system to tune itself. (This of course is assuming there are no walls in the room for the sound to bounce off of so that you aren't trying to defeat 17 "sources" simultaneously).

I'm not claiming any authority on this or saying it can't be done, just stating that it's probably quite a bit more complicated than it may look at first glance. Real time [wikipedia.org] work is not something most "normal" OSes are setup to do. It can be done, but for things to be faster than sound you've got to get your latency WAY WAY WAY down.

http://en.wikipedia.org/wiki/Real_time [wikipedia.org]
http://en.wikipedia.org/wiki/Real-time_computing [wikipedia.org]
http://en.wikipedia.org/wiki/Real-time_operating_s ystem [wikipedia.org]
http://en.wikipedia.org/wiki/Audio_signal_processi ng [wikipedia.org]
http://en.wikipedia.org/wiki/Noise_cancellation [wikipedia.org]
http://slashdot.org/article.pl?sid=04/05/27/164125 4 [slashdot.org]

Re:Too slow (1)

Vo0k (760020) | more than 9 years ago | (#13815077)

Yep. 3GHz would suffice for noise cancellation. Not much more though. Someone walks in, and your game framerate drops by half. You start up Firefox and suddenly noise levels in the room rise as noise cancellation stops working...

Re:Too slow (2, Informative)

Grab (126025) | more than 9 years ago | (#13815542)

I'm afraid you need more hardware experience... :-/

That's certainly fast enough to do "output = -input;". Your problem though is converting analogue voltage to "input", reading "input", writing "output" and converting "output" to analogue voltage.

The *best* soundcards currently available are 96kHz. Nyquist says that you can only reproduce a frequency of 0.5 x sample rate. But that's theoretical-only - to get a decent approximation takes you to more like 0.1 x sample rate. Which means you can accurately reproduce sounds up to 9.6kHz. Probably OK for fixed noises like motors, but not much good for white noise.

But even then, you've got another problem of time delay. The best real-time digital sound processor takes 1 sample time to read data and 1 sample time to process it. (There's also write time, but you can combine that with processing time, if we're assuming the theoretically-best system.) So you've got 2 samples delay, which is 0.02ms. That's acceptable. PCs though typically have a time delay of around 2ms in reading data (and that's on a *good* system). This means that any sound you output will be 2ms behind. Combining them gives a resultant noise at 500Hz. You can use prediction to reduce that, but the limit of the time delay means you'll never be able to noise-cancel at more than 500Hz.

In other words, using a PC for noise-cancelling is useless, and the OP is a fucking dipshit.

In retaliation, I'm tempted to post an "Ask Slashdot" for "Why can't we build space elevators today? After all, we only need a long rope, and the US wire-making industry churns out miles of steel cable every year. That should be fine, shouldn't it?" ;-)

Grab.

why not... (4, Funny)

croddy (659025) | more than 9 years ago | (#13813436)

why not take the input from the mic, reverse-phase it via software, and output it through the speaker? well, i suppose the howling, squealing feedback would make you forget about the server fans for a few seconds, but i suspect it would just end up giving you a bigger headache in the long run.

Not in planes... (1)

mangu (126918) | more than 9 years ago | (#13813437)

I once had some earphones with noise cancelling built in. They were made by Akai, had a reasonable quality sound for the price, but, being made for portability rather than sturdiness, broke apart in less than a year.


I tried using them in planes, but always got an irate flight attendant demanding me to turn them off. Those people are very suspicious of any non-conventional electronic equipment. Stupid, because those analog phones were certainly less dangerous to flight equimpent than the digital hardware, including notebook computers, that they allow on board. If I worked aboard an airplane, my darwinian instincts would make me study enough electronics to know which kind of equipment should be turned off...

Re:Not in planes... (1)

croddy (659025) | more than 9 years ago | (#13813466)

funny, that story.

of course, all those in-flight catalogs selling noise-canceling headphones -- not to mention all the people i've seen using them on flight after flight after flight -- i dunno, it kind of makes me wonder if you're not just lying through your teeth.

Re:Not in planes... (1)

mangu (126918) | more than 9 years ago | (#13813699)

it kind of makes me wonder if you're not just lying through your teeth.


No, we are just thinking about different times. I got the first noise-cancelling phones I ever saw, this was in 1999.


Of course, instead of blaming the electronics passengers carry on board, they should first try to reexamine maintenance procedures. Did you know that, when pilots report problems, in 50% of the cases, maintenance can't find the cause of the problem? [usynaptics.com] This means that one half of the airplanes that have potentially harmful problems keep flying unrepaired.

Re:Not in planes... (1, Interesting)

Anonymous Coward | more than 9 years ago | (#13814162)

Did you know that, when pilots report problems, in 50% of the cases, maintenance can't find the cause of the problem? This means that one half of the airplanes that have potentially harmful problems keep flying unrepaired.

No it doesn't. It means that 50% of the time problems are reported by pilots, maintence can't find the problem.

Your factoid says nothing about: The harmfulness of the reported problems, the rate at which the problems are reported by pilots, and if pilots ever score false poisitves reporting problems. All of these factors would be needed to arrive at your "half of the airplanes ..." conclusion, and these are factors you have not established.

Re:Not in planes... (1)

sartin (238198) | more than 9 years ago | (#13817514)

No, we are just thinking about different times. I got the first noise-cancelling phones I ever saw, this was in 1999.

I've been using noise cancelling headphones on planes 1996 or 1997 and never had problems with flight attendants demanding I turn them off during normal flight. Of course, they want them (and all other electronics) off during take off and landing. I have only had two kinds of problem with them on planes. Flight attendants used to assume I couldn't hear them because I was wearing headphones, so I would pull one headphone away from my ear so they knew I could hear them. These days most flight attendants grok noise cancelling headphones and I rarely have to even do that. The other problem is that I sometimes speak too softly because I can hear them so much better.

Re:Not in planes... (1)

HalWasRight (857007) | more than 9 years ago | (#13813553)

but always got an irate flight attendant demanding me to turn them off.

What country was this? I've worn mine accross North America and Europe with never a problem, me along with half the plane on some flights. Just don't whip them out in the first or last ten minutes, and no one should stress.

Re:Not in planes... (1)

hey! (33014) | more than 9 years ago | (#13815657)

What country was this?

Riddle: Everyone has been there, but nobody can go there.

Re:Not in planes... (0)

Anonymous Coward | more than 9 years ago | (#13813594)

And anything that doesn't have an antenna shouldn't really be a problem. No equipment in an airplane is all that sensitive.

My child once talked for eight hours straight ... (3, Funny)

joelsanda (619660) | more than 9 years ago | (#13813550)

... on a road trip across the West. Eight solid hours of a four year old pontificating. I searched the car high and low for the travel headphones so I could get a break with my MP3 player. Couldn't find them and the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.

This is a cool idea.

Re:My child once talked for eight hours straight . (1)

/dev/trash (182850) | more than 9 years ago | (#13813630)

Your poor child. I hope you have money saved for the therapist.

Re:My child once talked for eight hours straight . (2, Funny)

joelsanda (619660) | more than 9 years ago | (#13813943)

Your poor child. I hope you have money saved for the therapist.

Yeah, for me. He got that from his mother.

Re:My child once talked for eight hours straight . (1)

John Harrison (223649) | more than 9 years ago | (#13813702)

the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.

Now that is an odd combination. Where on earth were you driving? It is pretty hard to go for eight hours (even out west) and not find a place that will sell headphones. Even places as obscure as Cokeville, WY have them at truckstops.

Re:My child once talked for eight hours straight . (1)

joelsanda (619660) | more than 9 years ago | (#13813949)

I'm from the American West and have literally driven all over it. The combination of roads we took in Idaho, Utah, Colorado and Wyoming produced a bizarre combination of social sights and incredible natural beauty. One convenience store carried knives, Mormon cookbooks, and beer. No headphones.

Re:My child once talked for eight hours straight . (1)

John Harrison (223649) | more than 9 years ago | (#13817245)

I am also from the "American West" as you call it. I have driven to many out of the way places and find it hard to imagine that you couldn't easily find headphones. I do believe that you could find many stores that don't carry them.

Re:My child once talked for eight hours straight . (1)

joelsanda (619660) | more than 9 years ago | (#13817304)

I am also from the "American West" as you call it. I have driven to many out of the way places and find it hard to imagine that you couldn't easily find headphones. I do believe that you could find many stores that don't carry them.

Wow, I think this is the second person to have questioned that. Trust me ... I drove the 600 miles that day. There were headphones available in our town of departure and in the town we arrived in, but nothing in between.

The southwestern corner of Wyoming, where one can drive in Idaho, Wyoming, Utah and Colorado in one day, had few stops. None had headphones. And this was four years ago, there may now be stores that do sell headphones. But the route chosen was off the beaten path, on highways were some stretches hadn't been resurfaced in years. Granted, I did not stop at every whistle stop along the route.

Re:My child once talked for eight hours straight . (1)

John Harrison (223649) | more than 9 years ago | (#13817874)

The dinky town I mentioned is in souwthwestern Wyoming... I guess you might have a hard time finding anything in say, Randolph or Woodruff, but you really have to be trying to avoid towns with truck stops.

Re:My child once talked for eight hours straight . (1)

joelsanda (619660) | more than 9 years ago | (#13817896)

Yeah, on that particular trip we intentionally avoided interstates and drove the 'thin blue lines' on the maps.

Alcohol, Mormon cookbooks, and knives (0)

Anonymous Coward | more than 9 years ago | (#13813752)

If I was seeing those repeatedly, and a talkative kid, I might get culinary ideas.

Re:My child once talked for eight hours straight . (5, Funny)

OneDeeTenTee (780300) | more than 9 years ago | (#13813967)

the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.

Sounds like a bad day for the Mormons if you're hungry.

Re:My child once talked for eight hours straight . (1)

Zach Garner (74342) | more than 9 years ago | (#13816128)


the only stores for thousands of miles in any direction sold only alcohol, Mormon cookbooks, and knives.


Sounds like a bad day for the Mormons if you're hungry.


Recipe from the Mormon Cookbook:

Mormon Flambé

- 1 Cup 80 Proof Liquor (Cognac is a good choice)
- 3 Slices Mormon Bacon, Diced
- 2 8-Ounce Mormon Steaks

1. Fry Bacon until fat renders out
2. Cook Mormon steaks 4-5 minutes on each side, on Medium heat
3. Remove pan from heat
4. Add in warm Liquor (heated in a small saucepan until bubble start to form)
5. Using a long match, ignite Liquor
6. Serve immediately after flames die down.

Yum!

Re:My child once talked for eight hours straight . (1)

RomulusNR (29439) | more than 9 years ago | (#13819243)

Would that be Alferd Packer [wikipedia.org] 's recipe?

Re:My child once talked for eight hours straight . (1)

Vo0k (760020) | more than 9 years ago | (#13814999)

Enough alcohol would suffice. Not good for your driving skills, but works decently as noise cancellation. At least until the next morning.

a hella fast computer (1)

Bastian (66383) | more than 9 years ago | (#13813555)

With present computing technology, the latency involved in running anything through software will be way too high to implement a noise cancellation scheme.

Loud Noise (5, Funny)

DavidLeeRoth (865433) | more than 9 years ago | (#13813609)

I dont know how to noise cancel, but I know how to create a ton! cat /dev/urandom > /dev/dsp :)

Re:Loud Noise (1)

Chrismith (911614) | more than 9 years ago | (#13814064)

Tired of those loud squealing sounds coming from your speakers every time you run cat /dev/urandom > /dev/dsp? Then try our NEW noise-canceling software! Guaranteed to produce complete silence! Now you can run cat /dev/urandom > /dev/dsp without all that distracting sound!

"I bought this product and deployed it throughout my company. Now when my employees dump random data to their speakers, I don't hear a thing! Brilliant!"

Get your urandom-to-dsp noise canceler today! Only $59.95! Order now!

LOL (0)

Anonymous Coward | more than 9 years ago | (#13813717)

Who the hell is green-lighting these moronic questions lately?!

(hint: search around a bit on noise cancelling technology before posting dumb-ass questions)

Fenton Silencer (3, Funny)

the eric conspiracy (20178) | more than 9 years ago | (#13813733)

You want one of these [loc.gov]

Arthur C. Clarke (1)

Kobun (668169) | more than 9 years ago | (#13817863)

Tales from the White Hart, almost a must read. I have a very old printing that was my father's favorite childhood book, and a copy of the most recent reprinting.

http://www.amazon.com/exec/obidos/tg/detail/-/0345 430727/qid=1129651213/sr=8-1/ref=sr_8_xs_ap_i1_xgl 14/104-2949821-4630339?v=glance&s=books&n=507846 [amazon.com]

This is possible with two specific caveats. (3, Insightful)

stvangel (638594) | more than 9 years ago | (#13813784)

The biggest issue is to only have one specific sound source you're trying to muffle. You have to place the microphone as near to the sound source as possible, and the location of your speaker will depend on how long it takes to process the signal. It will also be highly directional unless you rig something up with multiple speakers all aimed in different directions. You will also need to be a certain distance away to allow the reverse-phase sounds to merge and cancel each other out.

The other issue is that it will only work on low pitched sounds, the lower the better. The slower the frequency, the more time you have to do the math and output your opposite signal. High frequency sounds you can pretty much forget about being able to process.

One use for this might be to muffle a single exhaust pipe from a loud motor, but you won't be able to get it to work for general noise. The reason it works in Noise-cancelling headsets is that the microphone is located at the destination of the sound (your ear), rather than at the source. The closer you can get it either end, the better it will work. It's not really worth doing it in Software

One interesting thought about quieting individual fans or motors is to use an Adaptive algorithm. Because most of these devices make a consistent repeating sound, it would be interesting to be able to anticipate the sound source over time and broadcast an estimated calculation before the current sound is even processed and use the processed result to tweak the future estimation. This would work on only reasonably consistent sources and there would be issues with feedback and unexpected noise changes.

Re:This is possible with two specific caveats. (1)

PyroGx1133 (542222) | more than 9 years ago | (#13813871)

That last bit is a great idea. The fans are rather consistent.

Re:This is possible with two specific caveats. (1)

pclminion (145572) | more than 9 years ago | (#13814130)

The other issue is that it will only work on low pitched sounds, the lower the better. The slower the frequency, the more time you have to do the math and output your opposite signal. High frequency sounds you can pretty much forget about being able to process.

This is wrong. It's not the frequency of the sound that matters, but rather the rate of change in the spectrum. Imagine a constant, 15,000 hertz tone. Are you saying this cannot be cancelled? Of course it can. But a noise which has a rapidly and unpredictably changing spectrum cannot be cancelled unless the system is able to react faster than the signal is changing.

White noise, obviously, cannot be cancelled easily unless the system response is as fast as the fastest phasing component. But not all noise is white.

Re:This is possible with two specific caveats. (1)

alienw (585907) | more than 9 years ago | (#13814281)

This has nothing to do with the system response time (which is fast enough), and everything to do with the frequency. Higher frequencies have shorter wavelengths and are much more directional. A sound with a frequency of 40Hz will have a wavelength of 8.6 meters. A sound with a frequency of 20 kHz will have a wavelength of 17 millimeters, about 500 times shorter.

A system can self-tune over time. (1)

Ayanami Rei (621112) | more than 9 years ago | (#13814635)

The system could slew phase until the desired cancelation is achieved at some arbitrarily high frequency.
It is the rate of change of the parameters of the system (whether in time or frequency space) to which it must adapt that ultimately governs its abilities.
Fan noise is fairly stationary... so.

However there are all sorts of other issues which can not be easily solved (microphone/speaker placement, limited affected area, etc.).

Re:A system can self-tune over time. (0)

Anonymous Coward | more than 9 years ago | (#13817453)

Well yes, but I tend to sit in pretty much the same place relative to my fan-noise-enhanced PC most of the time.

Maybe the combination of off-by-n-cycles noise cancelling combined with a simple scrollwheel powered adjustment for me to tweak when sitting in the one true place would actually be Good Enough(TM) and be a really nice thing to have.

If anybody implements it, let me know!

Re:This is possible with two specific caveats. (1)

pclminion (145572) | more than 9 years ago | (#13814641)

Higher frequencies have shorter wavelengths and are much more directional.

Yes, but your point is? There are sound cancellation systems in service which operate over the entire audible range. So clearly this is possible. As you said, latency is not necessarily a problem. So the cancellation may occur within a specific volume, not everywhere, but that's fine as long as the destructive interference occurs near the listener's ear.

My point is that the spectral variations of certain types of sounds are predictable and thus cancellable, not everywhere but at least in the places that matter.

Hey, it's an amplifier ... (0)

ja (14684) | more than 9 years ago | (#13814237)

If you want to model an amplifier in software, here it is:

output = input * gain;

If gain is negative, the output will be inverted (or alternatively you could just swap the connections to your headphones or microphones.)

As for software emulation of glueing microphones on a pair of headphones and fitting energy efficient electronics in a tiny box, I don't think it will work :)

Why did this get approved? (3, Informative)

Refrozen (833543) | more than 9 years ago | (#13814712)

This isn't Slashdot worthy material, but I'll answer it with some information anyways.

The key to noise cancelling is direction. The inversed noise has to be travelling in the same direction the noise otherwise would, and it has to be inverted and spat out at almost the exact same time.

While the speed issue isn't a problem, the microphone and speakers aren't good for the directionalness. It works well in headphones, because with headphones you have a very specific direction: in to your ear. The microphone can pick up things relatively directional (depending on the type of mic.) but the speakers are made to spread sound, not to aim it.

That and they would have to be in roughly the same location (within a few cm.) for it to work properly.

What I want, is a noise cancelling dome, so two people can go under it, talk, and have no one outside hear anything, that'd be cool.

Re:Why did this get approved? (2, Funny)

AthenianGadfly (798721) | more than 9 years ago | (#13815432)

What I want, is a noise cancelling dome, so two people can go under it, talk, and have no one outside hear anything, that'd be cool.

You know, something like that should be possible to create, using a special new noise-cancelling material. I think they call it "concrete".

Re:Why did this get approved? (1)

Dammital (220641) | more than 9 years ago | (#13817451)

"What I want, is a noise cancelling dome, so two people can go under it, talk, and have no one outside hear anything, that'd be cool."
What you want is the Cone of Silence [tripod.com] .

Re:Why did this get approved? (1)

mph (7675) | more than 9 years ago | (#13820512)

What I want, is a noise cancelling dome, so two people can go under it, talk, and have no one outside hear anything, that'd be cool.
It won't work. HAL can read lips.

Fan-like noise might be cancellable (1)

jimchar (311834) | more than 9 years ago | (#13818011)

I'm not an expert nor have I tried this, but a server will likely be making very predictable and repetitive noise, mostly from its fans.

Given that the sound will be predictable and repeated, can't the noise cancelling software make the same waveform, output it with an adjusted phase?

It may not be necessary to have low-latency from input sampling to output, if there is enough predictability.

LATENCY? (1)

malraid (592373) | more than 9 years ago | (#13818962)

If you have problems with latency, it's just a matter of slowing down the noise, or slowing down the noise source. That way you'll have time for your DSP to process the signals. The coding is left as an excercise to the reader. Basic physics meet ask slashdot!

potential use in VOICE RECOGNITION SOFTWARE too (1)

ClintJCL (264898) | more than 9 years ago | (#13826982)

I have tried out voice recognition software to control Winamp. I yell "pause", and the microphone hears me say "pause" and pauses the music.

The problem is that sometimes the music might make a sound that sounds like the word "pause" as well, thus pausing itself.

Why not simply cancel out "what you hear" coming out of the speakers, from "what is spoken" going into the microphone? Then the voice-recognition software could focus solely on my voice, instead of my voice mixed in with the winamp music....

The possibilities are great.

Alternative solutions? (1)

markov_chain (202465) | more than 9 years ago | (#13827136)

As the other posters said, noice cancelling is really hard, and even when it works, only works to a degree.

Depending on your motivation, other fun technical solutions may apply. Recently I've been running into situations where wireless headsets would've been really useful; for example, in any noisy environment, or situations where the speakers get separated out of earshot. I would love to have some while shopping or hiking with company. Anyone have any recommendations?

What about cancelling jet noise? (1)

goosemagoo (833244) | more than 9 years ago | (#13843990)

Could any of these techniques be used to cancel a specific type of noise?

I live very near a Master Navy Jet Base and the jet noise can be deafening. Many times there are several planes per minute for hours flying just over the treetops while practicing touch and go landings. I've often wondered if it would be possible to do just what the original poster was asking in order to mitigate the ear piercing noise.

Advanced noise cancellation material (1)

scorp1us (235526) | more than 9 years ago | (#13846580)

I sell noise cancellation material and noise cancellation material accessories. See, a lot of the noise you hear is not primary-source noise, it is 2ndary, meaning that you hear mostly reverberations. The primary waves bounce around (becoming 2ndary) and interfere with new primary waves, creating exessive noise. My material is extremely effective at cancelling 2ndary noise and somewhat effective at cancelling primary noise. Even with primary noise uncancelled, cancelling the 2ndary noise has a profound effect on your perception of the primary noise.

The effective pitch range of the material is frommidrange to high frequency. Low frequency (bass) is not as blocked, but dending in the install, it can do a substantial job of deadening the bass.

I sell this material by the yard in 12' wide rolls. It comes in many colors and patterns and is availible in berber and shag textures
Check for New Comments
Slashdot Login

Need an Account?

Forgot your password?