Nostalgia for those ALSA mixer channels that KMix and GNOME Volume Control used to have?

These days the GUI mixers KMix and GNOME Sound Preferences display PulseAudio devices and streams rather than ALSA mixer channels. For example, prior to its integration with PulseAudio, KMix typically displayed a mixer window that looked like the one below.

KMix showing ALSA channels

KMix with ALSA channels

whereas, today, a KMix window typically looks like the following:

KMix with PulseAudio channels

KMix with PulseAudio channels

 

KMix 3.8 in KDE 4.6.1 does not provide separate speaker and headphone channels. You can alter the headphone and speaker volume by using PulseAudio Volume Control instead (see the picture below), but people are not as familiar with the PulseAudio GUI, and it is yet another step to perform.

PulseAudio Volume Control showing selection of Headphones channel

PulseAudio Volume Control showing selection of Headphones channel

 

If you are like me, you probably end up using KMix (or GNOME Sound Preferences) but also launch ALSA Mixer in a Konsole/Terminal for fine-grained control of the underlying ALSA channels:

ALSA Mixer running in Konsole

ALSA Mixer running in Konsole

This is more hassle, because you launch Konsole/Terminal and you enter the command alsamixer and press F6 (alternatively, use the command alsamixer -c 0 if your sound card is Card 0). The PulseAudio channels are displayed by default if you don’t specify your sound card when you launch ALSA Mixer.

EDIT (January 28, 2012): With recent versions of ALSA Mixer I have found that I must specify the card in the alsamixer command (e.g. alsamixer -c 0) because the command alsamixer alone results in a Segmentation fault message.

It would be handy to have an icon on the Panel or on the Desktop that you could use to launch ALSA Mixer. Well, you can. In fact, as there is also a GUI version of ALSA Mixer (albeit with a few less features than its console equivalent) you can use that instead if you prefer. Below I explain a few of the possible ways you can display ALSA Mixer easily from within a desktop environment.

Change KMix from a PulseAudio mixer to an ALSA mixer

By default KMix displays PulseAudio channels instead of ALSA channels. However, if you want to display the ALSA channels instead (as shown in the first picture above), quit KMix and enter the following command in a Konsole window or in KRunner:

export KMIX_PULSEAUDIO_DISABLE=1 && kmix

If you want to make this permanent then add KMIX_PULSEAUDIO_DISABLE=1 to the file /etc/conf.d/alsasound

Personally, though, I prefer not to do this as I want to control the PulseAudio channels via the KMix mixer. Try running two or more audio/video apps simultaneously and you’ll see what I mean – it’s useful! For example, I can control the volume of various applications separately (handy when you want to check something or are using Skype), as illustrated by the picture below:

KMix showing PulseAudio playback streams tab

KMix showing PulseAudio playback streams tab

and I run ALSA Mixer separately to tweak the underlying ALSA channels. Using Yakuake (or Guake in GNOME) is quite a good way to run ALSA Mixer in a console: it is quick and easy to pop-up a window to launch ALSA Mixer, and ALSA Mixer is displayed in colour at nearly the width of the desktop.

Launch ALSA Mixer GUI from an icon on the Panel

First, use your package manager to install the package alsamixergui. It’s a GUI equivalent of the console ALSA Mixer, but with a few less options.

Once you install it, you should find ALSA Mixer GUI in your desktop environment menu (e.g. Kickoff > Applications > Multimedia > ALSA Mixer GUI). By default this will show the PulseAudio channels, so use the menu editor (e.g. right-click on Kickoff and select Menu Editor) to change the command to the following if your sound card is Card 0:

alsamixergui -c 0

Once you have done this, save the new menu entry, log out and log in again, and when you launch ALSA Mixer GUI from the menu a window similar to the following will pop-up:

ALSA Mixer GUI

ALSA Mixer GUI

To put an icon on the Panel in order to make it even easier to launch ALSA Mixer GUI, just drag the icon from the menu to the Panel and it will be copied to the Panel. Simple as that.

Launch ALSA Mixer in a Konsole docked in the System Tray

You can do this using KDocker, which works in KDE, GNOME, Xfce and other desktop environments.

For KDE, create the following Desktop Configuration File Konsole-alsamixer.desktop (or whatever name you want) and put it in the directory ~/.kde4/Autostart/

[Desktop Entry]
Comment[en_GB]=Console (docked) running ALSA Mixer
Comment=Console (docked) running ALSA Mixer
Exec=kdocker konsole -e alsamixer -c 0
GenericName[en_GB]=Dock Konsole running ALSA Mixer in the System Tray
GenericName=Dock Konsole running ALSA Mixer in the System Tray
Icon=kmix
MimeType=
Name[en_GB]=Konsole (Docked)
Name=Konsole (Docked)
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
KDE System Tray showing Konsole docked using KDocker

KDE System Tray showing Konsole docked using KDocker

Clicking on the docked Konsole icon in the System Tray will pop-up a Konsole window with the familiar ALSA Mixer running in it, as shown in the fourth picture above. Clicking on the icon again will minimise the Konsole to the System Tray.

Launch ALSA Mixer in a Konsole from an icon on the Desktop

