wbolster / nothing-to-say

gnome shell extension to only unmute the microphone when you have something to say
GNU General Public License v2.0
249 stars 23 forks source link

Mute Multiple Microphones #32

Open grahamwhiteuk opened 3 years ago

grahamwhiteuk commented 3 years ago

This extension is perfect for me except that I have two microphones attached to my laptop. There's the default microphone on the laptop and there's an additional microphone connected via USB (as attached to a web cam). The mute button only appears to mute the default microphone, which may not be the one I'm using. I wonder if it's possible to update the extension in order to mute all microphones? A further enhancement might allow the user to configure which of their microphones would get muted by the extension but for me the simple case of mute and unmute all microphone devices would work wonderfully. Thanks for your work on this.

wbolster commented 3 years ago

yep i agree that it would be best to keep it simple and always mute/unmute all microphones.

iPablo commented 3 years ago

Hi @wbolster, thank you for the work you are doing here. I would like to know if you intend to add this functionality to the roadmap.

wbolster commented 3 years ago

🤣 there is no roadmap but if there was any this would be on it. i wrote above that i think this would be sensible behaviour.

(i have not actively worked on this project in a long time)

grahamwhiteuk commented 3 years ago

What's the best way forward? Are you starting up again or are we talking fork or pull request? I see the one open PR is now outdated so would be good to see some commentary on the prospects for this work. Thanks again for your work here, love the idea.

wbolster commented 3 years ago

always taking reasonable pull requests that don't appear as 'yolo i suspect this code maybe has a chance of working sometimes on the developer's machine, perhaps' 🤪

wbolster commented 3 years ago

practically speaking, changing this extension to mute/unmute all mics, with a reasonable investigation in how it would work in case things are not in sync, and the tradeoffs made etc, would be a welcome enhancement

brianjmurrell commented 2 years ago

So how does the extension currently decide which mic to mute when there are multiple? Is it just totally random choice among them? Or is it deterministic in some way?

I came here from #46, so just knowing if mic choice is deterministic and what determines it would be sufficient.

urmilparikh commented 2 years ago

So how does the extension currently decide which mic to mute when there are multiple? Is it just totally random choice among them? Or is it deterministic in some way?

I came here from #46, so just knowing if mic choice is deterministic and what determines it would be sufficient.

It uses default mic:

this.mixer_control = new Gvc.MixerControl({ name: "Nothing to say" });
this.stream = this.mixer_control.get_default_source();

May be, there could be an option to mute / unmute all mics but monitor only default mic?

brianjmurrell commented 2 years ago

It uses default mic:

Does it? My current PA fallback configuration:

image

so WH-CH710N is the fallback, yet when I toggle: image to image:

image

It toggles the (non-fallback) USB Audio Headset input to un-muted.

Am I misunderstanding something?

brianjmurrell commented 2 years ago

Any further information I can provide here?

Unfortunately the unpredictability (and control -- even by just setting the desired input as the fallback) of which input this will actually toggle makes it quite unusable. I don't actually use it any more. I use the input mute control on PA volume control tool instead, as cumbersome as it is.

grahamwhiteuk commented 2 years ago

This paper adds some weight to the argument of muting microphones at the OS level instead of in apps: Are You Really Muted?: A Privacy Analysis of Mute Buttons in Video Conferencing Apps

brianjmurrell commented 2 years ago

@grahamwhiteuk I think we are all here because we agree that trusting apps to mute is like trusting the fox to look after the hen-house.

The problem is that this app isn't working in scenarios of multiple inputs (who doesn't have multiple inputs these days?). It's not even predictably working with the designated default input. Which input it mutes seems to be pretty random or at least non-deterministic.

grahamwhiteuk commented 2 years ago

OK, so I think @wbolster has made it clear already that he's not working on this project (other than the odd small tweak to update the config for compatibility). We should start to consider how we can write a patch and put in a pull request.

brianjmurrell commented 2 years ago

Unfortunately, even though I am a software developer, I don't develop for JS (however, languages are languages, so that is probably not the major hurdle here) more more importantly I am not a GNOME hacker and so not familiar (enough) with the GNOME application development layer.

I am sure with some time (another thing I don't have unfortunately) I could figure it all out, but I lack that time between my day job, real-life and other projects I am working on.

wbolster commented 2 years ago

@brianjmurrell it's actually exactly the same for me. i hacked this thing together 6 years ago or so, and the landscape evolved so much in the mean time that i am pretty much back to square zero.

BenignBeppe commented 2 years ago

I had a look at this (commit above) and think I managed to get it to work by (un)muting all sources. I did some testing on my own machine with three mics (internal, external sound card and webcam) and it seems to work.

The implementation is pretty simple: loop over all sources and set mute, instead of just the default. I haven't touched refresh() which deals with streams since it was a bit hard to immediately see what's going on there. Maybe if @wbolster have time to look at it they would have an easier time. There's probably a bit more work and testing to be done, but at least it's a start.

In general I've found the audio devices being a bit finicky (this is on Ubuntu), where sometimes the active one switches when you connect one, but not always. It might be that this is the root cause of this issue. Using the default source should reasonably control the active input.

wbolster commented 2 years ago

👀 is there any actual reason to have a setting? why not unconditionally do this by default? see https://github.com/wbolster/nothing-to-say/issues/32#issuecomment-790700331

brianjmurrell commented 2 years ago

I think there are going to be use cases where people don't want all of their inputs muted just because they want the mic in their video conference muted.

Somebody could have some other audio processing task going on on their computer in the background when a call comes in, or a video conference starts, for example.

wbolster commented 2 years ago

this extension is supposed to be dead simple. complex audio setups are out of scope.

that said, ‘one mic’ vs ‘all mics’ is conceptually not too complex, but i still think ‘all mics’ should be the default b/c principle of least surprise

grahamwhiteuk commented 2 years ago

I agree. Default to "All Mics". I'm less bothered about whether there's a user setting for it. I don't think I'd use the setting myself but that doesn't mean it's not useful to others. I find it hard to imagine a use case where someone might want to only mute one mic though but my primary use case is conference calls.

grahamwhiteuk commented 2 years ago

I (finally) found time to test out the branch from @BenignBeppe and can confirm it works great for me. @wbolster - would it be possible to have this merged?

benblasco commented 2 years ago

@grahamwhiteuk I think we are all here because we agree that trusting apps to mute is like trusting the fox to look after the hen-house.

The problem is that this app isn't working in scenarios of multiple inputs (who doesn't have multiple inputs these days?). It's not even predictably working with the designated default input. Which input it mutes seems to be pretty random or at least non-deterministic.

FWIW I agree with the selection of the microphone to mute being either random or non-deterministic. I'll see if I can test the proposed fix, but I am scared because the extension has been crashing Gnome altogether for me as per issue #49