i have a problem that every time when i reconnected my Bose QC35 II the sound balance was to the right instead of balanced in the middle.
So i found a solution on Reddit with the AppleScript but this did not work completely form me because it was throwing errors sometime:
"System Events got an error: Can’t get tab group 1 of window 1 of process \"System Preferences\". Invalid index." number -1719 from tab group 1 of window 1 of process "System Preferences"
original source of the code: https://www.reddit.com/r/apple/comments/34qmn0/is_there_a_shortcut_or_command_to_switch_the_lr/
tell application "System Preferences" activate reveal anchor "output" of pane id "com.apple.preference.sound" end tell tell application "System Events" tell slider 1 of group 1 of tab group 1 of window 1 of process "System Preferences" set value to 0.5 end tell end tell tell application "System Preferences" quit end tell
I made some changes to the code:
tell application "System Preferences" activate reveal anchor "output" of pane id "com.apple.preference.sound" end tell tell application "System Events" tell application process "System Preferences" repeat until exists tab group 1 of window "Sound" end repeat tell slider 1 of group 1 of tab group 1 of window "Sound" set value to 0.5 end tell end tell end tell tell application "System Preferences" quit end tell
i saved my code in
And made a crontab
crontab -e with the value:
*/5 * * * * /usr/bin/osascript ~/Applications/FixSoundBalance.applescript >/dev/null 2>&1
And on Mojave, you need to give the first time permissions to Cron to access Accessibility (under Security & Privacy, tab privacy), after that, it works fine.
When you use the alfredapp https://www.alfredapp.com/, you can set the under
Features -> Default Results -> Extras the checkbox
AppleScripts then when you search for Fix... you get the script as result and you can run it directly. Then you do not need to set a cronjob.
This free app also solves the problem:
Headphones a little off? Noticing your audio isn't quite centred? Enter Balance Lock - it will keep your audio centred and prevent left/right drift.
It's the perfect utility for making sure when plugging and unplugging headphones that the audio stays centred. It was designed out of frustration of the long standing OS X bug where the audio balance can randomly move away from the center.
It's simple to use and runs in the background un-intrusively.
Download it now, completely for free to enjoy perfect audio that is no longer slightly off balance!