Bongo — the buffer-oriented media player

Bongo is a flexible and usable media player for Emacs that looks something like this:

Getting Bongo

Romain Francoise has recently packaged Bongo for Debian, so that’s by far the easiest way to get a copy. As of October 2006, the package is in unstable. It’s called ‘bongo’ and it contains everything you need, including volume-el.

If you can’t or don’t want to use the Debian package, you can grab the latest development version using Darcs (“darcs get http://www.brockman.se/software/bongo/”). Bongo itself has no dependencies, except that it needs some backend media player. The tree-from-tags.rb script, on the other hand, depends on Ruby-taglib and Mahoro (both of which are now in Debian — thanks Romain!). If you want to change your sound volume from Emacs like in the screenshot above, you also need a copy of volume-el (“darcs get http://www.brockman.se/software/volume-el/”), which is included in the Debian package for Bongo.

Your media collection

For the best Bongo user experience, your media files should have hierarchical file names. That is, they should be named according to one of the following templates:

In other words, any reasonable combination of ARTIST-NAME, ALBUM-YEAR, ALBUM-TITLE, TRACK-INDEX, and TRACK-TITLE, in the right order (less specific to more specific), should be okay. Embedding the metadata in the file name is not only very practical, but speeds up the process of fetching it.

You don’t have to use “ogg” as the file name extension for all your media, of course, and you don’t have to use “ - ” as the separator. However, you can’t use slash as the separator and just have your files in nested directories. The information needs to be in the basename of each file.

[XXX: This restriction should be relaxed. Maybe by adding a variable called ‘bongo-file-name-roots’, which would define one or more sets of file names that were to be parsed as if “/” were the field separator.]

Many people use tags (e.g., ID3v2 tags or Ogg tags) for their metadata and don’t care about file names. Luckily, Bongo comes with a tool called “tree-from-tags.rb”, which can be used to create a hierarchy of nicely-named symlinks into your tagged media collection. It needs Ruby-taglib and Mahoro to run.

Getting started

Once your media collection is good to go, getting started with Bongo is easy. If you're using the Debian package, you can skip this first paragraph. Otherwise, download Bongo (preferably using “darcs get http://www.brockman.se/software/bongo/”), add the directory to your ‘load-path’, and then run “M-x load-library RET bongo RET”. Here’s what you’ll want to put in your ~/.emacs:

;; Change this to the correct directory name for you.
(add-to-list 'load-path "~/src/bongo")
(autoload 'bongo "bongo"
  "Start Bongo by switching to a Bongo buffer.")

The first thing you might want to do is skim through the customization group for Bongo (run “M-x customize-group RET bongo RET”). It might be fun to browse through all of it, but right now the most important option is ‘bongo-enabled-backends’. This option determines what external programs Bongo will use to play stuff. Bongo will try to find a reasonable set of default backends by looking for the programs vlc, mpg123, ogg123, speexdec, timidity, and mikmod. I recommend that you double-check that this looks good before moving on. You can skip most other stuff for now.

To start Bongo, run “M-x bongo”. To insert a file or a whole directory of files, type “i”. Then hit RET to play one of them.

To see a list of available commands, run ‘describe-mode’ (usually bound to “<f1> m” or “C-h m”). Here are some common ones, for your convenience:

RETStart playing the track at point, and continue playing tracks when that track finishes.
3 RETStart playing the track under point, and continue playing tracks, but stop after playing the third track below point.
C-c C-sStop playback (or start, if already stopped).
3 C-c C-sStop playback after the next three tracks finish playing.
C-u C-c C-sStop playback after each track finishes playing (this is good when playing movies, for example).
C-u C-u C-c C-sStop playback after the track at point finishes playing.
C-c C-nStart playing the next track.
2 C-c C-nSkip the next track and start playing the one after that.
C-u C-c C-nPlay the next track after each track finishes playing (this undoes the effect of C-u C-c C-s).
C-c C-rStart playing a random track.
C-u C-c C-rPlay tracks in random order.
SPCPause playback, if supported by the backend.
sSeek backward or forward, if supported by the backend.
M-p, M-nMove point to the previous or next header line.
I u RETInsert a URI.
I c RETInsert the tracks of an audio CD.
I TABList other kinds of tracks.
lMove point to the current track and recenter.
cCopy the track or section under point.
kKill the track or section under point.
C-wKill all tracks and sections in the region.
yReinsert the last copied or killed stuff.
qQuit Bongo by selecting another buffer.

Here are some commands that are nice if you use library buffers:

eAppend the track under point or the region (if active) to the end of the playlist buffer.
EInsert the track under point or the region (if active) into the playlist buffer, directly below the track that’s currently playing.
3 e, 3 EEnqueue the track at point and the two after that to the playlist buffer.
hSwitch from playlist to library, or vice versa.
C-u hSwitch from playlist to library, or vice versa, leaving the original buffer visible in another window.
C-x C-sSave the current buffer (use “foo.bongo-library” file names for library buffers).

Finally, here are another few handy commands:

rRename the file corresponding to the track under point.
dOpen a Dired buffer containing the track under point.
vChange the audio volume (requires volume-el).