Setup initial sound level

Place to discuss Debian Linux and Debian based distributions
Post Reply
Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Setup initial sound level

Post by Membrax » Mon May 09, 2005 9:51 am

I believe I can read but I still wonder how to do this (mainly this : set your levels with aumix, then add both the alsasound and aumix rc scripts (usually found in /etc/init.d/) to your default runlevel).


"If you find that your sound is muting itself every time you restart your computer despite changing it afterward, the problem is that the settings are not being saved and then reloaded at startup. If you're using aumix, the solution is easy: first, set your levels with aumix, then add both the alsasound and aumix rc scripts (usually found in /etc/init.d/) to your default runlevel. From then on, your system will start with the last levels you saved. If you do not have aumix or don't want to use it, then you can use alsactl to solve the problem. First, set your levels with alsamixer then as root, type:

alsactl store

Next, edit your /etc/rc.d/rc.local file and add these lines at the end:

# The following restores ALSA mixer settings
alsactl restore 0"


http://applications.linux.com/article.p ... =49&tid=47

Tux
guru
guru
Posts: 689
Joined: Wed Jan 08, 2003 10:40 am

Post by Tux » Mon May 09, 2005 12:41 pm

Is this a question? :)

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Tue May 10, 2005 4:55 am

... well yes, and I agree it can seem confusing.

The question part would be :

I still wonder how to do this (mainly this : set your levels with aumix, then add both the alsasound and aumix rc scripts (usually found in /etc/init.d/) to your default runlevel).

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue May 10, 2005 6:18 am

/etc/init.d is not your default run level. That is just where all the scripts go that get linked to in the runlevel directories /etc/rc0.d through /etc/rc6.d.

If you look in your /etc/modprobe.conf you will see that the sound levels get saved when your sound module is unloaded and restored when it is loaded via the "alsactl store" and "alsactl restore" commands. See:

$ man alsactl

Likewise you could save your settings to a file other than the default (default is /etc/asound.state), adjust them accordingly and load those exact settings every time using "alsactl restore -f /etc/yourhardcodedsettings.conf" and call it from one of your startup files like the end of /etc/rc.d/rc.local.

