Linux historically had a reputation of lacking good support for sound and multimedia applications in general. However, great strides have been made in recent years to correct this, and support is now a lot better than it used to be. (It might make you smile that Microsoft no longer supports the Microsoft Sound Card, but Linux users still enjoy support for it, no doubt just to annoy the folks in Redmond.) UNIX, however, has always had good multimedia support as David Taylor, UNIX author and guru, points out:
That last sentence sums it up quite well. UNIX had a limited range of hardware to support; Linux has hundreds of sound cards. Sound card device driver support has been long lacking from manufacturers, and there is still no single standard for the sound subsystem in Linux. In this section, you learn about sound cards, sound file formats, and the sound applications provided with Ubuntu. Sound CardsUbuntu supports a wide variety of sound hardware and software. Two models of sound card drivers compete for prominence in today's market:
Ubuntu uses ALSA because ALSA is the sound architecture for the 2.6 series kernels. ALSA supports a long list of sound cards. You can review the list at http://www.alsaproject.org/alsa-doc/. If your sound card is not supported, it might be supported in the commercial version of OSS. You can download a trial version of commercial software and test your sound card at http://www.opensound.com/download.cgi. Ubuntu detects most sound cards during the original installation. If you add or replace a sound card after the initial install, Ubuntu will automatically detect and configure it at the next reboot. Recording SoundUbuntu provides a number of tools that enable you to control volume, mix, and other sound recording functions. The Kmix sound mixer (available when you install the KDE window manager or Kubuntu) acts as a virtual mixing board, taking sound inputs from different sources, enabling you to adjust their individual volumes, mute them, and listen to them through your sound card. If you need to control sound from command line, use the alsamixer command as seen in Figure 10.6, which can be used to adjust balance or volume in text mode using the left and right cursor keys to select a channel and the up and down keys to adjust the volume. Figure 10.6. Set your sound input and output levels using the text-based alsamixer.$ alsamixer Sound FormatsA number of formats exist for storing sound recordings. Some of these formats are associated with specific technologies, and others are used strictly for proprietary reasons. Ubuntu supports several of the most popular sound formats, including
Note Because of patent and licensing issues, Ubuntu has removed support for the MPEG, MPEG2, and MPEG3 (MP3) file formats in Ubuntu. Although we cannot offer any legal advice, it appears that individuals using MP3 software are okay; it is just that Ubuntu cannot distribute the code. It seemsat this pointperfectly all right for you to obtain an MP3-capable version of Xmms (for example), which is a Winamp clone that plays MPEG1/2/3 files. (You learn more about Xmms in the "Music Players" section later in this chapter.) You can get Xmms directly from http://www.xmms.org/ because that group has permission to distribute the MP3 code. You can also enable the MP3 codec within Ubuntu by using the universe repository. You do this by installing the gstreamer10-plugins-ugly package, which will enable the MP3 codec in all of the Gnome applications. Another alternative is to use the Ogg-Vorbis format; it is completely free of restrictions. An MP3-to-Ogg converter is available from http://faceprint.com/code/. Ubuntu includes software (such as the sox command used to convert between sound formats) so that you can more easily listen to audio files provided in a wide variety of formats, such as AU (from NeXT and Sun), AIFF (from Apple and SGI), IFF (originally from Commodore's Amiga), RA (from Real Audio), and VOC (from Creative Labs). Tip To learn more about the technical details of audio formats, read Chris Bagwell's Audio Format FAQ at http://www.cnpbagwell.com/audio.html. Ubuntu also offers utilities for converting sound files from one format to another. Conversion utilities come in handy when you want to use a sound in a format not accepted by your current application of choice. A repository of conversion utilities resides at http://ibiblio.org/pub/linux/apps/sound/convert/INDEX.html and includes MP3 and music CDoriented utilities not found in Ubuntu. You will have to know how to compile and install from source, however. If you see something useful, have a look at http://www.rpmfind.net/ to locate a binary RPM if you don't feel up to the task. Ubuntu does provide sox, a self-described sound translator that will convert music between the AIFF, AU, VAR, DAT, OGG, and WAV formats, among others. It also can be used to change many other parameters of the sound files. Timidity is a MIDI to WAV converter and player. If you are interested in MIDI and musical instruments, Timidity is a handy application; it handles karaoke files as well, displaying the words to accompany your efforts at singing. Ripping MusicOnce you have decided which codec you want to use (OGG or MP3) the next choice is which tool do you use to extract the music from the CD. There are two main tools that you can use in Ubuntu, both of which have their benefits. They are called Sound Juicer and Banshee. Sound JuicerSound Juicer is provided as part of the base install of Ubuntu and works with Rhythmbox, the music management application. Sound Juicer launches itself when you insert a music CD and will attempt to retrieve track listings from the Internet (see Figure 10.7). You can also use it to play audio CDs before extracting the audio data. It is fairly basic, and only offers extraction, but you are able to specify which codecs you want to use, as well as several other options. Figure 10.7. Sound Juicer at work, seen here after retrieving data from the Internet.BansheeBanshee is a mono-based application, which means that you will need to install mono before you can run Banshee. When you select to install Banshee through synaptic it will automatically include mono for you, taking the pain out of installation. Banshee itself actually does a variety of things, but it does allow you to extract audio data from CDs in the same way as Sound Juicer. However, it does not stop there as it also helps you manage your music collection and also syncs to iPods and other removable devices. We will discuss the other features of Banshee later on, but for now we will look at extracting music from CDs.
By default Gnome opens Sound Juicer when you insert an audio disc, but it is easy to change this to Banshee by using the Removable Drives & Media tool in the Preferences menu. Under the Multimedia tab, change Sound Juicer to Banshee, which will mean that whenever you insert an audio disc now, Banshee will automatically load, ready for you to import the disc to Ubuntu. Importing itself is very easyonce Banshee has retrieved any track listing, simply click the Import CD button as seen in Figure 10.8. Banshee will start to encode the audio data into your preferred codec and will store the files in the ~/music directory. Figure 10.8. Banshee is a relatively new application, and can easily handle ripping CDs to your hard drive.Music PlayersUbuntu provides access to various music players. One of the most popular is Xmms, a Winamp clone, which in the full version can play not only music, but MPEG1/2/3 video as well. Xmms (see Figure 10.9) supports a number of plug-ins that can add dancing, lighted oscilloscope-like displays, redirect its output to other devices, support unusual file formats, sync animations to the music, and otherwise increase its geek appeal exponentially. Xmms used to be included in the base Ubuntu distribution, but has now been shifted to Extras, so you will need to use yum to install it. Figure 10.9. The ever-popular Xmms music player, seen here playing a local MP3 file.
The default music player is Rhythmbox, which is designed to play music files from playlists and Internet radio stations much like Xmms. It is found in the Sound & Video menu as the Music Player menu item. You can also use it to subscribe to podcasts available through the Internet. Figure 10.10 shows Rhythmbox working with podcasts. Figure 10.10. Rhythmbox can handle podcasts, Internet radio stations, CDs, and local sound files.As mentioned earlier, Banshee can be used to handle your music library. It could be classed as an Apple iTunes lookalike, but it does not have access to the iTunes Music Store. Within Banshee you can store cover art for your CDs, create playlists and burn them to CDs. Although a fairly new application, it already has a raft of features and is sure to be expanded in future. Figure 10.11. The new kid on the block, Banshee makes quick work of music management.Streaming AudioStreaming audio is for playing games, listening to Internet radio, and other online audio content. Streaming audio is designed to produce an uninterrupted sound output, but it requires the system to perform a content juggling act. Essentially, the system's audio buffer is continually filled with audio information, which is fed to the buffer through the system's Internet connection. Because of server and connection capabilities, the rate of input might vary. Because audio is used at a constant rate, the trick to managing streaming audio is to always keep the buffer full, although you might not be able to fill it at a constant rate. Streaming audio is handled in Ubuntu in the .m3u format. The MPEG formats are also used for streaming audio. Although Xmms supports streaming audio, another popular application is the Real Player, available from http://www.real.com/linux/. An excellent resource for music and sound in Linux is http://linux-sound.org/. The Network Audio section of that website contains an extensive list of streaming audio applications. The Icecast application, not provided with Ubuntu, is a popular streaming audio server. You can use Icecast to serve your MP3 music collection over your home LAN. You can learn more about Icecast at http://www.icecast.org/. A nice tutorial on Icecast is available at http://www.linuxnetmag.com/en/issue4/m4icecast1.html. Tip You can also read Chapter 22, "File and Print," to see how to use the Network File System (NFS) to mount a remote directory of music files over your network. |