2

I recently set up a dual boot on a new pc. I'm not using a laptop (I mention because I came across this issue a lot on lenovo laptops, but the solutions didn't work for me so far). I've looked at and tried many solutions, and so far none of them worked unfortunately. Btw, I don't think its relevant, but ubuntu and windows are on separate SSDs.

Motherboard info.

$ sudo dmidecode | grep -A4 '^Base'
Base Board Information
    Manufacturer: Micro-Star International Co., Ltd.
    Product Name: MPG X670E CARBON WIFI (MS-7D70)
    Version: 1.0
    Serial Number: 07D7010_MC1E902178

I have headphones (with a mic.) that I've been using for 2-3 years. I plug my headphones directly to the motherboard through a splitter to plug speaker and microphone jacks separately. On Windows both headphone speakers and microphone are working fine. However, on my Ubuntu 22.04, only the output (speakers) is working. The input devices are as follows:

$ pactl list short sources
0   alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor    module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
1   alsa_output.usb-Generic_USB_Audio-00.analog-stereo.monitor  module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
2   alsa_input.usb-Generic_USB_Audio-00.analog-stereo   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED

$ pactl get-default-source alsa_input.usb-Generic_USB_Audio-00.analog-stereo

The sound settings look like below. I intentionally got the screenshot while music is playing because at the microphone you can see the red spikes, it kinda looks like its capturing the system sounds somehow ?? But I might be just speculating.

system sound settings

The good thing is that when I installed audacity, it displays 4 devices (or subdevices), as below, and on the top right you can see that microphone is actively capturing.

USB Audio: #1 (hw: 1,1)
USB Audio: #2 (hw: 1,2)
pulse
default

audacity

How does audacity recognize the correct microphone while pulseaudio doesn't ? Am I doing something wrong ? How can I make pulseaudio recognize what audacity does, or how can I configure that microphone USB Audio: #2 (hw: 1,2) as the default input device ?

Also, I can successfully record audio by.

arecord -f S16_LE -d 10 -r 16000 -c 2 --device="hw:1,2" /tmp/test-mic.wav

and play it by

aplay /tmp/test-mic.wav

Recently I tried setting options snd-hda-intel model=headset-mode on /etc/modprobe.d/alsa-base.conf hoping that headset-mode could configure the pins correctly, but it didn't work.

Update-1: HW Info & Some related issues Hwinfo for sound cards is below.

$ hwinfo --sound
21: PCI 1600.1: 0403 Audio device                               
  [Created at pci.386]
  Unique ID: dTbt.EHFnU8tIZO0
  Parent ID: JZZT.SmL1g8qcFrC
  SysFS ID: /devices/pci0000:00/0000:00:08.1/0000:16:00.1
  SysFS BusID: 0000:16:00.1
  Hardware Class: sound
  Model: "ATI Audio device"
  Vendor: pci 0x1002 "ATI Technologies Inc"
  Device: pci 0x1640 
  SubVendor: pci 0x1462 "Micro-Star International Co., Ltd. [MSI]"
  SubDevice: pci 0x7d70 
  Driver: "snd_hda_intel"
  Driver Modules: "snd_hda_intel"
  Memory Range: 0xfcd88000-0xfcd8bfff (rw,non-prefetchable)
  IRQ: 170 (364 events)
  Module Alias: "pci:v00001002d00001640sv00001462sd00007D70bc04sc03i00"
  Driver Info #0:
    Driver Status: snd_hda_intel is active
    Driver Activation Cmd: "modprobe snd_hda_intel"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
  Attached to: #33 (PCI bridge)

36: PCI 1600.6: 0403 Audio device [Created at pci.386] Unique ID: y523.uo8YgG6CAu7 Parent ID: JZZT.SmL1g8qcFrC SysFS ID: /devices/pci0000:00/0000:00:08.1/0000:16:00.6 SysFS BusID: 0000:16:00.6 Hardware Class: sound Device Name: "Realtek ALC1220" Model: "AMD Family 17h (Models 10h-1fh) HD Audio Controller" Vendor: pci 0x1022 "AMD" Device: pci 0x15e3 "Family 17h (Models 10h-1fh) HD Audio Controller" SubVendor: pci 0x1462 "Micro-Star International Co., Ltd. [MSI]" SubDevice: pci 0xed70 Driver: "snd_hda_intel" Driver Modules: "snd_hda_intel" Memory Range: 0xfcd80000-0xfcd87fff (rw,non-prefetchable) IRQ: 171 (no events) Module Alias: "pci:v00001022d000015E3sv00001462sd0000ED70bc04sc03i00" Driver Info #0: Driver Status: snd_hda_intel is active Driver Activation Cmd: "modprobe snd_hda_intel" Config Status: cfg=new, avail=yes, need=no, active=unknown Attached to: #33 (PCI bridge)

