Page 1 of 2

Fixing muted speakers bug

Posted: 01 Feb 2011, 15:19
by Ahau
We've had a couple of threads in regards to Porteus starting without sound. Headphones work, but the speakers do not, and this issue is resolved by unmuting the speakers in alsamixer.

I have resolved this issue on my system by adding the following two lines to /etc/rc.d/rc.alsa:

Code: Select all

set Speaker 75% unmute
set Speaker -12dB
I'm not sure if the second line is necessary, as my system boots with sound without it, but I left it in to mimic the "master" setting in rc.alsa. Here it is in context:

Code: Select all

#!/bin/sh
# Load the mixer settings and OSS compatibility for ALSA.
# (the Advanced Linux Sound Architecture)

# A function to load the ALSA mixer settings:
load_alsa_mixer() {
  if [ -r /etc/asound.state ]; then
    echo "Loading ALSA mixer settings:  /usr/sbin/alsactl restore"
    /usr/sbin/alsactl restore
  else
    # It's possible a user might not want to set a default sound state.
    # In that case, do this:  touch /etc/no.asound.state
    if [ ! -r /etc/no.asound.state ]; then
      echo "Setting default ALSA mixer settings."
      # set default mixer volumes for ALSA
      # Taken from the alsaconfig script.
      amixer -s -q <<EOF
set Master 75% unmute
set Master -12dB
set 'Master Mono' 75% unmute
set 'Master Mono' -12dB
set Front 75% unmute
set Front -12dB
set PCM 90% unmute
set PCM 0dB
set Speaker 75% unmute
set Speaker -12dB
mixer Synth 90% unmute
mixer Synth 0dB
mixer CD 90% unmute
mixer CD 0dB
...(File continues from here)...
I then saved the modified rc.alsa to .../porteus/rootcopy/etc/rc.d/

I would appreciate it if others would test this, to make sure it doesn't mess up other systems. If not, we should include this in v1.

Thanks!

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 04:55
by KSA_ARAB
thank you very much, I was looking for idea to make

Code: Select all

set Front 100% unmute
because I have laptop, and the sound is low not like speakers on desktop.

another thing, I had problem with sound device that' USB will load over PCM, so I solved it here

Code: Select all

echo "blacklist snd-usb-audio" >> /etc/modprobe.d/blacklist.conf
echo "modprobe snd-usb-audio" >> /etc/rc.d/rc.local
my question here, is this idea will solve previous problem ???
is not problem if I add blacklist

Code: Select all

echo "blacklist snd-usb-audio" >> /etc/modprobe.d/blacklist.conf
and add line in 'rc.alsa'

Code: Select all

# A function to load the ALSA OSS compat modules:
load_alsa_oss_modules() {
  if modprobe -c | tr _ - | grep -wq snd-pcm-oss ; then
    if ! cat /proc/modules | tr _ - | grep -wq snd-pcm-oss ; then
      echo "Loading OSS compatibility modules for ALSA."
      modprobe snd-pcm-oss
      modprobe snd-seq-oss
      modprobe snd-mixer-oss
      modprobe snd-usb-audio
    fi

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 06:54
by Blaze

Code: Select all

set Front 100% unmute
It's a Good Idea.

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 07:11
by Ahau
@KSA_ARAB I don't know if the solution you proposed above would work, but if you test it out, please let us know. That said, why don't you try the following, to fix your low sound on startup:

Boot in to porteus. Adjust your sounds to how you would like them to be, in alsamixer (this won't work if you have to mess with drivers). Then, run 'alsactrl store'. This will update your sound settings in /etc/asound.state (I may be remembering that filename wrong, but I'm close!). Then, either copy asound.state to /porteus/rootcopy/etc, or create a module for this file, and place it in /porteus/modules. This way, you can have custom sound settings, without messing with rc.alsa. In fact, maybe see if doing this (with your usb speakers unplugged) also fixes the problem with your usb speakers (the next time you boot up with them plugged in).

Good luck!

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 09:22
by brokenman
This is the best way to store sound state for individual machine. /etc/asound.state will contain info for your individual soundcard and it's state.

BTW: alsactl store

I havn't tested your fix yet Ahau ... i will quietly chuckle to myself if this fixes it. It is such a common complaint from people. Then i'll give you a big sloppy pash.

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 16:14
by Ahau
Don't keep me waiting too long, Jay. I'm looking forward to that big sloppy pash.

My guess is that this script (rc.alsa) wasn't tested on enough soundcards. My alsamixer doesn't have a setting for "front", but KSA_ARAB does, apparently. I have Master, Headphone, Speaker, Mic Jack, 3 S/PDIF's, and a Beep.

I had originally fixed this bug by putting a copy of asound.state in rootcopy, but when I looked for asound.state in the base porteus modules to fix it, I couldn't find it! So I realized that it was created on startup, and started hunting for whatever it was that created the config file. rc.alsa has settings for Master, Headphone, Front, but not Speakers, so I took a chance and plugged it in.

Check your alsamixer before you try this fix--if you've been messing with something other than "Speaker" to unmute the Speakers, you'll probably need a different entry in rc.alsa (but my guess is that "Front" and "Speaker" are probably the most common entries).

This leads me to another issue, which I've been debating about reporting in your 32-bit alpha thread. When I add "Sound Mixer" to my taskbar, it loads, but all of the mixers are mapped wrong. Sliding the bar for "Speaker", for example, has no effect on my speaker volume, but sliding the bar for something else does. I don't know if you'll be including that as your default taskbar volume control in future releases, but take a look at this if you are, and I can try to help troubleshoot it.

Re: Fixing muted speakers bug

Posted: 02 Feb 2011, 20:05
by brokenman
Thanks will check it out. I have to adjust IGain and Phoneout in order to get sound. I thought that was a little strange.

Re: Fixing muted speakers bug

Posted: 03 Feb 2011, 09:40
by KSA_ARAB
sorry, for late I was busy with university.

I added blacklist

Code: Select all

echo "blacklist snd-usb-audio" >> /etc/modprobe.d/blacklist.conf
and added this line 'modprobe snd-usb-audio' in 'rc.alsa'

Code: Select all

# A function to load the ALSA OSS compat modules:
load_alsa_oss_modules() {
  if modprobe -c | tr _ - | grep -wq snd-pcm-oss ; then
    if ! cat /proc/modules | tr _ - | grep -wq snd-pcm-oss ; then
      echo "Loading OSS compatibility modules for ALSA."
      modprobe snd-pcm-oss
      modprobe snd-seq-oss
      modprobe snd-mixer-oss
      modprobe snd-usb-audio
    fi
the sound is work fine , PCM over USB.
I can speak by skype without problems.
but

Code: Select all

    set Front 100% unmute
it is not work , I copied 'asound.state' with modification to set Front 100% , but still Front 75%.
nothing changed !

Re: Fixing muted speakers bug

Posted: 03 Feb 2011, 14:13
by Ahau
Thanks, KSA_ARAB!

When you have a chance, could you please post your asound.state file here?

Re: Fixing muted speakers bug

Posted: 03 Feb 2011, 15:11
by KSA_ARAB
you are welcome.
of course,
here you are

Code: Select all

state.Intel {
	control.1 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 64'
		comment.dbmin -4800
		comment.dbmax 0
		iface MIXER
		name 'Front Playback Volume'
		value.0 48
		value.1 48
	}
	control.2 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Front Playback Switch'
		value.0 true
		value.1 true
	}
	control.3 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 64'
		comment.dbmin -4800
		comment.dbmax 0
		iface MIXER
		name 'Surround Playback Volume'
		value.0 64
		value.1 64
	}
	control.4 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Surround Playback Switch'
		value.0 false
		value.1 false
	}
	control.5 {
		comment.access 'read write'
		comment.type ENUMERATED
		comment.count 1
		comment.item.0 'Mic In'
		comment.item.1 'Line In'
		comment.item.2 'Line Out'
		iface MIXER
		name 'Front Mic Jack Mode'
		value 'Mic In'
	}
	control.6 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 64'
		comment.dbmin -4800
		comment.dbmax 0
		iface MIXER
		name 'Headphone Playback Volume'
		value.0 48
		value.1 48
	}
	control.7 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Headphone Playback Switch'
		value.0 true
		value.1 true
	}
	control.8 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 14'
		comment.dbmin 0
		comment.dbmax 2100
		iface MIXER
		name 'Capture Volume'
		value.0 0
		value.1 0
	}
	control.9 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 2
		iface MIXER
		name 'Capture Switch'
		value.0 false
		value.1 false
	}
	control.10 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 2
		comment.range '0 - 2'
		comment.dbmin 0
		comment.dbmax 2000
		iface MIXER
		name 'Mux Capture Volume'
		value.0 0
		value.1 0
	}
	control.11 {
		comment.access read
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Con Mask'
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.12 {
		comment.access read
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.13 {
		comment.access 'read write'
		comment.type IEC958
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Default'
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
	}
	control.14 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'IEC958 Playback Switch'
		value false
	}
	control.15 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'IEC958 Default PCM Playback Switch'
		value true
	}
	control.16 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 1
		comment.range '0 - 64'
		comment.dbmin -4800
		comment.dbmax 0
		iface MIXER
		name 'Master Playback Volume'
		value 48
	}
	control.17 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'Master Playback Switch'
		value true
	}
}
state.U0x46d0x8c6 {
	control.1 {
		comment.access 'read write'
		comment.type BOOLEAN
		comment.count 1
		iface MIXER
		name 'Mic Capture Switch'
		value true
	}
	control.2 {
		comment.access 'read write'
		comment.type INTEGER
		comment.count 1
		comment.range '0 - 3072'
		comment.dbmin 2000
		comment.dbmax 3200
		iface MIXER
		name 'Mic Capture Volume'
		value 610
	}
}

