Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Technology

Software Noise Cancellation? 38

DangerTenor asks: "As I flew around the world, lusting after my coworker's $300 BOSE Quiet Comfort Noise-cancelling headphones, I looked down at my laptop computer and noticed the built-in microphone. Has anyone written or considered writing software to run noise-cancellation based on the built-in mic?"
This discussion has been archived. No new comments can be posted.

Software Noise Cancellation?

Comments Filter:
  • by quantax ( 12175 ) on Friday November 22, 2002 @11:14PM (#4736979) Homepage
    Here is how noise-dampening works:

    A quick overview of sound; all sounds are comprised of varying frequency, and amplitude pressure waves. A sound dampener 'listens' to a sound, and emits it 180 degrees out of phase. This means the crests and troughs of the 2 waves are overlapped, negating one another.

    The main issue to be overcome is direction and such that shifts the pitch of sounds coming from a computer. Unless you are using a very high quality, wide pickup mic (which are rather expensive), you are probably not going to be able to get enough sound precision to be able to get the damper working effectively. Also, positioning the mic would take a while to get the best location for maximal damping effect for overall sound. This is still work checking out though cause it may yield greater results than I think it will. However, most computer users do not have high quality mics in the first place (and a $20 mic wont cut it). The more mics used, the more effective this would be due to wider sound coverage.
  • by IshanCaspian ( 625325 ) on Friday November 22, 2002 @11:17PM (#4736989) Homepage
    Although previous posters were correct in saying that it's impossible to have the speakers cancel sound on the fly, because the delay would cause the inverse wave to be out of sync, I could definitely see writing some software that would cancel constant or regular, repetitive sounds. My only isse is that the built-in mics are generally very low-quality.

    Has anyone considered writing software to filter a computer's fan? That would be really cool, and probably pretty easy to do...some little tray program that constantly runs the inverse sound over your speakers...hmmm.
    • GOOD LORD (Score:2, Funny)

      by Anonymous Coward
      i swear to god, thats the smartest thing i have ever heard,......and i watch dateline!
    • I love the fan idea, my computer is so noisy that it's started to harm my social life.

      "I don't think I can spend the night again, your computer kept me awake all night last time."

      of course maybe she was just trying to protect my feelings...
      • by Anonymous Coward
        Spending the night with a girl or shutting down your computer...yeah, you made the right choice.
    • Unfortunatly, the noise cancellation technology is not perfect yet. I've read many review about these headphone systems, and everyone claims that there is this white noise that is generated by the headphones. While the noise is quieter than say a jet engine, it's not that quiet when in a quiet room.

      If you canceled the noise of your fans, the question is would the white noise be worse, the same, or better than your fans? This obviously depends on your fans of course. However, my rig has 5 fans, 6 if you include the power supply, and it's already quieter than essentially every other appliance in my house (well, the furnace is quiet actually). I remember reading that the white noise these headphones generate is just as bad as a fridge or something.

      Course, I've never used a set of headphones personally, so I can't say if any of this is really true. I'd like to demo some one day.
    • It would be great if reality were that cooperative, but unfortunately there is no such thing as a "constant or regular, repetitive sound", unless you're talking a digitally-generated sine wave out of a good speaker.

      This become especially noticable with high-pitched sounds (or components of sounds) you are trying to cancel. Suppose for the sake of argument there's a 5,000 Hz sound you are trying to cancel that varies randomly in absolute pitch over the course of a second or two by up to 1%, or +/- 50Hz. (1% is easily detectable with training of any sort, but still a lot of people won't notice it, esp. in a noisy situation like fan noise.) Kick in a fudge factor for the fact that your mic can probably barely "hear" that as it is. If your sound canceller is not instantly reactive, it will "cancel" sound from the past (and it can only react at the speed of sound at best), and you could turn an annoying high pitched sound into an annoying 20-50Hz sound, that for bonus points is phased all over the place with all kinds of fun harmonics. Thanks, but no thanks.

      And this assumes some sort of ideal environment. It's actually quite hopeless because each speaker of the laptop, assuming it even has two, will affect both ears, plus the reflections of each speaker, plus the reflections of the noise. Real noise dampers put one damper on each ear, because the interaction between the two would take a very challenging math problem and make it an impossible one.

      Oh, and the sounds your speaker is making can't reach the mic, either. (Because the sounds can't be cancelled at both of your ears and the mics... in fact, you'll be lucky to manage cancelling the sound at one ear, let alone three places!)

      In short, the laptop noise canceller would be interesting to see what kind of crazy phased noises you could get out of your environment, and could even conceivably be useful in some small degree to someone mining their environment for sound effects (musicians, sound effect artists) as an intriguing filter on the world, but for actual noise cancellation, you might as well just stick your fingers in your ears and hmm loudly.
    • The problem is that each fan is different and teh software would have to have some sort of manual adjustment because of teh varying sound levels from each fan
    • What's a "tray program"? Is that one of those Windows things?
    • Here you go: Is there a correlation between the sound that is coming out of the fan, and the speed in hZ of the fan? The speed of the fan can be measured, and the future speeds of the fan can be predicted using calculus.

      Would using the fan speed, as predicted by some math, help a noise canceller effectively cancel fan noise?

    • It won't work unless you put a speaker right next to the fan, OR you can guarantee an exact distance to both ears from the fan.

      See, not only is the inverse waveform important, but the PHASE as well. Shift ear position 180 degrees out of phase (at 13392 in/s, a 3000 Hz signal will be 180 out of phase by moving 2.232 inches) and the speaker will actually double the sound pressure.

      That's why the noise-cancelling headphones work. They are guaranteed a distance from the sensing microphone to the ear. Also, noise-cancelling devices on machinery work because they are very close to the origination point of the noise, so the inverse waveform is nearly on top of the noise waveform.
  • Just Gotta Say (Score:5, Informative)

    by matt.fotter ( 28412 ) on Friday November 22, 2002 @11:19PM (#4736996) Homepage
    I fly weekly and those Bose headphones were one of the best investments I've made. Really, if you fly with any regularity, burn the cash or the AMEX points.

    Mod me offtopic - those damn headphones are worth it.

  • Lust not Required (Score:4, Informative)

    by Kalak ( 260968 ) on Friday November 22, 2002 @11:20PM (#4736999) Homepage Journal
    NoiseBuster Headset [nctgroupinc.com]. Spent $40 or so on these a year and half ago. Great for the server room.

    http://www.spiritcorp.com/noise_cancellation.htm l for some software. That was a 3 second google search [google.com] for "noise cancellation software". Never used it, but it seems based on the same principles. Not for live listening though.
  • i always just turn the volume down when i want the noise cancel. *nyack nyack*
  • You'd be lucky to be able to cancel the sound already coming in on those built-in mics. They pick up lots of vibrations from the computer itself.
  • There IS a way... (Score:2, Insightful)

    by Ayanami Rei ( 621112 )
    except you'd need a really nice microphone, thus nullifying the effort saved on not buying expensive headphones. But it is possible, unlike what some other naysayers claim. I assume you want to cancel generic PC noise, not everything outside EXCEPT what you want to hear (that is almost impossible to begin without over-ear gadgetry or a fixed-head requirement... get big sweaty headphones instead).

    What some other people here forget is that by-and-large, the noise created by a PC's fans are stationary signals. A second of training to the ambient noise in the room via an omnidirectional mic will allow you to build a frequency profile. Then, you filter the data against this profile to compensate for the ambience. Of course, you keep updating the profile, as noise levels in the room are constantly changing. One problem is that you have to deal with processing the sound in the frequency domain to compensate, so you have to transfer to and from the time domain in chunks. This all has to be accopmlished in realtime (it's not light on the CPU) and it will introduce a short delay, but the shorter that delay, the less effective it will be.

    I think a better solution would be to place the crappy desktop mic (if you aren't using it for telephony) into the case of the PC, where it will work better. Then you could work on reducing the apparent machine noise (including 60Hz hum!)
    • Re:There IS a way... (Score:5, Informative)

      by Jerf ( 17166 ) on Saturday November 23, 2002 @02:57AM (#4737499) Journal
      What some other people here forget is that by-and-large, the noise created by a PC's fans are stationary signals.

      No, they are not.

      Don't take my word for it. Record some and run it through your favorite MP3 player, with a reasonably sized FFT filter going in realtime. Watch the FFT display jerk spasmodically. Even the wiggling isn't as regular as you think; if you could do an FFT of the FFT, you'd see that. It's noise, it really is, and even if it sounds to your ear like it's "the same" noise, your computer hears it as anything but.

      For extra bonus points (and to really enhance your understanding of what noise really is!), open that noise recording in a sound program. Zoom in really tight, until you can see one wave cycle (from 0, to max, to 0, to min, back to 0 again. It may cross 0 a few times in that span, so eyeball it. You can't really be wrong, so it's not that big a deal, as long as the two ends meet up when you're done.) Copy that sound for 1 or 2 seconds worth, and play it. (Copy and paste it twice, highlight that, copy and paste again, and duplicate that; you'll be into seconds in no time.) Take a moment and ask yourself what you expect this to sound like. Then play it. Is that what you expected? Still don't believe me? Take a larger snippet, three or four waves.

      Noise is really, really dynamic, and you can't predict what it is going to do next.

      Oh, and there's no such thing as noise cancellation, by the way, only cancelling certain sounds at certain isolated locations. That's why you need two headphones, one dedicated to each ear, to cancel noise. A single microphone cannot cancel noise for two ears across a set of frequencies, period, especially if it doesn't know where those ears are.

      Again, don't take my word for it, draw it. Draw equally-spaced concentric circles emanating from a point. Draw equally spaced concentric circles of the same size emanating from another point. The distance between the two concentric circles is the frequency, and let's say one circle's lines is the bottom of the signal, and the other the top. The places where the circle touch the sound is canceled (in this hopelessly perfect little world where nothing is interfering with the sound). In the middle of each of the little quadrangles you build, the sound is doubled. You'll see it's impossible to complete and totally cancel the sound unless the two sources are exactly the same... which is not surprising because that's equivalent to preventing it in the first place!

      And lest ye think that you can put your ears at two of the meeting points (again, totally and completely ignoring the sound's interaction with the environment)... draw another set of circles using the same sources, but multiplying the distance between each concentric circle by, say, 8/7s. And 1/3. And 87/34s. And everything in between. All at once.

      Please try these things before trying to pick them apart; human intuition and wave phenomena are notoriously poor bedfellows.
      • I didn't want to start spouting off signal analysis lingo. But apparently around here it gets you karma.

        Okay, you bring up a number of interesting points.
        Record some and run it through your favorite MP3 player, with a reasonably sized FFT filter going in realtime.
        Not a good idea, MP3 encoding tends to filter out some of the noise...
        Watch the FFT display jerk spasmodically. Even the wiggling isn't as regular as you think; if you could do an FFT of the FFT, you'd see that. It's noise, it really is, and even if it sounds to your ear like it's "the same" noise, your computer hears it as anything but.
        But what ultimately matters is what that noise sounds like to the ear, and while we can't eliminate the PC noise entirely, we can compensate for an approximation so that it is all that more pleasing to the human listener. While the traces may "jump around" a lot (which an FFT of an FFT won't indicate clearly), what we want is to have a time-decayed sum of the power spectrum. This averages out (over a few frames) energy drift across bands, and emphasizes the stationary energy that is most annoying. We will probably doing this with overlapping windows, up to, lets say, 50ms long(which more than covers 60Hz hum), and window intervals at 4 times that rate (12.5 ms updating).

        Noise is really, really dynamic, and you can't predict what it is going to do next.

        Exactly. It doesn't autocorrelate, by definition. But then there's the stuff that does...

        Oh, and there's no such thing as noise cancellation, by the way, only cancelling certain sounds at certain isolated locations. That's why you need two headphones, one dedicated to each ear, to cancel noise. A single microphone cannot cancel noise for two ears across a set of frequencies, period, especially if it doesn't know where those ears are.

        Duh. I never said that my idea could lead to noise elimination, just that it could help.

        Again, don't take my word for it, draw it. Draw equally-spaced concentric circles emanating from a point... blah blah blah ...all at once.

        Look, the stuff that we're most interested falls below 200Hz, at this point the sound is fairly omnidirectional. So any intelligent compensation will not be in vain. You don't even care about preserving phase. What you're trying to do just a little compensation, allowing the fan noise to fill out frequencies you attentuate in the signal. (During the processing, you don't touch the complex components of the transformed signal, also make sure to window it the same way you windowed the microphone samples for attenuation). Also, there will be issue with expected trip delay, because you might want to be able to do a dry run and see how much contribution (if any) the sound output has on the input to the mic, and what the system delay is. You might want to purposefully filter the filtering information using a delayed copy of the previously outputed sound. And if you're doing that, you'll have to pay attention to clock phase drift between the input and output sections of whatever sound hardware you have (phase unwrapping... ooh fun).

        Please try these things before trying to pick them apart; human intuition and wave phenomena are notoriously poor bedfellows.

        ?! I've been involved in projects recently doing things like this in relation to positional tracking using PSKs. I'm not offering a magic bullet or anything. But everyone here has such a bad attitude. Give me a break.

        Now as to whether this could become a product marketable to audiophiles... forget it. As to whether it's worth someone's time to write this software because his PC is too noisy... she'd be better off buying quieter fans.

        But it's interesting... not a waste of time if you dig that sort of thing. Just thinking about the response is getting me more excited about it.

  • by Anonymous Coward


  • Won't work (Score:2, Insightful)

    by Cuthalion ( 65550 )
    Okay, the reason it won't work isn't that the microphone is shitty, which it probably is. It's not that the computer isn't fast enough (which it probably is).

    The problem is that the microphone is not near your ear.

    In order for noise cancelling speakers to work, they need to maintain a constant and known spatial relationship with your ears relative to the sound source. The only practical way to do this is to locate them at the ear (that's how noise cancelling headphones work).

    Thus unless the laptop's microphone is at the loci of both your ears, you're not going to do any better than just add to the racket.
    • Yes, with some exceptions.

      It's possible to have noise-cancelling speakers near an annoying sound source. This works best for low-frequency sources, like fans, reciprocating engines, large transformers, and rotating machinery.

  • If you have a Pentium IV or Athlon, you can probably use your computer to make toast too, but it's so impractical, you just wouldn't want to try. Leave it to the specialized devices.

    (unrelated, but interesting) A few years ago, I read about a maker in Europe, maybe Airbus, who was developing a jet with lots of microphones and speakers, so that the entire cabin could have noise-cancellation.
  • because headwize has already been slashdotted by techtv this month please use these google cached links:
    Notes on DIY Electrostatic Headphones [216.239.53.100] Troubleshooting Electrostatic Headphones [216.239.53.100]

"If it ain't broke, don't fix it." - Bert Lantz

Working...