Akom's Tech Ruminations

Various tech outbursts - code and solutions to practical problems
Linux

amixer toggle mutes but does not unmute

Posted by Admin • Monday, July 22. 2013 • Category: Linux

It seems that the common approach to mute the audio in Ubuntu 13.04 is amixer -q sset Master toggle ... which works great when muting, but fails to unmute. This command is, for example, the default for openbox's handling of XF86AudioPlay shortcut.

The problem, it would appear, is that muting the Master channel causes other channels (eg Headphone and Front on my machine) to be muted as well. I have no idea why this works this way and why it doesn't undo what it did... and, frankly, I don't really care that much. It's much easier to code around this, see the following workaround script:


#!/bin/bash

LIST="Master Headphone Front"

if amixer sget Master | grep '\[off\]' > /dev/null ; then
        CMD=unmute
else
        CMD=mute
fi

for CONTROL in $LIST ; do
        amixer -q sset $CONTROL $CMD
done
 
Now, instead of amixer -q sset Master toggle I just run /usr/local/bin/my-mute-script.sh

It simply checks whether the Master channel is [on] or [off], and then either mutes or unmutes the preconfigured list of Channels. To see your list, try "amixer scontents", and look for everything that's [off] when muted.

Update: other people have had this issue.

0 Trackbacks

  1. No Trackbacks

0 Comments

Display comments as (Linear | Threaded)
  1. No comments

Add Comment


You can use [geshi lang=lang_name [,ln={y|n}]][/geshi] tags to embed source code snippets.
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
Markdown format allowed


Submitted comments will be subject to moderation before being displayed.