Hack18.Manage Your Audio with XMMS


Hack 18. Manage Your Audio with XMMS

XMMS is a classic Linux audio player you can use to easily play a number of different audio file types.

A number of audio players are available under Linux, but XMMS is a classic that you are likely to find available no matter which Linux distribution you use. XMMShas an interface similar to Winamp under Windows and can play most popular audio formats, including MP3, WAV, Ogg Vorbis, and audio CDs, along with many other formats, if you install the proper input plug-in.

The default XMMS interface has controls to play, pause, stop, and skip forward and backward in your playlistbelieve me, they're all there, just very tiny. To open the playlist editor, click the button labeled PL on the interface, right-click on XMMS, and select Playlist Editor, or type Ctrl-E. Within the playlist editor, you can add, delete, arrange, and sort tracks. To add tracks, select the add button and browse to the directory, or simply drag and drop files from your file manager onto the playlist. You can also save playlists you have created so that you can refer to them later. All playlist options that are available via buttons on the bottom of the interface can also be accessed if you right-click on the playlist. The audio settings are adjusted with the equalizer. To display the equalizer, click the EQ button next to the PL button on the interface, right-click, and select Graphical EQ, or type the keyboard shortcut Ctrl-G.

XMMS supports streaming audio. To add a streaming audio source to the playlist, click Add URL and type in the URL.


Once the playlist has been set up, click the play button or type x. The buttons to control playback including previous track, play, pause, stop, and next track can be accessed with z, x, c, v, and b, respectively. Notice how all of the keys on the keyboard line up in the same order as on the interface. As a track is playing, you can control the volume and balance directly from the main window. To skip ahead in a track, just click and drag the long bar that slowly progresses along the window. The main window also has checkboxes so that you can toggle shuffle and repeat modes for the playlist.

2.7.1. Plug-ins

XMMS is a highly configurable application that supports a number of plug-ins for input, output, visualization, and other options. The most popular plug-ins can be downloaded directly from http://www.xmms.org and extracted into your ~/.xmms/Plugins directory. Right-click XMMS and select Options Preferences or type Ctrl-P to access additional XMMS options. The preferences window (see Figure 2-3) has tabs organizing different XMMS plug-ins and options:

Figure 2-3. XMMS Preferences



Audio I/O Plugins

This tab lets you enable a number of input plug-ins that XMMS supports. You can enable support for different audio file formats including Ogg Vorbis and FLAC, plug-ins that let you play MPEG videos, and a number of other types of input. The Output Plugin section lets you configure how XMMS outputs sound. If your sound card supports OSS (whether natively or through the ALSA OSS compatibility layer), the default OSS driver output plug-in should work fine. Alternatively, if you want to directly use ALSA, choose that output plug-in. If you use EsounD to manage multiple audio streams, enable that output plug-in here.


Effects Plugins

This tab lets you enable and configure several effects plug-ins written for XMMS. For instance, you can install a Volume Normalizer plug-in that makes all the sound output stay around the same volume so you don't find yourself raising the volume for a particularly quiet song, just to have your eardrums blasted if the next song is extra loud. There are a number of other useful effects plug-ins, including ones that cross-fade between tracks, provide extra stereo, and create echoes in the music.


General Plugins

This tab is a catch-all location for plug-ins that don't fall into any of the other plug-in categories. Here you will find plug-ins that let you control XMMS with a joystick or remote control (if you have an IR receiver configured; see "Take (Remote) Control" [Hack #79]), along with a number of other miscellaneous features. To configure one of the plug-ins, select it and then click the Configure button.


Visualization Plugins

This tab shows all of the different visualization options XMMS has beyond the standard display in the main window. These plug-ins can be pretty fun to enable, as they provide a lot of colorful visuals to match the music you are listening to. Plug-ins in this category range from simple and three-dimensional spectrum analyzers, to plug-ins that have Tux the Linux mascot disco-dancing to your music (which is a fun thing to run in the background at a party).


Options

This tab lets you configure most of the common XMMS options you might want to change. One particularly interesting option is the Use real-time priority when available. To use this option, you must run XMMS with root privileges, and when enabled, XMMS will run with real-time priority, which gives it priority over other apps seeking CPU time, resulting in fewer skips during heavy CPU load.

Some people find the default look of XMMS too "techno." You can download new skins directly from XMMS's official site at http://www.xmms.org and save them in ~/.xmms/Skins. Right-click on XMMS and select Options Skin Browser to choose one of the skins you downloaded


2.7.2. XMMS Command-Line Control

One of the particularly useful features of XMMS is that you can control much of it directly from the command line. Table 2-2 lists some of the more useful XMMS command-line arguments.

Table 2-2. Common XMMS command-line arguments

Argument

Function

-r, --rew

Skip backward in the playlist.

-p, --play

Start playing the current playlist.

-u, --pause

Pause the current song.

-s, --stop

Stop the current song.

-t, --play-pause

Toggle between paused and play states.

-f, --fwd

Skip forward in the playlist.

-e, --enqueue

Add the following file(s) to the playlist without clearing the playlist first.


The playlist control options are especially handy if you have a multimedia keyboard, as you can use your desktop environment's keybinding editor to run the particular XMMS command for that function. Even if you don't have a multimedia keyboard, you might want to bind a key sequence to some of these keys. For example, to toggle between pause and play, tell your keybinding program to run xmms --play-pause.

The -e option is also useful to quickly add tracks to the playlist. To add, for instance, your entire Ramones collection to the playlist, you could type:

 $ xmms -e  ~/mp3/ramones  

Of course, change the path to the path of the files you wish to add. If you ran that same command without the -e option, XMMS would still load those files into the playlist, but it would also clear out the playlist beforehand. When XMMS exits, it remembers the contents of the playlist, and next time you start it, it will reload that playlist unless you tell it otherwise.

Since XMMS can be controlled from the command line, you can also control it remotely or from a script. Simply write a script containing the commands you want to run and schedule it via cron or at. I've used this feature along with aumix to control the volume and create a quick alarm clock. This also means you can control XMMS over ssha fun way to play a trick on a co-worker or roommate.





Linux Multimedia Hacks
Linux Multimedia Hacks
ISBN: 596100760
EAN: N/A
Year: 2005
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net