2 Replies Latest reply: Aug 12, 2009 9:52 AM by Tohu
Tohu Level 1 (90 points)
I want to switch the systems audio input and output with a shell command. I've found a command that can set the volume. Maybe someone can tell me if this is possible and if so, which command i need.

osascript -e "set Volume 0"

Mac OS X (10.5.8), Allways got the latest updates installed.
  • SillyWilly Level 1 (90 points)
    I think there's a messy way of doing it in AppleScript by addressing the menus in the System Preferences. But if I were you I would have a look at the tool that someone has created here:

    It addresses CoreAudio directly I think to change the input/output method:

    will@Newton:~/Downloads/SwitchAudioSource-v1> ./SwitchAudioSource
    Please specify audio device.
    Usage: ./SwitchAudioSource [-a] [-c] [-t type] -s device_name
    -a : shows all devices
    -c : shows current device

    -t type : device type (input/output/system). Defaults to output.
    -s device_name : sets the audio device to the given device by name

    will@Newton:~/Downloads/SwitchAudioSource-v1> ./SwitchAudioSource -a
    Built-in Microphone (input)
    Built-in Input (input)
    Built-in Output (output)
    will@Newton:~/Downloads/SwitchAudioSource-v1> ./SwitchAudioSource -c
    Built-in Output
    will@Newton:~/Downloads/SwitchAudioSource-v1> ./SwitchAudioSource -t input -s 'Built-in Input'
    input audio device set to "Built-in Input"
  • Tohu Level 1 (90 points)
    Very complicated. Sadly it is only capable to switsh to "Built-in Audio 2 (input)" but not to my other inputs like headset or internal mic.

    But thanks.