Re: Fixing muted speakers bug

Posted: 03 Feb 2011, 15:24
by Ahau
Try changing that first entry to:

Code: Select all

state.Intel {
   control.1 {
      comment.access 'read write'
      comment.type INTEGER
      comment.count 2
      comment.range '0 - 64'
      comment.dbmin -4800
      comment.dbmax 0
      iface MIXER
      name 'Front Playback Volume'
      value.0 64
      value.1 64
I've changed the values at the end from 48 to 64 (from 75% to 100% of the range listed above). Save that to your rootcopy or update your sound module with that file, and see what it does on reboot. If that doesn't work, try changing the value at the end of control.16 to 64 as well.

For some reason, your "surround playback" is at 100%, but your "front" is not.

Re: Fixing muted speakers bug

Posted: 04 Feb 2011, 19:05
by KSA_ARAB
I did what you wrote,
and it's success 'Front = 100%'.

thanks a lot .

Re: Fixing muted speakers bug

Posted: 04 Feb 2011, 19:06
by Ahau
You're very welcome! Glad it's working!

Re: Fixing muted speakers bug

Posted: 04 Feb 2011, 21:25
by brokenman
Worked here too. I owe you one Ahau ... :Rose:

Re: Fixing muted speakers bug

Posted: 04 Feb 2011, 21:32
by Ahau
mmm. Sweet, sweet kiwi lovin. Now it was worth all my trouble...