C-Command Software Forum

Microphone not selected on first connection

Got one more thing… When I reboot my MacBook (or turn it on from a shutdown) and my headphone is disconnected, first time I connect, it doesn’t switch input audio device (or it might do something, but too early and therefore switch back to the AirPods Max microphone). I do see a gear appear, which I guess is running my shell script:

#!/bin/sh
/opt/homebrew/bin/SwitchAudioSource -t input -s "Antlion Wireless Microphone"
/opt/homebrew/bin/SwitchAudioSource -t output -s "AirPods Max van Derek"

Fix for now is to take off and put on my headphone to make it work. Tried the following three things which all doesn’t work:

  • Click YOUR icon on the menu bar to switch to the headphone, see a gear appear, default input device is however AirPods Max Microphone
  • Click on the popup “AirPods Max is near”, “connect”, also see a gear appear, however the default input device still is the AirPods Max Microphone
  • Switch the audio source from the “volume” pull down, also see a gear appear, but you might have guessed it, still not switching to my other input source.

P.s. it’s easy to reproduce, just disconnect the Airpods Max from the Bluetooth settings screen, then try to reconnect using one of the 3 options above. I checked the Sound → Input screen and I see the input first change to Antlion Wireless Microphone and then MacOS is changing it back to AirPods Max.

I fixed it in my shell script putting a “sleep 2” to the script to make it wait just a little longer.

Thanks for the report. I’m not seeing this issue here so far.

  • Are you saying that it’s not related to the first connection after all? The problem occurs when the Mac is already booted and you disconnect and then reconnect?
  • Where are the AirPods when you try to connect them? Are they already on your head?
  • Does it make a difference whether Automatic Device Switching is enabled or disabled on the Mac?
  • Does it make a difference if you disable your shell script?
  • Is there a difference in behavior between the ToothFairy 2.8 in the App Store and the beta version that I sent you earlier?
  1. It is related to the first connection. When I disconnect it completely (bluetooth → disconnect) and reconnect, I see it switch from my choosen device to Airpods Max Microphone.
  2. Yes on my head
  3. No makes no difference
  4. Your Improve sound quality by disabling audio input from device DOES work, and switches to another microphone. So it first switches to the Airpods Max, and then back to another microphone.

It looks like the Run shell script is triggered too fast, before Mac OS is setting it to the Airpods Max microphone.

I currently have this script:

#!/bin/sh
/opt/homebrew/bin/SwitchAudioSource -t input -s "Antlion Wireless Microphone"
/opt/homebrew/bin/SwitchAudioSource -t output -s "AirPods Max van Derek"
sleep 2
/opt/homebrew/bin/SwitchAudioSource -t input -s "Antlion Wireless Microphone"

When I disconnect from bluetooth (bluetooth → Disconnect), and have the build in microphone as default, and connect by clicking on “your” icon, it will:
Directly switch to Antlion Wireless Microphone
Then switch to Airpods Max Microphone
After that switch back to Antlion Wireless Microphone (due to the SLEEP 2)

This makes what I want work, but it should be better to wait untill the switch by macOS was done, and after that run the shell script.

Sorry, but I still don’t understand this. How is it related to the first connection after boot if it also happens when you manually disconnect and reconnect?

The Improve sound quality by disabling audio input from device option sets the input to what it was before the device was connected. It does this (multiple times, each after a delay) after starting to run the script. So if your script is also setting the input, it will undo what the script did. I don’t see any reason to use this option if you already have a script that explicitly sets the input.

I’m glad that you have a workaround. Since there is no way to know whether or when macOS will change the input, I think it makes sense to put the delay in your script if it cares about this. The alternative would be for ToothFairy to wait a long time, but then scripts that don’t care about this would always run late.