For KDE, create the following Desktop Configuration File Konsole-alsamixer.desktop (or whatever name you want) and put it in the directory ~/Desktop/

[Desktop Entry]
Comment[en_GB]=Console running ALSA Mixer
Comment=Console running ALSA Mixer
Exec=konsole -e alsamixer -c 0
GenericName[en_GB]=Konsole running ALSA Mixer
GenericName=Konsole running ALSA Mixer
Icon=kmix
MimeType=
Name[en_GB]=Konsole
Name=Konsole
Path=
StartupNotify=true
Terminal=false
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=

You can change the icon displayed on the Desktop either by right-clicking on the icon on the Desktop and selecting Properties or by editing the file directly. For example, I specified Icon=/usr/share/icons/mono/scalable/apps/kmix.svgz which looks rather retro and I think suits the unsophisticated looks of ALSA Mixer.

Summary

I have not covered all the options for making it easy to display ALSA channels as well as PulseAudio channels, but hopefully one of the above methods will suit your needs or will spur you to experiment.

A fast and easy-to-use scanner of IP addresses and ports

This week I’m working in offices with a local network that uses static IP addressing. Believe it or not, it seems the IT department does not keep a list of configured IP addresses, and sometimes inadvertently configure devices to have the same IP address.

A couple of days ago I was printing quite happily to a networked printer from my laptop in the morning but, when I got back from lunch, found that I couldn’t print any more. It transpired that someone had allocated the IP address of my laptop to a new plotter in my absence. What to do if the organisation has no central list of configured IP addresses? There are too many devices on the local network to check them manually, and I do not have access to them anyway.

So I installed Angry IP Scanner (a.k.a. ipscan), an easy-to-use scanner of IP addresses and ports, and use it to find an IP address that is currently unused on the network.

I wanted to install ipscan by using Gentoo’s package manager Portage. There is no ebuild for it in the Portage main tree, but a quick search of the Web told me that there is an ebuild in a third-party overlay (http://gpo.zugaina.org/net-analyzer/ipscan). Rather than add an external overlay, I decided to install the package using a local overlay:

1. I downloaded the ebuild:

# wget http://gpo.zugaina.org/AJAX/Ebuild/2251131/View --output-document=/home/fitzcarraldo/Desktop/ipscan-3.0_beta4.ebuild

The ebuild contents are as follows:

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=3

inherit java-pkg-2

DESCRIPTION="Angry IP - The fast and friendly network scanner"
HOMEPAGE="http://www.angryip.org"

MY_PV=${PV/_/-}
SRC_BASE="mirror://sourceforge/${PN}/${PN}${PV:0:1}-binary/${MY_PV}"
SRC_URI="amd64? ( ${SRC_BASE}/${PN}-linux64-${MY_PV}.jar )
        x86? ( ${SRC_BASE}/${PN}-linux-${MY_PV}.jar )"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

DEPEND=""
RDEPEND=">=virtual/jre-1.6.0"

INSTALL_DIR=/opt/AngryIP

S=${WORKDIR}

src_unpack() {
        :
}

src_install() {
        local jarname
        use amd64 && jarname="${PN}-linux64-${MY_PV}.jar"
        use x86 && jarname="${PN}-linux-${MY_PV}.jar"
        java-pkg_jarinto "${INSTALL_DIR}"
        java-pkg_newjar "${DISTDIR}/${jarname}"
        java-pkg_dolauncher
}

2. I synchronised the Portage main tree’s ebuilds on my PC with those in the repositories:

# emerge --sync

3. I made sure that /etc/make.conf has the following lines at the end of the file:

PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/"
ACCEPT_LICENSE="*"

4. I created the required directories in the local overlay:

# mkdir -p /usr/local/portage/net-analyzer/ipscan

5. I made sure Portage would not nag me about a missing name for my local overlay:

# mkdir /usr/local/portage/profiles
# echo "local_overlay" > /usr/local/portage/profiles/repo_name

6. I copied the ipscan ebuild into the relevant directory in the local overlay:

# cd /usr/local/portage/net-analyzer/ipscan
# cp /home/fitzcarraldo/Desktop/ipscan-3.0_beta4.ebuild .

7. I generated the manifest for the package:

# ebuild ipscan-3.0_beta4.ebuild manifest

8. I merged the package:

# emerge -1v ipscan

9. I downloaded a 64×64 pixel PNG image of the Angry IP Scanner logo from http://www.angryip.org/icon.png. Then I right-clicked on Kickoff, selected Menu Editor and added an entry for Angry IP Scanner under Applications | System, although I can also launch ipscan from the command line if I want:

$ ipscan

To find an unused IP address on the local network which I can allocate to my laptop whilst I’m working in this office, I launch ipscan and enter the start and end IP addresses of the range I wish to check, and click on Start. The application quickly searches through the IP addresses in that range and lists which are in use and which are not. It’s as simple as that. I then use Network Management to edit the connection and enter the static IP address.

Note that Angry IP Scanner will not detect a live IP address if the device is behind a properly-configured firewall. See the Angry IP Scanner Web site’s FAQ and Documentation pages for further details.