alsa tips

  • enable usb headset: lsmod | grep snd_usb_audio >/dev/null || modprobe snd_usb_audio

  • list hardware devices:

$ aplay -l
*** List of PLAYBACK Hardware Devices ***
card 0: Generic [HD-Audio Generic], device 0: ALC662 rev3 Analog [ALC662 rev3 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Headset [Logitech USB Headset], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • set default device

    • for instance, to set usb headset above as default edit config file. /etc/asound.conf or $HOME/.asoundrc

    defaults.ctl.card 2
    defaults.pcm.card 2
  • test: $ aplay -D Headset sound.wav

  • test: $ mpg123-alsa -D Headset sound.mp3