47: PCI 100.1: 0403 Audio device [Created at pci.386] Unique ID: NXNs.Sz9Ktf69FqD Parent ID: mnDB.wP_JHy3VTe7 SysFS ID: /devices/pci0000:00/0000:00:01.1/0000:01:00.1 SysFS BusID: 0000:01:00.1 Hardware Class: sound Model: "nVidia Audio device" Vendor: pci 0x10de "nVidia Corporation" Device: pci 0x22ba SubVendor: pci 0x19da "ZOTAC International (MCO) Ltd." SubDevice: pci 0x1675 Revision: 0xa1 Driver: "snd_hda_intel" Driver Modules: "snd_hda_intel" Memory Range: 0xfc080000-0xfc083fff (rw,non-prefetchable) IRQ: 168 (643 events) Module Alias: "pci:v000010DEd000022BAsv000019DAsd00001675bc04sc03i00" Driver Info #0: Driver Status: snd_hda_intel is active Driver Activation Cmd: "modprobe snd_hda_intel" Config Status: cfg=new, avail=yes, need=no, active=unknown Attached to: #43 (PCI bridge)

I tried to set model as dual-codecs from the model list, as it's stated that it's the model for Gaming mobos. However, it didn't work.

dual-codecs

ALC1220 dual codecs for Gaming mobos

null
  • 71

1 Answers1

0

Finally, I figured it out. For future readers; first of all, I needed to load the alsa module for pulseaudio. Check if your devices is listed via pactl, this is for source devices (e.g. microphone), for playback devices use sinks instead of sources.

$ pactl list short sources
1   alsa_output.usb-Generic_USB_Audio-00.analog-stereo.monitor  module-alsa-card.c  s16le 2ch 44100Hz   IDLE
2   alsa_input.usb-Generic_USB_Audio-00.analog-stereo   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
6   alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor    module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED

My device is not here, as I mentioned it's the 2nd device of the card named "Audio" (I don't use the card index as it may be changed on reboot, I will come to that point).

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 3: Audio [USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: Audio [USB Audio], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: Audio [USB Audio], device 2: USB Audio [USB Audio #2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Now, load the alsa module of source which is for me card 3 device 2, by

$ pacmd load-module module-alsa-source device=hw:3,2

Now, we should see this device on pactl list.

$ pactl list short sources
1   alsa_output.usb-Generic_USB_Audio-00.analog-stereo.monitor  module-alsa-card.c  s16le 2ch 44100Hz   IDLE
2   alsa_input.usb-Generic_USB_Audio-00.analog-stereo   module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED
4   alsa_input.hw_3_2   module-alsa-source.c    s16le 2ch 44100Hz   SUSPENDED
6   alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor    module-alsa-card.c  s16le 2ch 44100Hz   SUSPENDED

Now we can see the device on index 4, and verify the current default device, and you can use the set-default-(sink/source) command for your usecase if it isn't set as the default device. For me it is:

$ pactl get-default-source
alsa_input.hw_3_2

Now, up to here the microphone was recognized by the system, but it wasn't enough just yet. Remember that I told you the sound card index may change between reboots? Now, we need to fix that index. Open /etc/modprobe.d/alsa-base.conf, and add the following line.

NOTE: This is just for fixing the index of the desired sound card, for me there are 4 cards, and indexed from 0 to 3 (0,1,2,3), for you 3 might not be suitable, you can use any suitable index number.

options snd-usb-audio index=3

Is it done, yet? No. We need to configure one last thing. I don't know why, but we need to set the configuration of the device (for me the microphone), as 2 channels. For that I did the following, open /etc/asound.conf, and set (or append) the following. I recommend using the name of the card (Audio) rather than its index 3 for aforementioned reasons. The following config is taken and adapted from this post.

pcm.usb_mic_raw {
  type hw
  card Audio
  device 2
}

pcm.usb_mic_plug { type plug slave { pcm usb_mic_raw format S16_LE rate 48000 channels 2 } }

Don't use pcm.hdmi because it's taken by the default config files

pcm.speaker_raw { type hw card Audio device 0 }

pcm.speaker_plug { type plug slave { pcm speaker_raw format S16_LE rate 48000 channels 2 } }

pcm.!default { type asym; playback.pcm "speaker_plug"; capture.pcm "usb_mic_plug"; }

Finally add the source device config to the /etc/pulse/default.pa to alsa device be loaded on the boot.

load-module module-alsa-source device=hw:3,2

Update: Heads-up if the last command added to the pulse config /etc/pulse/default.pa doesn't work on reboot, you may want to manually activate it after reboot.

It's appreciated if someone can explain and clarify the last setting which I couldn't achieve success. Why not adding the line work on the boot ? After reboot I still see 3 sources (as at the beginning), I have to manually execute the command for device to be recognized. While this still works fortunately, it'd be really good if the mic is detected on the boot automatically.

null
  • 71