Live data from Hacker News

Ask HN: How do browsers isolate internal audio from microphone input?

news.ycombinator.com

91–100 of 106 posts

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#91
post #41

Earlier 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.

I gave an example, when I'm wearing headphones I don't want this enabled. If I'm recording anything, I probably don't want it on either. If I'm using a virtual output, I don't want AEC to treat that as a loudspeaker.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#92
post #45

Earlier 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?

Others have already pointed out macOS/Linux, here's Windows:

https://learn.microsoft.com/en-us/windows-hardware/drivers/a...

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#93
post #46
post #13

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?

This assumes there is an OS-managed software mixer sitting in the middle of all audio streams between programs and devices. Historically, that wasn't the case, because it would introduce a lot of latency and jitter in the audio. I believe it is still possible for a program to get exclusive access to an audio output device on Windows (WASAPI) and Linux (ALSA).

Historically, true, but nowadays it's pretty much standard for all the big OS.

Being able to get exclusive access/bypass the system via certain means (ASIO would be another) doesn't make it go away.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#94
Have used audio a lot on windows/mac for a long time, and a bit of linux too.

I'd say it depends on the combination of the hardware/software/OS that does pieces of it on how audio routing comes together.

Generally you have to see what's available, how it can or can't be routed, what software or settings could be enabled or added to introduce more flexibility in routing, and then making the audio routing work how you want.

More specifically some datapoints:

SOUND DRIVERS: Part of this can be managed by the sound drivers on the computer. Applications like web browsers can access those settings or list of devices available.

Software drivers can let you pick what's that's playing on a computer, and then specifically in browsers it can vary.

CHANNELS: There are often different channels for everything. Physical headphone/microphone jacks, etc. They all become devices with channels (input and output).

ROUTING: The input into a microphone can be just the voice, and/or system audio. System audio can further be broken down to be specific ones. OBS has some nice examples of this functionality.

ADVANCED ROUTING: There are some audio drivers that are virtual audio drivers that can also help you achieve the audio isolation or workflow folks are after.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#95
post #30
post #7

The way this works (and I'm obviously taking a high level view here) is by comparing what is being played to what is being captured. There is an inherent latency in between what is called the capture stream (the mic) and the reverse stream (what is being output to the speakers, be it people taking or music or whatever), and by finding this latency and comparing, one can cancel the music from the speech captured. With…

This reminds me of: >The missile knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is (whichever is greater), it obtains a difference, or deviation https://knowyourmeme.com/memes/the-missile-knows-where-it-is

Up to a point that text makes a lot of sense for describing a PID controller, which is a form of control that only really looks at error and tries to get it to zero.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#96
So Chrome and Chromium got this cool trick where they block internal audio from your mic. Like, you can be on a Google Meet call and blast a YouTube vid in another tab, and Meet won’t pick it up. No clue how they do it exactly, but since Chromium’s open-source, someone can probably dig into the code for the deets. If anyone knows the techy stuff behind this, spill the beans!

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#97
post #30
post #7

The way this works (and I'm obviously taking a high level view here) is by comparing what is being played to what is being captured. There is an inherent latency in between what is called the capture stream (the mic) and the reverse stream (what is being output to the speakers, be it people taking or music or whatever), and by finding this latency and comparing, one can cancel the music from the speech captured. With…

This reminds me of: >The missile knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is (whichever is greater), it obtains a difference, or deviation https://knowyourmeme.com/memes/the-missile-knows-where-it-is

I've observed that hacker culture exists because DARPA funded institutions like MIT for AI research, because the military wanted the missile to know where it is.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#98
post #30

Earlier quoted context omitted.

This reminds me of: >The missile knows where it is at all times. It knows this because it knows where it isn't. By subtracting where it is from where it isn't, or where it isn't from where it is (whichever is greater), it obtains a difference, or deviation https://knowyourmeme.com/memes/the-missile-knows-where-it-is

Up to a point that text makes a lot of sense for describing a PID controller, which is a form of control that only really looks at error and tries to get it to zero.

>a PID controller, which is a form of control that only really looks at error

As the name implies the PID controller relies on proportional, integral and derivative information about the error. What you mean is a purely P controller, which just relies on the error.

Missiles are also not guided by a PID controller, that would be silly. They (or the guidance computer in the airplane) has to take into account the trajectory of the target and guide the missile in a way to intercept that target, which is not something you can accomplish with just a PID controller.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#99

Earlier quoted context omitted.

Up to a point that text makes a lot of sense for describing a PID controller, which is a form of control that only really looks at error and tries to get it to zero.

>a PID controller, which is a form of control that only really looks at error As the name implies the PID controller relies on proportional, integral and derivative information about the error. What you mean is a purely P controller, which just relies on the error. Missiles are also not guided by a PID controller, that would be silly. They (or the guidance computer in the airplane) has to take into account the trajec…

It wouldn’t surprise me at all if early heat seeking missiles used just a PID controller, since a big part of what makes PID attractive is the ability to implement it with electrical components. Take a pair of IR photodiodes and wire them such that their difference is the error of your PID control, wire the output of the PID to the steering on your missile, and suddenly you have a missile that points at the nearest IR target (on one axis of course).

Modern missiles do better than this, but a missile wired this way with a proximity fuse would hit the target a reasonable amount of the time. Not silly at all if you haven’t invented microcontrollers yet.

Re: Ask HN: How do browsers isolate internal audio from microphone input?

#100

Earlier quoted context omitted.

Up to a point that text makes a lot of sense for describing a PID controller, which is a form of control that only really looks at error and tries to get it to zero.

>a PID controller, which is a form of control that only really looks at error As the name implies the PID controller relies on proportional, integral and derivative information about the error. What you mean is a purely P controller, which just relies on the error. Missiles are also not guided by a PID controller, that would be silly. They (or the guidance computer in the airplane) has to take into account the trajec…

PID or even just PI are often used to control missile airframe roll rate. Pitch and yaw may be more advanced systems, sure.
Post reply on HN