Main Menu

[TRICK] for alsa users only

Started by aus9, Sat Jul 30 03:56:32 2022

Previous topic - Next topic

aus9

We do not appear to have /etc/modprobe.d dir or /etc/modprobe.conf

this post has been EDITTED

I always try to run my private stuff outside of /usr/bin. But on openbox, I have no /usr/local/bin
so I used root power to create it

[ -d /usr/local/bin ] || sudo mkdir -p /usr/local/bin

2) I adjust my ~/.bashrc_profile  so it reads
Quote# Personal environment variables and startup programs.

# Personal aliases and functions should go in ~/.bashrc.  System wide
# environment variables and startup programs are in /etc/profile.
# System wide aliases and functions are in /etc/bashrc.

export PATH=/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:

if [ -f "$HOME/.bashrc" ] ; then
  source $HOME/.bashrc
fi

# unset append

# End ~/.bash_profile

EDIT I forgot to add /usr/sbin

logout and login to test
echo $PATH
/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:


3) Now I can create my intel sound file assumes that aplay -l -> reports first device is hdmi which I do not use,
I use desktop analog 3.55 mm lead speakers from line out on a tower,
its same as laptop speakers.

use root powers to create file and make it executable
sudo cat >> /usr/local/bin/sound<<'EOF'
#!/bin/bash

/bin/modprobe -r snd_hda_intel
/bin/modprobe snd_hda_intel enable=0
/usr/sbin/alsactl restore
date > /tmp/date
EOF

sudo chmod 755 /usr/local/bin/sound


You need to install alsa-utils to get command=aplay -l

to test it works....
enable=0 part says disable hdmi but keep other card devices (I have only analog left so it grabs index=0)

sudo sound
gor [ ~ ]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

alsamixer


I have previously saved my mixer levels
sudo alsactl store
and the alsamixer command confirms they are correct YMMV

aus9

if you use a web browser that expects to find pulseaudio  (GRRR  ;D)

then I suggest you install apulse, which emulates a working pulseaudio without installing it.

then in firefox, youtube works for me by

apulse firefox

aus9

#2
All steps below need root powers and assume you are using sysV init

Once manual command works, you may wish to automate it on boot up? If so read on.
Firstly I have no plans of changing root pathway so I use root powers to copy sound to /usr/bin/sound2
or create executable named  /usr/bin/sound2 contents
Quote#!/bin/bash

/bin/modprobe -r snd_hda_intel
/bin/modprobe snd_hda_intel enable=0
/usr/sbin/alsactl restore
date > /tmp/date

The purpose of the date command is to prove to me, the system has actioned on bootup my new init

step 2
create an system file /etc/rc.d/init.d/sound2
contents
Quote#!/bin/bash
/usr/bin/sound2

step 3 create sym link to your normal run level (most use 5)
cd /etc/rc.d/rc5.d/
ln -s ../init.d/sound2 S99sound2


reboot to test.

Note for me, hdmi is first detected and tries to use the "analog" mixer levels saved
visible after  boot up ....Ctl + Alt + F1
but on boot up ....run alsamixer and mixer levels and sound output should now be analog etc

Good luck

Dj

Another trick - uninstall apulse.

Find your desired card with:

   cat /proc/asound/cards
and then create /etc/asound.conf with following:

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

Install volumeicon. Be sure to put volumeicon at startup.
Reboot.

So you have sound in browsers as well as keyboard control.

edulof

For those on CDE: It will appear more integrated in your workflow to run alsamixer instead of pavucontrol, even if you use apulse. The fact alsa is so simply integrated in nutyx makes it more intuitive to follow than in distros based on huge sized distros and mainstream DEs, which is the other way around.