Chapter 14. Sound in Linux


14.1. Mixers
14.2. Multimedia Players
14.3. CDs: Playback and Ripping
14.4. Hard Disk Recording with Audacity
14.5. Direct Recording and Playback of WAV Files


Linux includes a wide range of sound and multimedia applications. Some of these applications are part of one of the main desktop environments. With the applications described here, control the volume and balance of playback, play CDs and music files, and record and compress your own audio data.

14.1. Mixers

Mixers provide a convenient means of controlling the volume and balance of the sound output and input of computers. The main difference between the various mixers is the outer appearance of the user interface. However, there are a number of mixers that are designed for specific hardware. One example is envy24control, a mixer for the Envy 24 sound chip. Another one is hdspmixer, which is for RME Hammerfall cards. From the mixers available, select the one that best suits your needs.

[Tip]Starting the Mixer

Generally, it is advisable to open a mixer application before opening other sound applications. Use the mixer to test and adjust the control settings for the input and output of the sound card.

14.1.1. The KDE Mixer Applet

KMix is the default KDE mixer application. It is integrated into the KDE panel as a small panel applet located in the system tray. Click the panel icon (a speaker) to control the volume of your speakers with a control slider. If you right-click the icon, the context menu of KMix appears. Select Mute to switch off the sound output. The panel icon then changes its appearance. Clicking Mute again unmutes the volume. To fine-tune your sound settings, select Show Mixer Window and configure Output, Input, and Switches. Each of the devices featured there has its own context menu that is opened by a right-clicking the device icon. You can mute or hide each one of them separately.

Figure 14.1. The Mixer KMix

The Mixer KMix

14.1.2. The GNOME Volume Control

The GNOME volume control applet for the GNOME desktop can be integrated into the GNOME panel. Click the panel icon to control the volume of your speakers with a simple control slider. To switch off the sound output, right-click the icon and select Mute. The volume control icon then changes its appearance. To unmute the sound output, right-click the icon again and select Mute from the menu. Select Open Volume Control to access the more advanced mixer features, shown in Figure 14.2, “The GNOME Volume Control” (↑Applications). Each sound device has its own mixer tab.

Figure 14.2. The GNOME Volume Control

The GNOME Volume Control

14.1.3. alsamixer

alsamixer can be run from the command line without the X environment, so is entirely controlled by keyboard shortcuts. An alsamixer window always consists of an information area and the volume bars of the devices with their respective names.

Select devices with and or N and P. Use and or + and - to increase and decrease the volume. Control stereo channels independently, using Q, W, and E for increasing the volume and Z, X, and C for decreasing the volume. Use the number keys between 0 and 9 to change the absolute volume quickly. These correspond to 0 to 90% of full volume. Toggle between muted and unmuted state of any mixer control using M. A muted control has MM written below its name.

alsamixer has three different view modes: Playback, Capture, and All. By default, alsamixer is started in playback mode, displaying only those mixer controls relevant for playback (Master Volume, PCM, CD, etc.). Capture displays only those controls used for recording. All displays all controls available. Switch the view modes using F3, F4, and F5 or toggle them using →|.

14.1.4. Look and Feel of Mixer Applications

The look and feel of mixer applications depend on the type of sound card used. Some drivers, like SB Live!, have many controllable (tunable) mixer elements while the drivers for professional sound cards may have elements with totally different names. On-Board Sound Chip

Most of the PCI on-board sound chips are based on AC97 codec. Master controls the main volume from the front speakers. Surround, Center, and LFE control the rear, center, and bass-boost speakers. Each of them has a mute switch. In addition to that, some boards have individual Headphone and Master Mono volumes. The latter is used for the built-in speaker on some laptops.

PCM controls the internal volume level of digital WAVE playback. PCM is an acronym for pulse code modulation, one of the digital signal formats. This control also has an individual mute switch.

Other volumes, like CD, Line, Mic, and Aux, control the loop-back volume from the corresponding input to the main output. They do not influence the recording level, only the playback volumes.

For recording, turn on the Capture switch. This is the master recording switch. The Capture volume is the input gain for recording. By default, this switch is set to zero. Choose a recording source like Line or Mic. The recording source is exclusive, so you cannot choose two of them at the same time. Mix is a special recording source. You can record the currently played signal from this source.

Depending on the AC97 codec chip, special effects, like 3D or bass/treble, are available, too.  SoundBlaster Live! and Audigy Family

SoundBlaster Live! and SB Audigy1 have numerous mixer controls for their AC97 codec chip and DSP engine. In addition to the controls already described, they have Wave, Music, and AC97 volumes to control the internal signal routing and attenuation for PCM, WaveTable MIDI, and AC97 mixing. Keep the volume at 100% to hear all of them. SB Audigy2 (depending on the model) has less controls than SB Live, but still has Wave and Music controls.

The recording on SB Live is similar to on-board chip. You can choose Wave and Music as the additional recording source to record the played PCM and WaveTable signals. USB Audio Devices

USB audio devices usually have a small number of mixer controls. Sometimes they even have none at all. Most devices either have a Master or PCM control switch to control the playback volume.

14.1.5. The Mixer for the Sound Chip Envy24

envy24control is a mixer application for sound cards using the Envy24 (ice1712) chip. The flexibility of the Envy24 chip can result in varying functionalities in different sound cards. The latest details on this sound chip are available in /usr/share/doc/packages/alsa-tools/envy24control. Install the package alsa-tools-gui in order to use envy24control.

Figure 14.3. Monitor and Digital Mixer of envy24control

Monitor and Digital Mixer of envy24control

The Monitor Mixer of envy24control shows the signal levels that can be mixed digitally in the sound card. The signals designated as PCM Out are generated by applications that send PCM data to the sound card. The signals of the analog inputs are shown under H/W In. The S/PDIF inputs are shown to the right. Set the input and output levels of the analog channels under Analog Volume.

Use the Monitor Mixer sliders for digital mixing. The respective levels are displayed in the Digital Mixer. For each output channel, the Patchbay contains a row of radio buttons for selecting the desired channel source.

Adjust the amplification for the analog-to-digital and digital-to-analog converters under Analog Volume. Use the DAC sliders for the output channels and the ADC sliders for the input channels.

The S/PDIF channel settings are made under Hardware Settings. The Envy24 chip reacts to volume changes with a delay that can be configured with Volume Change.