Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 2597  / 1 Year ago, thu, december 29, 2022, 10:18:58

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.


More From » sound

 Answers
1

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?


[#43465] Friday, December 30, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beateyra

Total Points: 499
Total Questions: 113
Total Answers: 125

Location: Falkland Islands
Member since Mon, Jul 13, 2020
4 Years ago
;