Discussion:
mixer levels on boot
Harry Doyle
2007-09-17 19:22:03 UTC
Permalink
hello everyone,
i am running a freebsd server to stream my local campus station's radio
broadcast to the net. i am using the stock ac97 audio, and using a little
script in /usr/local/etc/rc.d which uses kldload to load the driver.

i have to issue mixer rec -83 to get the audio down to a decent level (very
hot coming out of the mixer but i can't change that for other reasons). i
have tried to script this mixer command into startup by putting a sleep
command and then the mixer command, and also by using the /boot/boot.hints
file.

however whenever i reboot the machine the mixer command always shows the
default level of 90 which clips pretty hard.

also, the sound driver doesn't seem to load until around 2 minutes after i
can log into a fresh boot (not a problem, just some extra info). how can i
script my default rec level on boot?

thanks,
harry
Rob
2007-09-17 20:21:54 UTC
Permalink
Post by Harry Doyle
however whenever i reboot the machine the mixer command always shows the
default level of 90 which clips pretty hard.
My 6.2 system saves and restores the mixer settings across boots. Apparently in the file /var/db/mixer0-state However, the file is root owned and 644; perhaps if you create the file and chmod it writable, your settings will stick?

Or you could put the command in your script. "mixer -S" dumps the current settings in a format mixer can read back. I do this in a script that dribbles music on hold to our phone system:


mixer_default="vol 45:45 pcm 40:40"

# Call mixer command to set params specified in conf file, or defaults.
set_mixer() {
if [ -f $home_dir/mixer.conf ]; then
mixer `cat $home_dir/mixer.conf`
echo "set mixer.conf params"
else
mixer $mixer_default
echo "set mixer default values"
fi
}


-RW
Mel
2007-09-18 14:47:40 UTC
Permalink
Post by Rob
Post by Harry Doyle
however whenever i reboot the machine the mixer command always shows the
default level of 90 which clips pretty hard.
My 6.2 system saves and restores the mixer settings across boots.
Apparently in the file /var/db/mixer0-state However, the file is root
owned and 644; perhaps if you create the file and chmod it writable, your
settings will stick?
Nope. These are saved by /etc/rc.d/mixer. Adjust the mixer under root account
to your desired values and call `/etc/rc.d/mixer stop'. This will save the
state. Reboot to test.

If this doesn't work, then somehow, the mixer is set to different values
during shutdown and before /etc/rc.d/mixer is called and that's tricky to
find out -but a desktop mixer like kmix can be the cause of that if you're
running a desktop environment via xdm/kdm/gdm.
--
Mel
Harry Doyle
2007-09-18 21:18:23 UTC
Permalink
hi guys,
i've tried a couple suggestions, but nothing is working for me. here is a
few things from the console that might be helpful. no xwindows on this
machine, it's just a base freebsd network install with only the necessary
packages installed to do the audio stuff it needs to do.

radio# mixer
Mixer vol is currently set to 100:100
Mixer pcm is currently set to 0:0
Mixer speaker is currently set to 75:75
Mixer mic is currently set to 0:0
Mixer cd is currently set to 75:75
Mixer rec is currently set to 7:7
Recording source: mic

radio# uname -a
FreeBSD radio 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC
2007 ***@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP i386

when i issue /etc/rc.d/mixer stop then reboot, the mixer shows set to 7:7,
but then it still clips like it does on 90. then i set mixer to 7 and it
says setting mixer fro 90 to 7.

i am thinking that /etc/rc.d/mixer gets invoked before kldload loads the
driver because both dmesg and mixer tell me there is no mixer device till
the machine is up for around 2 minutes. maybe i will try the hda enable in
rc.conf, but it doesn't seem ac97 on unix is as well supported as the
windows drivers so i need the particular driver i downloaded (i might be
wrong).

cheers,
harry
Post by Mel
Post by Rob
Post by Harry Doyle
however whenever i reboot the machine the mixer command always shows
the
Post by Rob
Post by Harry Doyle
default level of 90 which clips pretty hard.
My 6.2 system saves and restores the mixer settings across boots.
Apparently in the file /var/db/mixer0-state However, the file is root
owned and 644; perhaps if you create the file and chmod it writable,
your
Post by Rob
settings will stick?
Nope. These are saved by /etc/rc.d/mixer. Adjust the mixer under root account
to your desired values and call `/etc/rc.d/mixer stop'. This will save the
state. Reboot to test.
If this doesn't work, then somehow, the mixer is set to different values
during shutdown and before /etc/rc.d/mixer is called and that's tricky to
find out -but a desktop mixer like kmix can be the cause of that if you're
running a desktop environment via xdm/kdm/gdm.
--
Mel
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "
Mel
2007-09-18 21:37:15 UTC
Permalink
Post by Harry Doyle
when i issue /etc/rc.d/mixer stop then reboot, the mixer shows set to 7:7,
but then it still clips like it does on 90. then i set mixer to 7 and it
says setting mixer fro 90 to 7.
i am thinking that /etc/rc.d/mixer gets invoked before kldload loads the
driver because both dmesg and mixer tell me there is no mixer device till
the machine is up for around 2 minutes.
That makes sense. Rob has given the answer earlier. You need to load the
driver in /boot/loader.conf.
Post by Harry Doyle
maybe i will try the hda enable in
rc.conf
No, /boot/loader.conf. But is your card a hda? It would help a lot if you post
the output of "pciconf -lv" relevant for the soundcard and/or show us what
exactly you are doing in /usr/local/etc/rc.d with that driver.

For example, this is mine:
***@pci0:31:5: class=0x040100 card=0x016a1028 chip=0x24c58086 rev=0x01
hdr=0x00
vendor = 'Intel Corporation'
device = '82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller'
class = multimedia
subclass = audio

Driver loaded by:
# grep ich /boot/loader.conf
snd_ich_load="YES"
Post by Harry Doyle
, but it doesn't seem ac97 on unix is as well supported as the
windows drivers so i need the particular driver i downloaded (i might be
wrong).
Ac97 is a codec used on a multitude of soundcards to produce pcm audio AFAIK,
so there's no specific driver for it.
--
Mel
Ariff Abdullah
2007-09-18 21:49:44 UTC
Permalink
On Tue, 18 Sep 2007 18:18:23 -0300
Post by Harry Doyle
hi guys,
i've tried a couple suggestions, but nothing is working for me. here
is a few things from the console that might be helpful. no xwindows
on this machine, it's just a base freebsd network install with only
the necessary packages installed to do the audio stuff it needs to
do.
radio# mixer
Mixer vol is currently set to 100:100
Mixer pcm is currently set to 0:0
Mixer speaker is currently set to 75:75
Mixer mic is currently set to 0:0
Mixer cd is currently set to 75:75
Mixer rec is currently set to 7:7
Recording source: mic
radio# uname -a
FreeBSD radio 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12
11:05:30 UTC 2007
when i issue /etc/rc.d/mixer stop then reboot, the mixer shows set
to 7:7, but then it still clips like it does on 90. then i set
mixer to 7 and it says setting mixer fro 90 to 7.
i am thinking that /etc/rc.d/mixer gets invoked before kldload loads
Why not putting snd_whatever_load=YES into /boot/loader.conf ? That is
the proper way, once you know the exact module for your soundcard.

.. and please remember to use "shutdown -r now" rather than "reboot"
or "halt". That's the way to preserve mixer settings across boot/power
cycle.
Post by Harry Doyle
the driver because both dmesg and mixer tell me there is no mixer
device till the machine is up for around 2 minutes. maybe i will try
the hda enable in rc.conf, but it doesn't seem ac97 on unix is as
well supported as the windows drivers so i need the particular
driver i downloaded (i might be wrong).
--
Ariff Abdullah
FreeBSD

... Recording in stereo is obviously too advanced
and confusing for us idiot ***** users :P ........

Norberto Meijome
2007-09-18 00:27:10 UTC
Permalink
On Mon, 17 Sep 2007 16:22:03 -0300
Post by Harry Doyle
hello everyone,
i am running a freebsd server to stream my local campus station's radio
broadcast to the net. i am using the stock ac97 audio, and using a little
script in /usr/local/etc/rc.d which uses kldload to load the driver.
it'd be better to simply add to /boot/loader.conf.local (or loader.conf , i
prefer to have it clearly defined)
{DRIVER}_load="YES"

