Author Topic: [TRICK] for alsa users only  (Read 505 times)

aus9

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
[TRICK] for alsa users only
« on: Sat Jul 30 03:56:32 2022 »
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

Code: [Select]
[ -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
Code: [Select]
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
Code: [Select]
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)

Code: [Select]
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
Code: [Select]
sudo alsactl storeand the alsamixer command confirms they are correct YMMV
« Last Edit: Thu Aug 04 03:26:19 2022 by aus9 »

aus9

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: [TRICK] for alsa users only
« Reply #1 on: Sat Jul 30 07:33:14 2022 »
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

Code: [Select]
apulse firefox

aus9

  • Newbie
  • *
  • Posts: 32
  • Karma: +0/-0
Re: [TRICK] for alsa users only
« Reply #2 on: Thu Aug 04 02:27:30 2022 »
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)
Code: [Select]
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
« Last Edit: Thu Aug 04 03:24:26 2022 by aus9 »