#!/bin/bashĪDAPTER_SINK_NAME=$( pacmd list-sinks | sed -n 's/^.*name: ]*\.usb*\)>$/\1/p' | head -n 1 )ĪDAPTER_SINK_NAME=$( pactl list sinks | sed -n 's/^.*Name: \(.*\.usb.Those who play online games know how important sound can be, both in terms of immersion and gameplay. It might be interesting to have it run whenever the adapter is plugged it. You might want to add the move-sink-input from above. Here's the script providing benefits (1) to (4). Fortunately, pulseaudio will do the right thing and print Failure: Invalid argument once to indicate that. It will try to move all sink inputs, including the combined one which would cause a circular path. Pactl move-sink-input $SINK_ID adapter-soft-volume Pactl move-sink-input $SINK_ID $ADAPTER_SINK_NAME This will adjust what's needed: for SINK_ID in $(pactl list sink-inputs | sed -n 's/^Sink Input #\(*\)$/\1/p') If for any reason you want to start over, first run this to clean up the combined sink: pacmd unload-module module-combineĭon't use the cleanup now if you want to continue Bonus: move currently playing streams to the adapterĬommand above work for new streams, not those already playing. If you run the commands above several times, there will be several combine sinks and the first one will be used, not the last one. Now everything works as requested in the question. Pactl set-default-sink adapter-soft-volume ) pacmd load-module module-combine sink_name=adapter-soft-volume slaves=$ADAPTER_SINK_NAME It's based on Can I use PulseAudio to playback music on two sound cards simultaneously? though the principle is rather to play on "one sound card simultaneously". ( pacmd instead of pactl) which provided (2) and (3) but not always (1). Interestingly, I first used pacmd set-default-sink. Now this will provide points (1) (2) (3) of the question: pactl set-default-sink $ADAPTER_SINK_NAME ADAPTER_SINK_NAME=$( pacmd list-sinks | sed -n 's/^.*name: ]*\.usb*\)>$/\1/p' | head -n 1 )Īlternative using pactl (but do run the export line above or it won't find anything in non-default locales): ADAPTER_SINK_NAME=$( pactl list sinks | sed -n 's/^.*Name: \(.*\.usb.*\)$/\1/p' | head -n 1 ) More automatically, the line below finds the name of the first non-pci adapter, which will work for me and should work in many cases. You can read the output and copy-paste manually the name into a command line: ADAPTER_SINK_NAME=name_in_your_setup To get a list of sinks: pacmd list-sinks | grep name:
![external sound card usb input external sound card usb input](https://cdn.shopify.com/s/files/1/0257/5246/9566/products/2_2e096bf7-462e-4077-a24a-ec2622aaf6c3-847031_800x.jpg)
We'll assume bash and prevent any localization issue by switching to the default locale: export LC_ALL=C First get adapter sink nameįirst one has to figure out the sink name for the adapter. Adapter is "ID 0d8c:000c C-Media Electronics, Inc. System is Ubuntu 14.10 running XFCE 4.10. (4) volume setting for the adapter that can go below 35% without going straight to silence.(3) the physical adapter buttons work on a chosen sound card (here, the adapter).(2) the keyboard volume buttons work on a chosen sound card (here, the adapter).(1) applications play to that adapter by default.I can work around this manually by setting per-application volume limiting (clicking in pavucontrol window), but it's tedious and has to be redone whenever an application starts a new stream. Since the volume is very loud, 35% is just okay for quiet sound sources, unacceptable for loud sources. Setting volume of the external adapter using pavucontrol works but if set below 35% there's no sound at all.When pressed, the system performs the expected actions, but on the internal sound card, not the external adapter.
![external sound card usb input external sound card usb input](https://ae01.alicdn.com/kf/Ha9e3dc3bd793475cb32a577338ee1237A.jpg)
The adapter has physical volume-up,down and toggle-mute buttons.The keyboard volume buttons still operate on the internal sound card, not the external adapter. I can work around this manually by opening pavucontrol: going to "output devices", finding the adapter output and clicking on "set as fallback", and sometimes finding an already playing application in "Playback" tab and changing its sink.
![external sound card usb input external sound card usb input](https://s3-ap-southeast-1.amazonaws.com/a2.datacaciques.com/wm/307176851/778686960/1987025875.jpg)
The applications by default continue to use internal sound card. I'm using an external USB sound adapter on a laptop that has an internal sound card.