Unofficial - Controlling sound thru rc.local for ALSA

Non release banter
aus9

Unofficial - Controlling sound thru rc.local for ALSA

Post#1 by aus9 » 17 Oct 2015, 07:35

Hi

Pre-amble
If you have used sucessfully the Porteus Settings Center, do not read any further please. This is one alternative for some like minded people who want to control their sound configuration/setup.....maybe the gui failed?
I am on XFCE 64 bit.

Before we start
-Delete any .asoundrc home file, any /etc/asound.conf.
-If you have created a non-guest login-name ensure you have added yourname using root powers to /etc/group for lines of audio,video,cdrom. Optional look at the other lines. EDIT no we should not user non-guest
-I prefer command=alsamixer for my mixer levels and that needs package=AlsaMixer.app* from USM. This allows me to save my mixer levels thru a root command later.
-Create a folder under your home dir, I call mine Keep (to remind my brain not to delete this folder) :roll:
-Some users may need firmware from USM search for alsa-tools

Intent
I like to have only 2 config files control my sound card. I know there are many system files for alsa.

Discovery

Code: Select all

su

alsactl init 0
# result is
alsactl: sysfs_init:48: sysfs path '/sys' is invalid
Found hardware: "HDA-Intel" "Intel Haswell HDMI" "HDA:80862807,80860101,00100000" "0x1043" "0x8534"
Hardware is initialized using a generic method

alsactl init 1
# result is
alsactl: sysfs_init:48: sysfs path '/sys' is invalid
Found hardware: "HDA-Intel" "Realtek ALC887-VD" "HDA:10ec0887,10438630,00100302" "0x1043" "0x8630"
Hardware is initialized using a generic method
What does above mean to me? That Alsa is discovering my hdmi device then my STAC (coloured holes) sound device. Its the second one I use on my tower with a simple 2 speaker but nice output. I forgot to add, these external speakers have their own volume control.

Create rc.local file
TIp save it to Keep as well, use root powers to then overwrite to /etc/rc.d/rc.local and make it executable with

Code: Select all

# chmod +x /etc/rc.d/rc.local
Contents for me are
#!/bin/sh
rmmod snd_hda_intel
modprobe snd_hda_intel index=1
alsactl -f /home/guest/Keep/asound.state restore 0
Some Comments
The first 2 commands remove my module and then re-load with various options. Your options may be very complex such as quirks.
index=1 is because I want the second card swapped into the first card position.
-The restore command could have dropped the 0 but I leave it in for trouble-shooting and brain purposes.
That is, if you run the command manually and then run alsamixer you should get the desired results, on reboot.

Create the mixer levels file
Now the fun bit. Earlier we discovered I wanted my second card to be the first card. But I have yet to reboot. So I open a terminal and run

Code: Select all

alsamixer -c1
Then I use m to mute or unmute, press SPACEBAR to activate or de-activate my mic inputs and raise/lower volumes
One simple play for volumes should work is

Code: Select all

speaker-test -c2 -l2
to save the file I now run as root

Code: Select all

alsactl -f /home/guest/Keep/asound.state store 1
Notice that I have had to use a 1 to force alsacontrol to look at card 1.

Reboot to test
If you made no mistakes, open a terminal and run alsamixer and I get a beautiful result

Image

good luck
Last edited by aus9 on 21 Oct 2015, 23:06, edited 3 times in total.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: Unofficial - Controlling sound thru rc.local for ALSA

Post#2 by Bogomips » 17 Oct 2015, 15:24

@aus9
Have kde with alsamixer already installed, which I prefer to kde mixer. The kde mixer I find far too complicated. Btw this thread might also be of interest to you.

Yesterday had some spare time and spent a while trying to find out the significance of the coloured bands shown on the very last image of post, but no joy, only all the utilities mentioned in your post :( Perchance do you know if the coloured bands have any signifcance? At the moment I try not to go into the red. :wink:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

aus9

Re: Unofficial - Controlling sound thru rc.local for ALSA

Post#3 by aus9 » 17 Oct 2015, 23:53

@Bogomips
I have read that link. My way ignores any mixer levels set up by /etc/rc.d/rc.alsa/rc.alsa
My way ignores any lock file that exists in /var/lib/alsa.
In case others need to know more explicitly, I let that rc.alsa do its job that create files in /var/lib but ignore them.

alsamixer colours are a guide only.
If you have a laptop, sound tends to be junky and speakers tend not to handle maxed volumes.

However, if you recording using a mic, you tend to get terrible feedback if input volumes are too high.
As you have not said this is the issue, I assume you have just playback outputs to play with.
The mixer for outputs is relative to your deafness levels and the quality of the speakers or headphones.
I suggest you just play with the volumes with a longer track that plays both voice and music.

and then do whatever you do to save those new levels.

I forgot to mention that my 2 speakers attached to tower have a separate volume control, also vlc has its own software volume.

good luck

Post Reply