Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
On mac/iOS, you get this using the AVAudioEngine API if you set voiceProcessingEnabled to true on the input node. It corrects for audio being played from all applications on the device.
Ask HN: How do browsers isolate internal audio from microphone input?
31–40 of 106 posts
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#32It's called Acoustic Echo Cancellation. An implementation is included in WebRTC included in Chrome. A FIR filter (1D convolution) is applied to what the browser knows is coming out of the speakers; and this filter is continually optimized to to cancel out as much as possible of what's coming into the microphone (this is a first approximation, the actual algorithm is more involved).
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#33Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
How sure are you that Basically every application wants this? So should there be a flag at the os level for enabling the cancellation? How do you control that flag?
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#34Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#35Earlier quoted context omitted.
Is there any way to apply this outside the browser? Like, is there a version of this that can be used with Pulseaudio?
To spare others from googling: https://docs.pipewire.org/page_module_echo_cancel.html https://wiki.archlinux.org/title/PipeWire/Examples#Echo_canc... If you're still on pulseaudio for some reason, it ships with a similar module named "module-echo-cancel": https://www.freedesktop.org/wiki/Software/PulseAudio/Documen...
[0] https://stackoverflow.com/questions/21795944/remove-known-au...
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#36Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#37Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
the OP pointed out that this only works if he uses a browser monoculture
the OS does have more information than that, it can know what is being played by any/all apps, and what is being picked up by the mic
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#38Earlier quoted context omitted.
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
The OS can have multiple sound input devices for the application to choose from, "raw" and "fuckarounded with"
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#39Earlier quoted context omitted.
It just seems more logical for the OS to do that, rather than the application. Basically every application that uses microphone input will want to do this, and will want to compensate for all audio output of the device, not just its own. Why does the OS not provide a way to do this?
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#40Earlier quoted context omitted.
> Basically every application that uses microphone input will want to do this The OS doesn't have more information about this than applications and it's not that obvious whether an application wants the OS to fuck around with the audio input it sees. Even in the applications where this might be the obvious default behavior, you're wrong - since most listeners don't use loudspeakers at all, and this is not a problem w…
> The OS doesn't have more information about this than applications the OP pointed out that this only works if he uses a browser monoculture the OS does have more information than that, it can know what is being played by any/all apps, and what is being picked up by the mic
fwiw, you only need to know anything about outputs if you are doing AEC. Blind source separation doesn't have that problem and can just process the input stream.