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?
51–60 of 106 posts
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#52Earlier quoted context omitted.
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.
My first thought in reading the question was “if your browser is doing that, your platform architecture has… some room for improvement”.
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#53Earlier quoted context omitted.
> Why does the OS not provide a way to do this? Some do. But you need to have a strong-handed OS team that's willing to push everybody towards their most modern and highly integrated interfaces and sunset their older interfaces. Not everybody wants that in their OS. Some want operating systems that can be pieced together from myriad components maintained by radically different teams, some want to see their API's/inte…
> Some do Which Operating systems do this?
Frankly, I imagine its also available at the system level on Windows (and maybe Android and Linux) but probably only among applications that happen to be using certain audio frameworks/engines.
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#54Earlier quoted context omitted.
I agree with that, but the point I'm trying to make is that audio i/o handling is pretty complicated and application specific. The idea I'm challenging is that "any app that wants microphone input wants this" is dubious. I'd say it's only a small number of audio applications that care about mic input want background noise reduced - and it makes sense for this to be configured per-input stream. Really what would be ni…
I'm honestly having trouble thinking of a case where I wouldn't want this. I'm sure there are some niche cases, but in those cases, the application can specifically request that the OS turn off audio isolation.
Default on vs default off is really just an implementation detail of the API though, as you say.
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#55Earlier quoted context omitted.
I'm honestly having trouble thinking of a case where I wouldn't want this. I'm sure there are some niche cases, but in those cases, the application can specifically request that the OS turn off audio isolation.
Live video or audio chat is basically the only time you do want this. Granted, that’s a big chunk of microphone usage in practice, but any time you are doing higher fidelity audio recording and you have set up the inputs accordingly you absolutely do not want the artefacts introduced by this cancellation. DAWs, audio calibration, and even live audio when you’ve ensured the output cannot impact the recording all would…
If I'm recording a voice memo, or talking to an AI assistant, I would want this. Basically everything I can imagine doing with a PC microphone outside of (!) professional audio recording work.
That last case is important and we agree there needs to be a way to turn it off. I think defaults are really important though.
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#56The technical term that you're looking for is acoustic echo cancellation[1]. It's a fairly common problem in signal processing, and comes up in "simple" devices like telephones too. [1] https://www.mathworks.com/help/audio/ug/acoustic-echo-cancel...
I seem to remember analog telephone lines used a very simple but magic-looking transformer-based circuit of some sort for this purpose. Presumably that worked because they didn’t need to worry about a processing delay?
I'm not aware of anyone doing echo cancellation using an analog circuit, but that doesn't mean no-one did. I guess it's theoretically possible but I don't see how the adaption could work.
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#57It'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?
#58Earlier 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?
> Why does the OS not provide a way to do this? Some do. But you need to have a strong-handed OS team that's willing to push everybody towards their most modern and highly integrated interfaces and sunset their older interfaces. Not everybody wants that in their OS. Some want operating systems that can be pieced together from myriad components maintained by radically different teams, some want to see their API's/inte…
Re: Ask HN: How do browsers isolate internal audio from microphone input?
#59Earlier quoted context omitted.
> Some do Which Operating systems do this?
As others have noted, this is trivial for most macOS and iOS apps to opt in to. Frankly, I imagine its also available at the system level on Windows (and maybe Android and Linux) but probably only among applications that happen to be using certain audio frameworks/engines.
1. https://www.freedesktop.org/wiki/Software/PulseAudio/Documen...