You are not logged in.

#1 2024-06-18 21:48:19

lp0
Member
Registered: 2024-06-18
Posts: 4

Sound BlasterX G6 Headset Microphone

I am trying to get the microphone input on my Sound BlasterX G6 - an external USB DAC - to be less annoying.

Preface

To get the microphone to work at all, I need to load up alsamixer, set PCM Capture Source to External Mic, and set Input Gain Control to 67 (which is two steps up from zero).

Okay, fine.  I followed this guide, and now I have the following script:

# Figure out the ALSA card ID.
id=$(aplay --list-devices | sed --quiet 's/^card \([0-9]\+\):.*Sound BlasterX G6.*/\1/p')

# Set the input source.
amixer --card "${id}" --quiet set 'PCM Capture Source' 'External Mic' || \
  printf 'Failed to set PCM Capture Source\n'

# Set the mic boost.
amixer --card "${id}" --quiet sset 'Input Gain Control' 2 || \
  printf 'Failed to set Input Gain Control\n'
The Problem

I don't know how to make these settings persist.  On boot/login - and also seemingly at random - the PCM Capture Source resets itself to Line In.

Stuff I've Tried

wpctl status plus wpctl inspect N don't give any indication that pipewire/wireplumber know that these controls exist for the G6, so I thought maybe I'd need to create a udev rule and an alsa-card-profile.  What follows is my attempt to do this, but I have no idea what I am doing.

udev rule

SUBSYSTEM!="sound", GOTO="pipewire_end"
ACTION!="change", GOTO="pipewire_end"
KERNEL!="card*", GOTO="pipewire_end"

ATTRS{vendor}=="0x041e", ATTRS{device}=="0x3256", ENV{ACP_PROFILE_SET}="sbx-g6.conf"

LABEL="pipewire_end"

analog-input-external-mic-sbx-g6.conf (attempted path)

[General]
priority = 99
name = External Mic

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:External Mic]
name = analog-input-mic
required-any = any

[Element External Mic]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Input Gain Control]
required = any
switch = on
volume = 2
volume-limit = 3

[Element Line In]
switch = off
volume = off

[Element What U Hear]
switch = off
volume = off

analog-input-linein-sbx-g6.conf (attempted path #2)

[General]
priority = 99
name = Line In (Rear)

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Line In]
name = analog-input-linein
required-any = any

[Element Line In]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Input Gain Control]
required = any
switch = on
volume = zero
volume-limit = 3

[Element External Mic]
switch = off
volume = off

[Element What U Hear]
switch = off
volume = off

sbx-g6.conf (attempted profile set)

[General]
auto-profiles = yes

[Mapping analog-stereo]
device-strings = hw:%f
channel-map = left,right
paths-output = analog-output analog-output-lineout analog-output-headphones
paths-input = analog-input-linein-sbx-g6 analog-input-external-mic-sbx-g6
priority = 99

Sorta gave up at this point because I realized I don't have any idea what 99% of this stuff even means.

...

I'd appreciate any help!  Ideally I'd like these controls to be exposed to pipewire/wireplumber, but anything that would get my settings to persist would be awesome.  I'm about ready to make a systemd timer.

Edit: Added G6 to title

Last edited by lp0 (2024-06-18 21:55:39)

Offline

#2 2024-06-20 00:46:11

lp0
Member
Registered: 2024-06-18
Posts: 4

Re: Sound BlasterX G6 Headset Microphone

Partial Solution

With these files, I can use pavucontrol to select two different input ports: one for the "External Mic" (headset and I think also front input) and one for "Line In" (I think rear input).  What's more (except for the new problem below), pipewire/wireplumber remembers it.

/usr/lib/udev/rules.d/90-pipewire-alsa-sbx-g6.rules

SUBSYSTEM!="sound", GOTO="pipewire_sbx_g6_end"
ACTION!="change", GOTO="pipewire_sbx_g6_end"
KERNEL!="card*", GOTO="pipewire_sbx_g6_end"

ATTRS{idVendor}=="041e", ATTRS{idProduct}=="3256", ENV{ACP_PROFILE_SET}="sbx-g6.conf"

LABEL="pipewire_sbx_g6_end"

/usr/share/alsa-card-profile/mixer/paths/analog-input-external-mic-sbx-g6.conf

[General]
priority = 99
description = Microphone (Headset/Front)

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:External Mic]
name = analog-input-external-mic-sbx-g6
required-any = any

[Element External Mic]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Input Gain Control]
required = any
switch = on
volume = 2
volume-limit = 3

[Element Line In]
switch = off
volume = off

[Element What U Hear]
switch = off
volume = off

/usr/share/alsa-card-profile/mixer/paths/analog-input-linein-sbx-g6.conf

[General]
priority = 89
description = Line In (Rear)

[Element PCM Capture Source]
enumeration = select

[Option PCM Capture Source:Line In]
name = analog-input-linein-sbx-g6
required-any = any

[Element Line In]
required = any
switch = mute
volume = merge
override-map.1 = all
override-map.2 = all-left,all-right

[Element Input Gain Control]
required = any
switch = on
volume = 0
volume-limit = 3

[Element External Mic]
switch = off
volume = off

[Element What U Hear]
switch = off
volume = off

/usr/share/alsa-card-profile/mixer/profile-sets/sbx-g6.conf

[General]
auto-profiles = yes

[Mapping analog-stereo]
device-strings = hw:%f
channel-map = left,right
paths-output = analog-output analog-output-speaker
paths-input = analog-input-linein-sbx-g6 analog-input-external-mic-sbx-g6
priority = 90

[Mapping iec958-stereo]
device-strings = iec958:%f
channel-map = left,right
paths-input = iec958-stereo-input
paths-output = iec958-stereo-output
priority = 80
The New Problem

Now when I boot and log in, pavucontrol only gives two profile options: "Off" and "Pro Audio".  I have to unplug/replug my G6 for the thing to work at all (at which point the stuff I did above works properly).  Any thoughts what could be causing this?  I believe it happened before I messed with any of this.

Offline

Board footer

Powered by FluxBB