8

When plugging a USB sound card may sometimes cause the current audio output (ie. Banshee and PC speakers) to switch immediately. But the volume controls (sound widget in systray, volume keyboard keys) are stuck on the old sound card.

Plug a soundcard and amplifier while the volume is set to ultra high for the pc speakers. You can't control the volume without opening the sound settings or alsamixer. This could probably cause neighbour disturbance in some countries. You can't control it with the sound widget of the systray nor the volume keyboard keys.

How to disable auto switch of hardware audio output, or enable auto switch of software volume controls ? It would be great to make the software behaviour consistent with the hardware's.

Ubuntu 11.10 vanilla up to date.

  • Not a solution, but one workaround is to plug and unplug headphones. This forces a toggle of the controls. – RobotHumans Mar 20 '12 at 9:05
  • Instead of hotplugging, again this is a band aid solution, perhaps you can leave it plugged in and when not in use manually switch its profile to 'off'? – AyaneForever May 10 '12 at 19:38
  • 3
    Third band-aid solution: turn down the hardware volume on your usb sound card prior to plugging it in--generally the best practice with all audio devices (digital and analog) is to zero all levels before hitching things together. – adempewolff May 24 '12 at 9:32
2

You can achive what you want by using an udev rule that is written to act upon certain events. In this case these events are to plug usb sound card and to unplug it. According to this forum answer, possible solution is like following:

  1. Open the file that has usb sound card udev rules:

    sudo -H nautilus /etc/udev/rules.d/10-usb-sound-card.rules
    
  2. Paste and copy

    KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf"
    
    KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"
    
  3. Save the file and give

    sudo udevadm trigger --action=add /etc/udev/rules.d/10-usb-sound-card.rules
    

command. Then test this rule by pluging and unpluging your usb sound card.

I hope this will help you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.