How can I find the correct name for my microphone and sound output using aplay or pacmd or something else, to apply in asound.conf?

5,764

If I understand correctly, you want playback on your build in sondcard and capture (microphone) from external USB device.

Your external device is listed as card 2: device 0 and your build in soundcard as card 0: device 0

I think your asound.conf should look something like this:

pcm.!default
{
  playback.pcm
  {
    type hw
    card 0
    device 0
  }

  playback.capture
  {
    type hw
    card 2
    device 0
  }
}
Share:
5,764

Related videos on Youtube

Community
Author by

Community

Updated on September 18, 2022

Comments

  • Community
    Community over 1 year

    I need to write a default mic and default speaker output in the asound.conf config file. But I don't know exactly how I can find my external sound card or microphone device's name, so that on reboot or unplug/plug I don't have to reconfigure it again.

    I tried to find them by using:

    sun@sun-To-be-filled-by-O-E-M:/tmp$ pacmd dump | grep alsa_input
    set-source-volume alsa_input.pci-0000_00_1b.0.analog-stereo 0xddb
    set-source-mute alsa_input.pci-0000_00_1b.0.analog-stereo no
    suspend-source alsa_input.pci-0000_00_1b.0.analog-stereo yes
    set-source-volume alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono 0x9091
    set-source-mute alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono no
    suspend-source alsa_input.usb-0d8c_C-Media_USB_Audio_Device-00-Device.analog-mono yes
    set-source-volume alsa_input.usb-046d_HD_Pro_Webcam_C920_8E9E4FCF-02-C920.analog-stereo 0xfffe
    set-source-mute alsa_input.usb-046d_HD_Pro_Webcam_C920_8E9E4FCF-02-C920.analog-stereo no
    suspend-source alsa_input.usb-046d_HD_Pro_Webcam_C920_8E9E4FCF-02-C920.analog-stereo yes
    set-default-source alsa_input.usb-046d_HD_Pro_Webcam_C920_8E9E4FCF-02-C920.analog-stereo
    

    or:

    sun@sun-To-be-filled-by-O-E-M:/tmp$ aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 1: ALC892 Digital [ALC892 Digital]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 2: Device [C-Media USB Audio Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    But it confused me. Which one is the name that I have to use when doing sudo vim /etc/asound.conf?

    From the information given above this device is my microphone:

    card 2: Device [C-Media USB Audio Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    And from the above information this device is my audio output:

    card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    How can I tell this in my /etc/asound.conf? I tried the following but it does not work:

    pcm.usb
    {
        type hw
        card C-Media USB Audio Device
    }
    pcm.!default
    {
        type asym
        playback.pcm
        {
            type plug
            slave.pcm "dmix"
        }
        capture.pcm
        {
            type plug
            slave.pcm "usb"
        }
    }
    
  • AcId
    AcId almost 11 years
    Did some Googleing and found this page on alsa-project.org. Try something like plug:default:C-Media USB Audio Device for the USB device and plug:default:HDA Intel PCH for the build in device.
  • Admin
    Admin almost 11 years
    in that case card and device lines should be removed by adding those lines right?
  • AcId
    AcId almost 11 years
    @YumYumYum I think so, but I'm not entirely sure.
  • Admin
    Admin almost 11 years
    It says invalid file: sun@sun-To-be-filled-by-O-E-M:~$ alsamixer ALSA lib conf.c:1686:(snd_config_load1) toplevel:24:4:Unexpected char ALSA lib conf.c:3406:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
  • AcId
    AcId almost 11 years
    Maybe this could be of some help. It talks about asound.conf and naming of devices.