Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help figuring out how to restore alsamixer settings on login
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Wed Aug 02, 2023 10:03 pm    Post subject: Help figuring out how to restore alsamixer settings on login Reply with quote

Hey everyone. I have a pipewire setup working. I'm using awesome wm from startx. I have an openrc system.

This is my issue, alsamixer setttings aren't being saved and restored completely whenever I log out and log back on. In particular, my speaker channel is always muted.

I've noticed that sudo alsactl store and sudo alsactrl restore work as intended. I'd like to automated those commands somewhere.

There is a an /etc/conf.d/alsasound file that is set to save/restore but since I use pipewire, I don't think that file every gets called.

I start pipewire as part of the startx sequence from xinitrc.

My issue is that alsactl needs root permissions. How can I call it during the startx sequence? Or how should I set perms to do it? Just looking for some guidance.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54266
Location: 56N 3W

PostPosted: Thu Aug 03, 2023 7:18 am    Post subject: Reply with quote

dandennison84,

Add alsasound to the default runlevel.

The handbook says to use the boot runlevel but when my system does not boot properly i don't mind if sound is not working.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Thu Aug 03, 2023 3:44 pm    Post subject: Reply with quote

So the issue seems to be wireplumber itself. But no idea how figure out what it is doing because it does so much.

If I open alsamixer and configure it as a I like and reboot. Then before I launch startx, I check it and see that everything is as it should be. Channels I need are unmuted and at the correct volume.

After startx when I check again, the speaker channel is muted. The only thing that has run in the meantime is gentoo-pipewire-launcher restart & from inside the xinitrc sequence.

I don't see anything in particular that is causing this from the 3 pipewire logs or anything in the various /etc/X11 files or my .config/pipewire/pipewire.conf.

The only interesting thing I've seen so far is from dmesg. The Parent card not yet available line. Not sure if it means anything or not.

Code:

