July 8th 2014

I've recently fallen hard for a couple of command line tools that have improved my music listening experience on my laptop manifold. Beets calls itself a "[...] media library management system for obsessive-compulsive music geeks" while Cmus is a keyboard driven console based music player.

Organizing music with Beets

Beets will make your life easier by organizing your music in the right folders, make sure the files are correctly tagged, download covers, lyrics etc. If I've acquired a new album, typing beet import /path/to/album will take care of everything from filenames and directories to tags.

On Ubuntu you can install beets via aptitude sudo aptitude install beets or pip pip install beets. If you like me start out with a fairly well tagged music collection, you can do an initial import of your library by typing beet import -A /path/to/you/music. This will import all the files without looking up every single album online which for large collections would take a war. To setup beets, edit the config file by typing beets config -e which will open up the config file in $EDITOR. There is a comprehensive documentation of Beets online, but to get started here is a copy of my own config file:

import:
    move: yes
    write: yes
plugins: fetchart lastgenre web
art_filename: cover
threaded: yes
paths:
    default: $albumartist/$year - $albumartist - $album/$track %title{$title}

In brief, move and write ensures that when I import a new folder, the songs are moved and not copied (move), and their tags are updated (write). I enable the plugins fetchart, lastgenre and web to let Beets fetch covers and find the genre automatically and allow for streaming. threaded makes the audiotagger use multiple threads while the paths option specifies how to save a file in a simple template language.

Listening to music with Cmus

Because Cmus is terminal based, all interactions take place using the keyboard. This is hard to learn initially, but really nice once you become familiar with the interface.

Typical Cmus interface

Typical Cmus interface

Once you open the player you have access to 7 different windows. To access them use the numbers on your keyboard:

    1 - Hierarchal library browser
    2 - Flat (Itunes-like) library browser
    3 - Playlist (I usually just use the queue)
    4 - Queue
    5 - File browser (useful for adding music)
    6 - Filters (I haven't used this yet)
    7 - Settings and keyboard shortcut

To get started, add your music directory by typing :add /path/to/music. You can now press 1 and explore your library using the up and down arrows and the following shortcuts:

    a - Append to queue
    D - delete from drive (capital D)
    j - Go down (from Vi)
    k - Go up (from Vi)
    q - Quit
    g - Go to very top
    G - Go to very bottom
    / - enter search terms afterwards to search in any window

To control the music playing you can use the bottom row just above the space bar:

    z - Previous song
    x - Play
    c - Pause
    v - Stop
    b - Next

Finally, I personally prefer to listen to my music on an album by album basis. It's hard to find audio players that come with a random album feature that populates the playlist with a full album picked at random, but I'm not let down by Cmus which allows the following commands:

    :lqueue n - Add n random albums to the queue
    :tqueue n - Add n random tracks to the queue
    :shuffle  - Shuffle List
    :clear    - Clear all songs from the queue

Cmus comes with an excellent man page which outlines the 999 features that I haven't covered here. Read it online here or in a terminal window by typing man cmus after installing.