vb.netusbmicrophoneheadsetmute

USB Headset Microphone Mute Button is not Synchronized with System Device Microphone Mute Checkbox in Both Directions Using VB.net and NAudio


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.

System Tray Dell Audio Speaker Icon

This will display the dialog with the “Mute Checkbox”.

Dell Audio Dialog Box

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:

Headset 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

  1. The mute checkbox is unchecked, headset mute button is muted.
  2. The User is currently dictating a document.
  3. The User un-mutes microphone and says “Hello World” pauses for a second.
  4. The User says, “Stop Dictation”.
  5. The User mutes the microphone with the headset button (this is the last action the user makes because he/she is done speaking).
  6. The code wants to mute the microphone just in case the user forgot to mute it while the computer speaks to inform the user that it has in fact stopped dictation. The computer says “Dictation was Stopped” (we don’t want the microphone to pick up the computer’s voice in the event that the Headset Speaker volume is too high so we mute).
  7. The code wants to keep the microphone muted until the user un-mutes the microphone with the headset button.
  8. Oops the code can’t keep it muted because the Headset’s Mute Button will remain useless. The only choice the code has is to unmute the microphone.
  9. This is a problem because the last thing the user did or intended to do was to mute the microphone with the Headset Button. As far as the user knows the microphone is still muted. In fact, the microphone is picking up everything in the room because the code had no choice but to unmute the microphone to return control to the Headset.

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

  1. Is there some code Win32 API or whatever that could handle intercepting the Headset’s mute Button?
  2. Is this a fault in the Dell Driver?
  3. Is this a design flaw in Windows 10 driver’s specification for USB devices?

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.


Solution

  • 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).