[Thu Aug  3 10:14:15 2023] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[Thu Aug  3 10:14:15 2023] snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[Thu Aug  3 10:14:15 2023] Loading firmware: i915/tgl_dmc_ver2_12.bin
[Thu Aug  3 10:14:15 2023] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[Thu Aug  3 10:14:15 2023] snd_hda_intel 0000:01:00.1: Disabling MSI
[Thu Aug  3 10:14:15 2023] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[Thu Aug  3 10:14:15 2023] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/tgl_dmc_ver2_12.bin (v2.12)
[Thu Aug  3 10:14:16 2023] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input27
[Thu Aug  3 10:14:16 2023] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input28
[Thu Aug  3 10:14:16 2023] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input29
[Thu Aug  3 10:14:16 2023] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input30
[Thu Aug  3 10:14:16 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[Thu Aug  3 10:14:16 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[Thu Aug  3 10:14:16 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[Thu Aug  3 10:14:16 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[Thu Aug  3 10:14:16 2023] mei_pxp 0000:00:16.0-fbf6fcf1-96cf-4e2e-a6a6-1bab8cbe36b1: bound 0000:00:02.0 (ops tfp410_ops [i915])
[Thu Aug  3 10:14:16 2023] i915 0000:00:02.0: [drm] Protected Xe Path (PXP) protected content support initialized
[Thu Aug  3 10:14:16 2023] snd_hda_intel 0000:01:00.1: bound 0000:01:00.0 (ops disp50xx_modifiers [nouveau])
[Thu Aug  3 10:14:17 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_fence_ops [i915])
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 5
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2
[Thu Aug  3 10:14:18 2023] Loading firmware: intel/sof/sof-tgl-h.ri
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[Thu Aug  3 10:14:18 2023] Loading firmware: intel/sof-tplg/sof-hda-generic-2ch.tplg
[Thu Aug  3 10:14:18 2023] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[Thu Aug  3 10:14:18 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Parent card not yet available, widget card binding deferred
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC289: line_outs=1 (0x14/0x0/0x0/0x0/0x0) type:speaker
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:    inputs:
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:      Headset Mic=0x19
[Thu Aug  3 10:14:18 2023] snd_hda_codec_realtek ehdaudio0D0:      Headphone Mic=0x1b
[Thu Aug  3 10:14:19 2023] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
[Thu Aug  3 10:14:19 2023] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi3 overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi2 overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi1 overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Codec Output Pin1 overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Codec Input Pin1 overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Analog Codec Playback overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Digital Codec Playback overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt Analog Codec Playback overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Analog Codec Capture overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Digital Codec Capture overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Alt Analog Codec Capture overwritten
[Thu Aug  3 10:14:19 2023] skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[Thu Aug  3 10:14:19 2023] input: sof-hda-dsp Headphone Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input35
[Thu Aug  3 10:14:19 2023] input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input36
[Thu Aug  3 10:14:19 2023] input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input37
[Thu Aug  3 10:14:19 2023] input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card1/input38
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 250

PostPosted: Thu Aug 03, 2023 4:10 pm    Post subject: Reply with quote

sound server (if running) should be managing and remembering device settings, try unmuting the output in pavucontrol
Back to top
View user's profile Send private message
soundrolf
Tux's lil' helper
Tux's lil' helper


Joined: 08 Sep 2016
Posts: 122
Location: Cologne / Germany

PostPosted: Thu Aug 03, 2023 6:01 pm    Post subject: Reply with quote

Check which soundcard is available.

Code:
cat /proc/asound/cards


This is on my box

Code:


 0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0xfc080000 irq 62
 1 [Generic        ]: HDA-Intel - HD-Audio Generic
                      HD-Audio Generic at 0xfc400000 irq 64


In my case, I created a file

Code:
touch .asoundrc


Fill the file .asoundrc with

Quote:


defaults.pcm.card 1
defaults.ctl.card 1



Logout your session
Login now

You will have sound, and alsamixer can store the setting.

Regards

soundrolf
_________________
Regards
soundrolf

Mobo: ASUS PRIME B550M-K BIOS 3302 08/01/2023
CPU: AMD Ryzen 7 5800X 8-Core Processor (16) @ 3800 MHz
GPU: AMD Caicos Radeon HD 6450/7450/8450 / R5 230 OEM 1GB DDR3
RAM: 80GB crucial DDR4 3200 MHz 2x8GB 2x32GB
Back to top
View user's profile Send private message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Thu Aug 03, 2023 11:07 pm    Post subject: Reply with quote

Code:

0 [NVidia         ]: HDA-Intel - HDA NVidia
                      HDA NVidia at 0x84080000 irq 17
 1 [sofhdadsp      ]: sof-hda-dsp - sof-hda-dsp
                      Alienware-Alienwarex17R1-1.18.0


Code:

defaults.pcm.!card sofhdadsp
defaults.pcm.!device 0
defaults.ctl.!card sofhdadsp


Tried the suggestions above, but it didn't matter. This is what I have to do each time:


  • open ncspot and play a song. It is muted.
  • open alsamixer and unmute the speaker. I can also do this from pavucontrol by going to the configuration tab, selecting the Tiger Lake-H HD Audio Controller that is currently set to Pro Audio but no sound. Select any other setting, then select Pro Audio again and now the sound is unmuted.
  • open easyeffects and mess around with the sound. Everything works. Close easyeffect and sometimes the sound stops working because the controller has switched for some reason. Going back to pavucontrol. the playback tab for spotify now has my GA 104 High Definition Audio Controller Pro selected. I have to turn it back to my Tiger Lake-H HD Audio Controller Pro.


This is moderately annoying :P I am wondering if I could somehow switch the devices above to make card 1 card 0 and vice versa. If I leave the default driver in (snd-hda-driver) the configuration works "out-of-the-box" and it shows up as card 0. sof-audio-pci-intel-tgl is what is giving the strange behavior above, but the sound is better.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2575
Location: Here and Away Again

PostPosted: Fri Aug 04, 2023 6:00 am    Post subject: Reply with quote

dandennison84 wrote:
I am wondering if I could somehow switch the devices above to make card 1 card 0 and vice versa.

This should be possible, yes.

I have something like this in my '/etc/modprobe.d/alsa.conf' for example:

Code:
# Alsa kernel modules' configuration file.

# ALSA portion
#options snd slots=snd_oxygen,snd_ctxfi,snd_hda_intel,snd_aloop
#options snd slots=snd_oxygen
#options snd slots=snd_hda_intel,snd_aloop,snd_usb_audio
#options snd_hda_intel index="0,2"
options snd_hda_intel index="0" pid="1457"
options snd_hda_intel index="2" pid="8ca0"
options snd_aloop index="1"
options snd_usb_audio index="3"

I've last edited it back in 2020, but I /think/ it's still being used. :]

(Actually, that second 'snd_hda_intel' no longer exists in my system but yeah.)
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Fri Aug 04, 2023 10:26 am    Post subject: Reply with quote

What is the pid line and why do you need it?
Back to top
View user's profile Send private message
Ralphred
Guru
Guru


Joined: 31 Dec 2013
Posts: 501

PostPosted: Fri Aug 04, 2023 10:54 am    Post subject: Reply with quote

dandennison84 wrote:
My issue is that alsactl needs root permissions. How can I call it during the startx sequence? Or how should I set perms to do it? Just looking for some guidance.

The only reason alsactl needs root permission is because of the permissions of the save file that it uses by default; if you use the -f switch to save the state somewhere you do have permission (so /usr/sbin/alsactl store -f /home/user/.asound.state) you can issue the restore command during your startx sequence after the programs that mess things up have started.

Edit: I use /usr/bin/pactl set-sink-volume [sink index number] [volume]% on login too to make pulseaudio's default volumes sane, you may need to find a pipewire equivalent?
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2575
Location: Here and Away Again

PostPosted: Fri Aug 04, 2023 11:45 am    Post subject: Reply with quote

dandennison84 wrote:
What is the pid line and why do you need it?

I don't remember adding them, so I could only guess they are, or were to differentiate between devices that use(d) the same kernel module.

I'm not sure it even makes sense for the snd-hda modules though... and looking around, indeed, only snd-usb-audio [1] seems to have that option (so it might be a remnant of some copy-paste error, or/and testing).

Also, I was pretty much thinking ALSA only while posting for some reason... which is what I'm using. I don't know how much PulseAudio and PipeWire have respect for these options.

1. https://www.kernel.org/doc/html/latest/sound/alsa-configuration.html#module-snd-usb-audio
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Fri Aug 04, 2023 5:36 pm    Post subject: Reply with quote

Ralphred wrote:
dandennison84 wrote:
My issue is that alsactl needs root permissions. How can I call it during the startx sequence? Or how should I set perms to do it? Just looking for some guidance.

The only reason alsactl needs root permission is because of the permissions of the save file that it uses by default; if you use the -f switch to save the state somewhere you do have permission (so /usr/sbin/alsactl store -f /home/user/.asound.state) you can issue the restore command during your startx sequence after the programs that mess things up have started.

Edit: I use /usr/bin/pactl set-sink-volume [sink index number] [volume]% on login too to make pulseaudio's default volumes sane, you may need to find a pipewire equivalent?


I think the that still works even for pipewire. Pipe uses pulse underneath the covers. I'm assuming pactl is basically a cmd line version of pavucontrol?
Back to top
View user's profile Send private message
dandennison84
n00b
n00b


Joined: 07 Feb 2013
Posts: 34
Location: Omaha, NE

PostPosted: Fri Aug 04, 2023 5:42 pm    Post subject: Reply with quote

Chiitoo wrote:
dandennison84 wrote:
What is the pid line and why do you need it?

I don't remember adding them, so I could only guess they are, or were to differentiate between devices that use(d) the same kernel module.

I'm not sure it even makes sense for the snd-hda modules though... and looking around, indeed, only snd-usb-audio [1] seems to have that option (so it might be a remnant of some copy-paste error, or/and testing).

Also, I was pretty much thinking ALSA only while posting for some reason... which is what I'm using. I don't know how much PulseAudio and PipeWire have respect for these options.

1. https://www.kernel.org/doc/html/latest/sound/alsa-configuration.html#module-snd-usb-audio


I'll do some more testing today. Pipewire is fairly sane I think. It all sits on top of alsa, so if that isn't working, you have to start there. Pipewire is basically a drop-in replacement for pulse but also works with jack as well. The only thing pipewire is really doing is replacing the pulse daemon in my configuration. It lets me use easyeffects and other things like that. I'm fairly certain I have to get the alsa side right first which means getting the cards in the right order.

One source of my trouble is that the way easyeffects and pipewires works is that it creates a playback sink for things like pavucontrol. So if I open pavucontrol and go to the playback tab when spotify or youtube or something is playing, I can see an Easyeffects Sink. If I shut easyeffects down, the sink goes away and pavu replaces it with the first one in the list which is basically card 0. So just swapping 1 with 0 should fix that when I get around to it.

I'm going to try the pactl trick when I get home to see if that fixes the volume side of things. Then I'm golden.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum