I have a Dell Inspiron 3650 desktop running Microsoft Windows 10 Pro Version 10.0.18363 Build 18363.
I am using NAudio to mute and unmute my USB headset microphone programmatically using:
MicrophoneDevice.AudioEndpointVolume.Mute = True
MicrophoneDevice.AudioEndpointVolume.Mute = False
First, I need to show some screen captures that will help in understanding the problem and at the very bottom of this post I will ask questions so please bear with me.
In my system tray I have a speaker icon for “Dell Audio” which allows access to the adjustments of USB Headset with microphone.
This will display the dialog with the “Mute Checkbox”.
NAudio will check or uncheck the checkbox above without any problem using the following code:
MicrophoneDevice.AudioEndpointVolume.Mute = True
MicrophoneDevice.AudioEndpointVolume.Mute = False
So far so good, so let’s look now at the Headset’s Mute button:
The Behaviors
When NAudio mutes the Microphone the checkbox is checked rendering the Headset’s microphone mute button totally useless until NAudio is told to unmute which unchecks the checkbox and returns control to the Headset’s Mute Button. This is behavior I expect.
The problem is that when I Mute or Unmute with the Headset’s Mute Button it does not turn the checkbox on and off. This is what I would call unidirectional control of muting. What I need is Bidirectional muting.
You may ask: Why Do I Need Bidirectional Muting?
I am working on a voice driven program for the blind and I can't expect them to be able to turn off a checkbox in settings no more than I can have a visual queue showing them if the microphone is on or off. The only feedback I can give is sound effects and the computer talking to them.
Use Case Scenario
I know that was a mouth full but nevertheless an actual case I have run into.
Here is some very simplified code
Private Sub SpeechRecognition_SpeechRecognized(sender As Object, e As SpeechRecognizedEventArgs) Handles SpeechRecognition.SpeechRecognized
MicrophoneDevice.AudioEndpointVolume.Mute = True
My.Computer.Audio.Play(SoundsPath & "speaking.wav", AudioPlayMode.Background)
ModuleSystemVoice.Speak("Dictation has been stopped", 3)
''''''' If you uncomment the line below the microphone is unconditionally un-muted until
''''''' the user mutes it with the headset's mute button but in the mean time background
'''''''noise in the room could falsely trigger another SpeechRecognition_SpeechRecognized
'''''''event.
'''''''MicrophoneDevice.AudioEndpointVolume.Mute = False
End Sub
My Questions
I have a workaround using Microphone Volume 0-31 where:
Muted = 0
Unmuted = My.Settings.LastVolumeLevel
I would like your advice or opinion even if the result is “It’s Impossible using Headset Mute Button”
Thank you all in advance.
Found this trying to solve similar problem. I suspect your headset, like mine, has an inline mute button (image is blocked from work computer). That button mutes your microphone at the headset controller, not via Windows control. This makes the headset plug-and-play for any OS, rather than requiring drivers.
I'm trying to work around it by creating another hardware mute button to toggle Windows mic mute (easy) and a mute light that shows Windows mic mute status (near impossible).