When PulseAudio drives you crazy, let your lovely ALSA to get back
Some time ago I left Debian in case I haven’t enough time for repairing this distro installed on my computer. I like Debian, I like issues it makes, but I was just afraid of problems appearing unexpectedly. I chose Linux Mint, because it just works. It is not as worrisome as Ubuntu for example, where you have to take care about codecs, non-free plug-ins etc. But as it is not pure Debian, it has to be worse :) I encountered some problems with sound and I’m going to tell you about that.
As you can see on the first screenshot, I learn Assembler for Atari for 6502 microprocessor. What is more than needed, is Atari2600 emulator called Stella. It should work perfectly of course, but it didn’t. PulseAudio is still a new invention, so some other projects just don’t work well with PA and you can count Stella in it. That emulator was found problematic by me in default configuration of Linux Mint. It crashes what makes me feeling very sad. I realized that problem appears because of non-ALSA was used. The second issue was connected with TeeWorlds game – sounds in this application didn’t work at all! The another problem was concerning PulseAudio itself. It is not perfect software, so from time to time it goes wrong way and stops working. I have been fed up with PA since I had installed Ubuntu first time. I decided I have to change this situation, so there’s what I did.
I removed Pulse Audio using well-known command apt-get remove. It was pretty easy and I spotted that Stella started working without errors. I was happy as soon as I realized that PA is integrated with Mint, so I missed some functionality. I use my computer not only for programming, reading books or surfing the Web, but also as a simple music player. It happens very often I just turn my monitor off and control music player with keyboard shortcuts. After Pulse Audio removal a volume controller from notification area disappeared and – what is more important for me – keyboard shortcuts concerning controlling volume stopped working, but I found out a solution for that problem.
Using AlsaMixer is not as convenient as it should be. But what more can we do? Just control alsamixer from terminal and even better – with some kick-ass bash scripts. Everybody loves bash, so it would be very nice to use it for controlling volume. There are three scripts which will be useful for such an issue. The first is used to increase volume:
#!/bin/bash
if [ "$1" != "" ]
then
VOLADJ=${1}+
else
VOLADJ=”3+”
fi
amixer set Master ${VOLADJ}
VOLUME=`amixer get Master | grep “%” | awk ‘{print $4}’ | tr -d ‘][')`
TEMP=`echo $VOLUME | tr -d %`
exit 0
To turn volume down we use this script:
#!/bin/bash
if [ "$1" != "" ]
then
VOLADJ=${1}-
else
VOLADJ=”3-”
fi
amixer set Master ${VOLADJ}
exit 0
And this will be useful if you want to mute sounds:
#!/bin/bash
declare -r TEMPVOLFILE=”/tmp/kde-${USER}/volume.tmp”
declare -r CURRENTVOLUME=$(amixer get Master | grep \
‘Front Left:’ | cut -d’ ‘ -f6)
declare -i NEWVOLUMEif [ "${CURRENTVOLUME}" == "0" ]
then
if [ -f ${TEMPVOLFILE} ]
then
NEWVOLUME=$(cat ${TEMPVOLFILE})
else
NEWVOLUME=22
fi
amixer set Master ${NEWVOLUME}
else
echo ${CURRENTVOLUME} > ${TEMPVOLFILE}
amixer set Master 0
fi
exit 0
These scripts were made by Patrick A. Read in 2005. All we have to do now is to save these scripts in one of folders included in PATH, for example in /usr/bin as /usr/bin/louder, /usr/bin/softer and /usr/bin/mute. Now we can use these commands right from our terminal, but it has though nothing similar to keyboard shortcuts. But there’s a one simple move to do now – just add commands in Compiz Config Settings (ccsm package) -> General -> Commands.
And it works now! No more problems with keyboard shortcuts, no more problems with Stella, Teeworlds and other stuff. Yahoo!
Leave a Reply
No Comment
Be the first to respond!