I know how to switch the audio out device using the speaker menu item, but how does one do this from the command line? I'd like to write some shell scripts around this functionality.
I know how to switch the audio out device using the speaker menu item, but how does one do this from the command line? I'd like to write some shell scripts around this functionality.
Have a look at the wiki page for command line Pulseaudio and these 2 commands:
Some (old) examples I found on the web...
Change to jack out:
Enable headset:
Both untested: no usb headset and no jack out to test
This works as a script for me in Ubuntu 11.10:
pacmd "set-default-sink alsa_output.usb-Plantronics_Wireless_Audio_Plantronics_Wireless_Audio-00-Audio.analog-stereo"
pacmd "set-default-source alsa_input.usb-Plantronics_Wireless_Audio_Plantronics_Wireless_Audio-00-Audio.analog-mono"
It sets both the output and input to my wireless headset (assuming that I've plugged in the usb dongle for the headset).
The way I learned the name of the output device (sink) and input device (source) was to use these 2 commands:
pacmd "list-sinks"
pacmd "list-sources"
When you do this, you'll get a ton of info on each sink or source. You want the name, and don't copy the < or > at the beginning and end of the name.
I would really like this script to run automatically whenever I plug in the headset usb dongle. Does anyone know how to do that?
It's kind-of like when you insert media and Ubuntu asks what you want to do with it, but this isn't media: the usb headset dongle is essentially a sound card for the purposes of this script.
How can I assign what happens when a usb sound card is inserted?