8. Entertainment

While Emacs provides lots of applications and functionality to help get work done, it also provides a medium to play games, listen to music, and do other fun activities.

8.1. Burning a CD

It's become almost necessary to have a CD burner these days, especially if you want to download iso images to install new versions of Linux. The cdrecord application is the recommended tool for burning both audio and data CDs, and it is included in many distributions. However, if you'd like to get the latest version, go to http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html.

cdrecord is a command-line application, so you'll need to open an Emacs command shell (M-x shell) to use it.

The complete directions on how to use cdrecord burn a CD are beyond the scope of this document; however Winfried Tramper wrote an excellent HOWTO on making both data and audio CDs, which is available at http://www.linuxdoc.org/HOWTO/CD-Writing-HOWTO.html. If you are new to burning CDs in Linux, this document is indispensable.

8.2. Playing CDs

The best tool for playing CDs in Emacs is cd-tool. An Emacspeak-enabled version is included with your Emacspeak distribution.

All of the commands that control cd-tool must be prefaced by the command M-x cd-tool. After you type this, you will be prompted to enter the command to execute. For example, if you wanted to start playing a CD, you would type M-x cd-tool, then at the prompt type p (for 'play'). The CD will then start playing.

The commands for cd-tool are listed below:

8.3. Playing mp3s

To play an mp3 music file, you'll need the application mpg123. Although the application is included in a number of distributions, the standard version is not Emacs-native, so you'll need to download an install the Emacs-enabled version. You can download the file mpg123-el-1.24-1.tar.gz (the latest Emacs-enabled version) from Debian at http://http.us.debian.org/debian/pool/main/m/mpg123-el/.

Once you've downloaded the file, you'll need to install it using the following steps:

  1. Open an Emacs shell using the command M-x shell.

  2. Change directories to the directory containing the new file.

  3. Unzip the file using the command gunzip mpg123-el-1.24-1.tar.gz.

  4. Untar the resulting mpg123-el-1.24-1.tar file using the command tar -xvf mpg123-el-1.24-1.tar.

  5. Change directories into the resulting mpg123-el-1.24-1.tar directory. In this directory, you'll see the mpg123.el file. Copy this file into the /usr/shar/emacs/site-lisp directory.

  6. Open your .emacs file and add the following line:

    (autoload 'mpg123 "mpg123" "A Front-end to mpg123" t)
  7. Save and close your .emacs file. Then restart Emacs so that the changes will take effect.

To start playing mp3s, use the command M-x mpg123. You'll be asked for a file name to play. Type in the name of the mp3 to play, then press Return. It should start playing immediately.

There are a number of commands that can be used with mpg123; a few of the more commonly used ones are listed below:

SPC

Play or pause

RET

Play

V

Volume up

v

Volume down

q

Quit

For a full list of mpg123 commands, you can scroll up and down within the application to have them read aloud.

One note about volume in mpg123: in my tests, I found that often the system volume would go way down when I started mpg123, to the point where I could barely hear it. If I exited mpg123, the volume in Emacspeak would continue to be extremely low, regardless of how it was set before I started mpg123. However, if I turned up the volume while in mpg123, not only was it at an acceptable level in mpg123, it was also loud after I quit mpg123.

Another problem that I noticed when using mpg123 is that sometimes when you quit the application, it doesn't seem to relinquish control of the sound card. You'll see evidence of this behavior if you try to play a CD or restart mpg123 - you'll get an error message saying that your sound card is busy or that it's not installed correctly. If you check the list of open Emacs buffers, you'll see that mpg123 is still there, although it's apparently in a questionable state. I have not yet figured out how to remedy this problem; if anyone has any suggestions, please let me know so it can be added to the HOWTO.

If you find yourself listening to a lot of MP3s, there is an mp3 jukebox written by Karl Dahlke available at http://www.eklhad.net/linux/app/jukebox, and a sample config file for the jukebox at http://www.eklhad.net/linux/app/sample.jukerc. At the time of writing, the jukebox was in version 1.0

If you want to rip your own MP3s, under Linux it is a two step process. The first step is to convert the tracks on an audio CD to .wav format, then convert the .wav files to MP3s. There is a great web page by Nathan Robertson on how to do this, located at http://www.nathanr.net/thisout/articles/linux-mp3/.

8.4. Playing games

Emacs has a number of popular games built into it, including Solitaire, Tetris, Dunnet (a text-based adventure game) and Gomoku. For a complete listing of games:

  1. Type C-h p. A list of the available Emacs packages opens in the buffer.

  2. Scroll down to the games entry, then press Enter. A list of all the available games is displayed.

To start a game:

  1. Type M-x, then the name of the game you want to play. For example, to play Dunnet, the text-based adventure game, you would type M-x dunnet. But only do this if you have plenty of time to spare!