eg, for my Intel HDA i have
snd_hda_load="YES"
Post by Harry Doyle
i have to issue mixer rec -83 to get the audio down to a decent level (very
hot coming out of the mixer but i can't change that for other reasons). i
have tried to script this mixer command into startup by putting a sleep
command and then the mixer command, and also by using the /boot/boot.hints
file.
however whenever i reboot the machine the mixer command always shows the
default level of 90 which clips pretty hard.
either
1) have a script that sets your levels . mine is saved by the OS,, but
sometimes i need to do it by hand, so i use this script:

[***@ayiin] [Tue Sep 18 10:23:27 2007]
/usr/home/betom
$ cat bin/set_mixer.sh
#!/bin/sh
## Feedback fixed!!! mic == 0
mixer vol 86:86 pcm 86:86 speaker 49:49 mic 0:0 cd 40:40 rec 100:100 =rec mic
--

of course, your device may be different, so adjust accordingly.

2) to save the values, check /etc/rc.d/mixer. mixer_save is called on stop, so
a) set your levels
b) add to /etc/rc.conf
mixer_enable="YES" # Run the sound mixer.

c) run /etc/rc.d/mixer stop
d) reboot + verify they are set to the right thing. In theory, they should be
saved everytime to reboot..

( i just realised i dont actually have that line in rc.conf...but my levels are
kept across reboots..so all is good... :)
Post by Harry Doyle
also, the sound driver doesn't seem to load until around 2 minutes after i
can log into a fresh boot (not a problem, just some extra info). how can i
script my default rec level on boot?
use /boot/loader.conf.local

_________________________
{Beto|Norberto|Numard} Meijome

"The freethinking of one age is the common sense of the next."
Matthew Arnold

I speak for myself, not my employer. Contents may be hot. Slippery when wet.
Reading disclaimers makes you go blind. Writing them is worse. You have been
Warned.
Continue reading on narkive:
Loading...