Set audio in/output with shell command

Hi.
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.

Posted on Aug 12, 2009 8:14 AM

Reply
2 replies

Aug 12, 2009 9:24 AM in response to Tohu

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:
http://code.google.com/p/switchaudio-osx/

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"

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Set audio in/output with shell command

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.