Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] background noise cancelling #68

Open
mksaleem opened this issue Nov 15, 2020 · 9 comments
Open

[Feature Request] background noise cancelling #68

mksaleem opened this issue Nov 15, 2020 · 9 comments
Labels
enhancement New feature or request

Comments

@mksaleem
Copy link

Hi
I am not sure if it possible. I would like to give an idea about cancelling background noise using secondary mic. Many gamers use headsets with microphone next to their mouth while having another mic either build into the Web camera or a laptop. I was wondering is its possible to cancel out background noise using the sample from secondary mic in realtime like noise from vacuum cleaner or kids playing etc.

@lawl lawl added the enhancement New feature or request label Nov 16, 2020
@gitowiec
Copy link

Exactly this! I would like to use this feature to mute my surroundings when I am working. So there would be no need to run any application. Just sample the microphone, do the noise-canceling, and feed results to my earphones.

@lawl
Copy link
Contributor

lawl commented Mar 31, 2021

@gitowiec that's not possible, and i don't think that's what @mksaleem was asking for. You want active noise cancellation on your headphones, and (one of) the reason(s) you can't just do that in software on your PC is because it's simply too slow to work. The latency requirements for this are extreme.

@gitowiec
Copy link

Thank you for such a quick response. I didn't know that modern PCs are too slow for such tasks. When I recall headphones with built-in noise cancelation they are small devices. Where is the computational power hiding in such small devices, I would ask.

@gitowiec
Copy link

Hmmm but @mksaleem said "like noise from vacuum cleaner or kids playing" - that is why I connected it with ANC in headphones...

@lawl
Copy link
Contributor

lawl commented Mar 31, 2021

As far as I know it's not that the processor itself is too slow. But the input doesn't go from your microphone magically into your processor. It needs to go through USB, the Kernel, etc. all of this introduces latency. By the time the inverted signal is back in your headphones, it's too late. But, I'm also not an expert on this, so if anyone proves me wrong, i'd be very happy. But this is why you need dedicated hardware in your earphones to do this.

What the issue is talking about is using a secondary microphone to pick up the background noise and then denoise your primary microphone. If you place the secondary microphone farther away from your mouth, then your speech signal will be higher on your primary than on your secondary and you can to some degree cancel out the noise. This does not have such extreme latency requirements, because you are not constrained by physics to do all of this between the time the sound waves travel from the microphone to your ear.

@lawl
Copy link
Contributor

lawl commented Mar 31, 2021

@ZurMaD this is litterally what noisetorch is doing. cleaning it up via AI. in realtime. but that's not what this issue is about.

@mksaleem
Copy link
Author

What the issue is talking about is using a secondary microphone to pick up the background noise and then denoise your primary microphone. If you place the secondary microphone farther away from your mouth, then your speech signal will be higher on your primary than on your secondary and you can to some degree cancel out the noise. This does not have such extreme latency requirements, because you are not constrained by physics to do all of this between the time the sound waves travel from the microphone to your ear.

This is actually was I was originally talking about and you understood me correctly. I hope it's possible and hopefully will see it soon.

I have tried Krisp in Windows with discord and in my opinion Noisetorch works better.

@VBelozyorov
Copy link

VBelozyorov commented Feb 9, 2022

Am I correct with assumption that when it will be implemented, it will efficiently cancel voice sound from other people in the room, for example?

@polarathene
Copy link

This is actually was I was originally talking about and you understood me correctly.

There is a difference between the two scenarios with capturing your environment:

  • To better isolate your voice before it is sent over the network to the listener.
  • Performing the same isolation approach to cancel out the audio by sending to your headphones.

The headphones scenario doesn't handle latency as well. You need to produce sound that cancels out the sound you're targeting, but if you can't minimize that latency window enough, you'd not be able to act in time.

An analogy might be if you put on VR headset, where an object such as a ball is thrown to you at a random interval, and you need to catch the ball. If you are relying on visual cue and that visual cue is delayed too much, you will miss each time due to the latency difference not being small enough for you to react.

Whereas with the microphone to capture your voice for chat, if latency were problematic you might have some desync from video (if any), which can look off; otherwise for a a voice only call it's far less likely to be noticeable.


When I recall headphones with built-in noise cancelation they are small devices. Where is the computational power hiding in such small devices, I would ask.

This was mostly answered already.

The device doesn't need to run a generic operating system either, the hardware often has firmware (similar to software) or leverages hardware specialized for a task (like your GPU for graphics, Wifi/bluetooth radios for wireless), often a DSP for handling the audio and presumably for the recent AI based models, some small NPU.

Basically, the product is optimized/tailored for what it does best. Much like how a GPU vs CPU excel at different tasks.


FWIW, I am not too knowledgeable about audio. I do not know what the required latency target is for pulling off noise cancellation effectively.

Pipewire does have an echo cancellation plug-in apparently (although I've heard it's not perfect) which should perform this functionality with the two mics AFAIK. You can probably try set that up to check how it compares from a mic and to headphones?


cancel voice sound from other people in the room, for example?

I haven't tried it but the impression I get is it may help minimize it but not to expect too much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants