Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I press the mute key on my keyboard, both the Alsa master channel and the PulseAudio master channel get muted, pressing it again only unmutes the alsa master channel, the pulseaudio master channel keeps muted. Result: no sound. How do I fix that?

share|improve this question

10 Answers 10

up vote 6 down vote accepted

Run this command:

amixer -D pulse set Master 1+ unmute
share|improve this answer
9  
Can you explain what this command does so other users know? –  hexafraction Aug 17 '12 at 12:12

I had the same problem running MATE desktop on a Linux Mint Debian Edition (201204).

"Volume up" action was not able to unmute the volume. I realised that the problem was with Pulseaudio, but the package mate-media-gstreamer and mate-settings-deamon-gstreamer where installed by default. By installing mate-media-pulse and mate-settings-deamon-pulse (that uninstalled mate-media-gstreamer and mate-settings-deamon-gstreamer) and tadam ... "Volume up" action was able to unmute the volume again !

I hope this will also work for you!

share|improve this answer

it is much simplier though.

amixer -D pulse set Master Playback Switch toggle

set this as a hotkey to "Mute\Unmute". volume controls can be left as they are.

Mint 15 Mate - figured it out by myself, works fine for me.

share|improve this answer

It is a problem with pulseaudio,the commands for alsa or amixer will not properly send unmute to pulse. When alsa commands send a mute signal it is a toggle command(send the same command to mute/unmute).

Now in pulseaudio they have separate mute and unmute code! Many report that un-installing pulseaudio will solve the problem, but for some that is not really an acceptable answer (like me, because pulse is useful for many apps).

So to solve this we need to make a script,

1- Make a new empty doccument in a text editor like gedit or mousepad,

2- Paste this code in the doccument, Soruce of code:2

#!/bin/bash
#### Create ~/.pulse/mute if not exists
ls ~/.pulse/mute &> /dev/null
if [[ $? != 0 ]]
then
    echo "false" > ~/.pulse/mute
fi

####Create ~/.pulse/volume if not exists
ls ~/.pulse/volume &> /dev/null
if [[ $? != 0 ]]
then
    echo "65536" > ~/.pulse/volume
fi

CURVOL=`cat ~/.pulse/volume`     #Reads in the current volume
MUTE=`cat ~/.pulse/mute`          #Reads mute state

if [[ $1 == "increase" ]]
then
    CURVOL=$(($CURVOL + 3277)) #3277 is 5% of the total volume, you can change this to suit your needs.
    if [[ $CURVOL -ge 65536 ]]
    then
        CURVOL=65536        
    fi
elif [[ $1 == "decrease" ]]
then
    CURVOL=$(($CURVOL - 3277))
    if [[ $CURVOL -le 0 ]]
    then
        CURVOL=0        
    fi
elif [[ $1 == "mute" ]]
then
    if [[ $MUTE == "false" ]]
    then
        pactl set-sink-mute 0 1
        echo "true" > ~/.pulse/mute
    exit    
    else
        pactl set-sink-mute 0 0
        echo "false" > ~/.pulse/mute    
    exit
    fi
fi

pactl set-sink-volume 0 $CURVOL
echo $CURVOL > ~/.pulse/volume # Write the new volume to disk to be read the next time the script is run.

3- Name the file "volume" (no extension needed) put it somewhere you can find and won't delete it like your home folder

4- Make the file executable by Right-clicking on the file, go to Properties, then the Permissions tab, and use the check box to mark it executable, this will allow the script to be run. mark-file-as-executible-gui

5- Next we need to link the commands to the keyboard, the commands for the code are increase, decrease, and mute.

So go to the keyboard settings - how-do-i-change-my-keyboard-shortcuts-in-xubuntu, In the keyboard shortcuts area, click add, then open, Open the "volume" file we created, then add the command for the code after volume, reading volume increase, or volume mute ect. but with the location of where the code file is before it like "/home/username/volume mute"

Then assign it to the keyboard by pressing the key it, or if the key is already used,
~ Most likely the case ~ find them and replace the command.

The key shortcuts are likely called XF86AudioRaiseVolume, XF86AudioLowerVolume, XF86AudioMute. Since only the mute is broken concentrate your efforts on changing that out first.

Bug: 1

share|improve this answer
    
I just have XF86AudioMute mapped to the command amixer set Master toggle. The raise and lower vol keys get mapped similarly to amixer commands. –  Chan-Ho Suh May 1 '12 at 5:00
    
@Chan-HoSuh are you having the same problem? you can just call on the mute command of this script if you want, for some reason pulse was intercepting the mute on my machine, the amixer sends a toggle, which is interpreted as just mute by pulse, or just intercepting the key press? I was using a similar script that showed a volume bar before :( , but this mutes and unmutes, and they now have the notifications, so it's all good, the toggle is how it was set up before. –  Mateo May 1 '12 at 5:25
    
One small improvement to the script is to also force unmute on volume increase/decrease. I also added 'paplay /usr/share/sounds/ubuntu/stereo/message.ogg' to get feedback on the volume. –  dma Jan 28 at 0:18

See:

https://bugs.launchpad.net/xfce4-volumed/+bug/883485/comments/3

xfce4-mixer has a setting for active-card, that must be set to Pulseaudio, otherwise it will be using Alsa.

share|improve this answer

Worked for me on 12.10:

    #!/bin/sh
    amixer -c 0 sset Master,0 mute
    sleep 5
    amixer -D pulse set Master 1+ unmute
share|improve this answer

For KDE and kmix users, if you use this script you will still have the visual feedback working:

#! /bin/bash

DBUS=qdbus 2> /dev/null

case "$1" in
  volup)
        pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 0
        ${DBUS} org.kde.kmix /kmix/KMixWindow/actions/increase_volume com.trolltech.Qt.QAction.trigger
        ;;
  voldn)
        pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 0
        ${DBUS} org.kde.kmix /kmix/KMixWindow/actions/decrease_volume com.trolltech.Qt.QAction.trigger
        ;;
  mute)
        ${DBUS} org.kde.kmix /kmix/KMixWindow/actions/mute com.trolltech.Qt.QAction.trigger
        pactl set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo $(${DBUS} org.kde.kmix /Mixers/0/Master_0 org.kde.KMix.Control.mute | sed 's/false/0/g;s/true/1/g')
        ;;
  *)
    echo "Usage: mixctl <volup|voldn|mute>" >&2
    exit 1
    ;;
esac

exit 0

Usage:

1) Save it as ~/bin/mixctl
2) Unmap the default kmix keyboard shortcuts for Volume Up/Volume Down and Mute
3) Create three new custom keyboard shortcuts named 'Volume Up', 'Volume Down' and 'Mute'
--> shortcut type: command
--> as the commands use ~/bin/mixctl volup, ~/bin/mixctl voldn and ~/bin/mixctl mute respectively

share|improve this answer

I had the same problem on multiple Xubuntu 12.04 machines which were upgraded to XFCE 4.10. Here is a very quick way solve this problem from the command line (or with a bash script).

Unlike previous solutions which offer stop-gap scripts, this solution fully restores the function of the mute/unmute button.

Simply issue the following two commands once, to resolve the problem once and for all:

$ xfconf-query --channel xfce4-mixer --property /active-card --set PlaybackInternalAudioAnalogStereoPulseAudioMixer --reset
$ xfconf-query --create --channel xfce4-keyboard-shortcuts --property /commands/custom/XF86AudioMute --type string --set 'amixer -D pulse set Master 1+ toggle'
share|improve this answer

You can use the keyboard settings to set the mute button to execute the command found HERE. Although the first method listed on this link was useless for me, the second one works great for XFCE4: $ pactl set-sink-mute 0 toggle. You can also create a script or launcher to execute the command on mouse click.

FYI, if you're using something like Cinnamon (and probably other gnome-based desktops) user197761's above suggestion seems better, as cinnamon's sound applet recognizes the volume is muted: amixer -D pulse set Master Playback Switch toggle (if you like this latter command, please upvote his/her answer, not mine.)

share|improve this answer

I found a simple solution that works well for me in this forum. In detail, you need to add this to /etc/asound.conf:

pcm.pulse {
    type pulse
}
ctl.pulse {
    type pulse
}
pcm.!default {
    type pulse
}
ctl.!default {
    type pulse
}

And then set a keyboard shortcut for the mute key with the command being:

amixer set Master toggle
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.