EDIT: I just noticed this is in the Debian forum, this may be slightly distro specific (but shouldn't be). It this a stock Debian distro we are talking about here? If so, what version, and more specifically what kernel version?

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Tue May 10, 2005 6:42 am

Hi Void Main !

Yes it's about my Debian Sarge Kernel 2.6.9 as far as I remember.

Since I'm using aumix I'm still searching for a step by step procedure to solve this.

Cheers !

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue May 10, 2005 8:02 am

There are a few threads on here about it. Here's the way FC1 used to use "aumix" to save/restore settings:

http://voidmain.is-a-geek.net/forums/vi ... ight=aumix

But that was for the 2.4 kernel so I don't think this will work for your 2.6. You still should be able to save a config file and restore it in your /etc/rc.d/rc.local.

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Tue May 10, 2005 9:36 am

... time time time, see what's become of me.
I even can't remember such a thing.

However I do see this when opening the modules.conf file :
### This file is automatically generated by update-modules
#
# Please do not edit this file directly. If you want to change or add
# anything please take a look at the files in /etc/modutils and read
# the manpage for update-modules.
#
### update-modules: start processing /etc/modutils/0keep
# DO NOT MODIFY THIS FILE!
# This file is not marked as conffile to make sure if you upgrade modutils
# it will be restored in case some modifications have been made.
Do I need to say that I'm afraid ?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Tue May 10, 2005 10:34 am

I didn't say to modify your modules.conf. I said that was the old way to do it and it just had an example of the command usage. You want to put your aumix commands in your /etc/rc.d/rc.local file as I said.

Do you have an "aumix-minimal" command? If so it's help screen should look like this:

Code: Select all

$ aumix-minimal
aumix 2.8 usage: aumix [-<channel option>[[+|-][<amount>]]|<level>|
R[ecord]|P[lay]|q[uery]] [-dhLqS] [-f <rc file>]

channel options:
  v:  main volume           x:  mix monitor
  b:  bass                  W:  PCM 2
  t:  treble                r:  record
  s:  synthesizer           i:  input gain
  w:  PCM                   o:  output gain
  p:  PC speaker            1:  line 1
  l:  line                  2:  line 2
  m:  microphone            3:  line 3
  c:  CD

other options:
  d:  adjust a device besides /dev/mixer
  f:  specify file for saving and loading settings (defaults to
      ~/.aumixrc or /etc/aumixrc)
  h:  this helpful message
  L:  load settings
  q:  query all channels and print their settings
  S:  save settings
So, you should be able to save the settings you want with:

# aumix-minimal -f /etc/aumix.conf -S

Then in your /etc/rc.d/rc.local file you would add:

/bin/aumix-minimal -f /etc/aumix.conf -L

Each user can have their own default too by saving their settings in ~/.aumixrc if I read that help screen properly. In fact it looks like if you save your config to /etc/aumixrc your defaults should load automatically because that is the default settings file according to the help screen. Maybe you wouldn't have to add anything to any script if you save it there.

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Wed May 11, 2005 6:16 am

nope, I don't have aumix-minimal

I only do have 'aumix' which opens an ugly text-like app to adjust some volume levels.

:oops:

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed May 11, 2005 7:57 am

So why even mess with that? Why not go strictly ALSA? I don't have to mess with aumix at all.

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Wed May 11, 2005 10:49 am

allright allright, please don't scream.

OK, let's start on alsa base, what do I need to do ? :wink:

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Wed May 11, 2005 10:54 am

Scream? I didn't realized I was screaming. ALSA is supposed to be upper case since it is an acronym, maybe that's where you thought I was screaming? I don't have a Debian system at my fingertips at the moment but I thought ALSA would be the default sound system. If it's not installed I would think it should be as simple as "apt-get install alsa". What does an "apt-cache search alsa" bring up? Otherwise we'll have to hope Ice9 can weigh in, or I can install Debian on my desktop again when I get some time and get a better answer for you.

Membrax
scripter
scripter
Posts: 99
Joined: Tue Oct 21, 2003 2:04 pm
Location: 50'48''N - 4'21''E
Contact:

Post by Membrax » Wed May 11, 2005 11:03 am

Yes, ALSA is installed by now. Let's see what Ice9 can show us up this time.
I'm so tired of his usual ironic remarks. :wink: :wink: :wink:

Ice9, buddy, time to come out with something serious this time. :twisted:

Ice9
guru
guru
Posts: 577
Joined: Thu Jan 09, 2003 12:40 am
Location: Belgium
Contact:

Post by Ice9 » Wed May 11, 2005 2:04 pm

Erm ... what can I say? :wink:
Void Main is right, ALSA is the default sound system, at least on my box and I did nothing special during the install to select it.
Until now I always had used OSS for sound and until a few months back I was sure I used OSS here too, until I tried to install ALSA and noticed I was using it already :lol:

First things first, which mixer do you use? I use kmix and in settings you can check the option "Restore volumes on login" so if you still use KDE this would be an option to try out.

If you currently use alsamixer it sounds quite simple in the article you mention:
ALT+F2 - type alsamixer in the command box, set your sound levels and then as root type

alsactl store

Next, edit your /etc/rc.d/rc.local file and add these lines at the end:

# The following restores ALSA mixer settings
alsactl restore 0

Just what you mentioned in your first post, did you actually try it?
I know you quite well and I would bet you didn't try this :P

Edit: did a little more research on this and came up with this link
To store the settings in /etc/asound.conf run the command

/usr/sbin/alsactl store
/etc/modules.conf
For automatic configuration and module loading add this to your /etc/modules.conf if you have a soundblaster live card:

alias char-major-116 snd
alias char-major-14 soundcore
alias snd-card-0 snd-card-emu10k1
alias sound-slot-0 snd-card-0
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias midi snd-synth-emu10k1
below snd-seq-oss snd-synth-emu10k1
post-install snd-synth-emu10k1 /bin/sfxload /etc/midi/8MBGMSFX.SF2 ; alsactl restore
# uncomment to save volume settings at shutdown:
#pre-remove snd-synth-emu10k1 alsactl store
So I'd rather add alsactl restore to modules.conf.
First it makes more sense to me and second I don't have an /etc/rc.d/rc.local file :D

Ice9
guru
guru
Posts: 577
Joined: Thu Jan 09, 2003 12:40 am
Location: Belgium
Contact:

Post by Ice9 » Wed May 11, 2005 2:23 pm

I also have an ALSA initscript in runlevels 2 to 5 with this in it:

Code: Select all

# Default values of variables in /etc/default/alsa
alsactl_store_on_shutdown="always autosave"
runlevels_save='[2-5]'
force_unload_modules_before_suspend=""
The script is called S12alsa, just tell me if you don't have it or if you don't have the above piece in it, I can upload mine on my site and you could cross-check your script with mine for differences ...

Post Reply