Chapter 2. Audio
2.1. Hacks 1346: Introduction
Many people in the Linux community believe that choice is good. Perhaps second only to text editors, audio applications under Linux truly embody this philosophy. Even if you limit yourself to
Everyone listens to music differently. Some people listen to a single CD or album, every track in sequence. Others put their entire music collection on shuffle. Some people like minimalist audio players while others want every option and effect under the sun. With all the audio choices under Linux, no matter how you like to listen to your music, Linux has an application that fits. Beyond simply listening to music, Linux also has a number of tools to help you rip, mix, manage, and burn your audioeven "scratching" your digital audio is possible.
In this chapter, I highlight some of the best Linux audio applications. There are also hacks in this chapter that take you through the full audio extraction process from ripping CDs to encoding them to tagging the resulting files. Linux has a number of amazing audio tools to automate common
Hack 13. Mix Your Audio for Perfect Sound
Use the mixer to understand and tweak the different volume levels your sound card provides .
Almost every audio device you encounter has some way to control the volume, whether through a volume knob on a radio, the remote control on a television, or the series of controls on a sophisticated sound board. To control the sound on a Linux system, you use a mixer program. Even though the purpose of the mixerto change the volumeis simple, often the sheer number of options the mixer provides can
You can launch a mixer program a few different ways. If you use the GNOME or KDE desktop environments, the quickest way to access the mixer is to click the speaker icon on the desktop panel. Windows users will find this applet similar to the speaker on the Windows taskbar. A single click on the icon lets you change the master volume (see Figure 2-1); a right-click shows you various options for the mixer applet. For common volume control, you may only need to access the master volume. To access all of the advanced volume controls, double-click on the applet to launch a complete mixer.
Figure 2-1. Panel Mixer applet
Whether you use OSS or ALSA sound drivers, you will find a base set of volume controls in a mixer application that are based on the default volume controls on the OSS mixer (
). OSS is the older of the two sound systems. As such, it is often more stable than ALSA, although a number of newer sound cards are only partially supported in their OSS drivers, if at all. OSS is still present in the latest Linux
2.2.1. Command-Line Mixer Applications
In addition to whatever mixer program your desktop environment provides, there are some basic command-line mixer programs you can use to access the same volume controls without using a mouse. Two common commandline mixers are aumix and alsamixer . aumix is an OSS mixer with some particularly useful features for scripting, and alsamixer is the default commandline mixer program for ALSA.
aumix provides you with access to the standard OSS mixer controls completely from the command line. If you type aumix at the command line with no arguments, you will enter its interactive mode, where you can use the up and down-arrow keys to switch between mixer controls and the left-and right-arrow keys to change the volume of the selected control. Hit the m key to toggle mute on a control, and press Tab or Enter to switch between the volume and balance controls for a device.
aumix really becomes useful with command-line arguments. All the different mixer controls are assigned an argument as listed in Table 2-1.
Table 2-1. Common aumix command-line arguments
Each of these arguments can accept a number of options such as q to query the current level for the device, and + and - to increment and decrement the volume by a single level. You can also specify a particular volume level by using a number instead of + or -, or you can even follow + or - with a number to control how much to increment or decrement. For example, to set the master volume to 50%, increase PCM by ten and increase the line out by one, type:
$ aumix -v 50 -w+10 -o+
This functionality is particularly useful to bind
commands to key sequences so that you can mute your sound with a quick