Emms Manual
***********

This is the Manual for the Emacs Multimedia System.

© 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2014, 2015, 2016, 2020, 2021  Free Software Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Introduction
************

Emms is the Emacs Multi-Media System. Emms organizes playlists, allows browsing through track and album metadata, and plays files by calling external players.

This manual tries to be the definitive source of information about Emms, an online version of the manual is available at: http://www.gnu.org/software/emms/manual/.

The basic functionality of Emms consists of three parts: The core, the sources, and the players.

The core resides in emms.el, provides a simple playlist, and the basic functionality to use all the other features of Emms. It provides the common user commands and interfaces for other parts. It thinks in tracks, where a track is the combination of a type and a name - e.g.  the track type 'file has a name that is the file name. Other track types are possible.

To get to tracks, the core needs sources. The file emms-source-file.el provides simple sources to interact with the file system.

When Emms finally has the sources in the playlist, it needs a player to play them. emms-player-simple.el defines a few useful players and provides a straightforward way of providing your own.

The Emms comes with many additional features to extend the functionality beyond the core.

The way Emms works is easy to customize with your own code or by using `M-x customize' or by changing the variables directly.

Quickstart Guide
****************

This chapter demonstrates how to setup Emms so that you can start listening to your music without having to read all of the documentation first. This is the tl;dr version of the manual.

The first thing you do is to load Emms via GNU ELPA. But if you are installing manually, then start by telling Emacs where Emms is located. Let's say you have it in ~/elisp/emms/. So add this line to your .emacs:

     (add-to-list 'load-path "~/elisp/emms/lisp/")

More detailed information about installing Emms can be found in the installation chapter, see Installation.

You'll then want to load Emms into Emacs. To achieve this you invoke the emms-all setup function by adding the following three lines to your Emacs initialization file.

     (require 'emms-setup)
     (emms-all)
     (emms-default-players)

The function emms-default-players in the last line sets up the list of default players. The list contains lightweight specialized players like ogg123 or mpg321 and we-play-everything-players such as mplayer, mpv, vlc, etc.. To be sure that emms can play all your music you should check that your preferred players are installed on the machine.

More detail about setting up Emms can be found in the setup chapter, see Setup.

Emms tries to display the tags (the name of the song, as opposed to the name of the file) of the music you listen to. Emms can use a number of pieces of software and libraries as sources for track info, see Track Information for more.

The last thing to do is to tell Emms where is your music; the root directory of our music collection. Let's say all your music is in ~/Music or in subdirectories thereof:

     (setq emms-source-file-default-directory "~/Music/")

OK, now we've set up Emms. Reload your Emacs initialization file or restart Emacs to let the changes have an effect.

Now we will add all our music to a playlist by invoking M-x emms-add-directory-tree RET ~/Music/ RET. We do this because then Emms will read the tags of all your music files and caches them (the cache is also required for the Emms browser, see The Browser.)

To switch to the playlist buffer, invoke M-x emms-playlist-mode-go or simply M-x emms. You may see that some tracks are displayed with their file name, but as Emms asynchronously populates its tag cache, track by track, the filenames get replaced with the artist and track name of the file's tag.

Go ahead and navigate to a track and hit RET on it to start playback.

Now you can start exploring Emms. It's probably best to begin with the basic commands (see Basic Commands), the interactive playlists (see Interactive Playlists), and the browser (see The Browser).

Installation
************

Emms is available via GNU ELPA, which takes care of all of the following steps automatically.

If you are installing Emms manually, you need to put all the .el files of emms in a directory in your load-path. For example, if you put all those files into ~/elisp/emms/, then in your ~/.emacs, you should add:

     (add-to-list 'load-path "~/elisp/emms/lisp/")

Compiling Emms
==============

If you are using XEmacs, you will need to edit Makefile as follows before continuing.

     EMACS=xemacs
     SITEFLAG=-no-site-file

You can byte-compile Emms by first entering the directory containing the Emms source code, followed by invoking:

make

Which will byte compile Emms. You can then invoke:

make install

Which will install Emms into your Emacs directories (provided you have the appropriate permissions to do so on your system).

Note that Emms is a light-weight and agile program, you can therefore run Emms just fine without byte compiling it.

Setup
*****

The `emms-setup' feature is provided by the file emms-setup.el. It is essentially a collection of shortcuts for loading different Emms features quickly, but everything you can do with `emms-setup' can also be done manually.

We use `emms-setup' by calling one of the setup functions.

 -- Function: emms-minimalistic
     An Emms setup script. Playlists and all the basics for playing media, but nothing else.

 -- Function: emms-all
     An Emms setup script. Loads all the stable features which come with the Emms distribution.

`emms-setup' also comes with a convenience function to set a default list of media players.

 -- Function: emms-default-players
     Set EMMS-PLAYER-LIST to EMMS-SETUP-DEFAULT-PLAYER-LIST.

You can of course write your own Emms setup functions like the above by looking at the existing function definitions in emms-setup.el.

Configuration
*************

This chapter discusses the configuration of Emms in more detail.

The following code fragment provides a minimal Emms setup without using the layer of `emms-setup'. It can maybe be used to better understand the internals of Emms. You can see how Emms needs to know about players (these are defined in `emms-player-simple') and about sources for tracks (trivial file system based sources, such as this `emms-directory-tree', are defined in `emms-source-file').

     (require 'emms-player-simple)
     (require 'emms-source-file)
     (require 'emms-source-playlist)
     (setq emms-player-list '(emms-player-mpg321
                              emms-player-ogg123
                              emms-player-mplayer))

For a discussion on how to define additional players, see Simple Players.

Much of the behaviour of Emms can be changed by setting variables. For example:

     (setq emms-info-asynchronously nil)
     (setq emms-playlist-buffer-name "*Music*")

The first setq turns off the asynchronous updating of info tags. The second sets the default name of the Emms playlist buffer.

Another way to change Emms variables is to use the M-x customize mechanism provided by Emacs.

Finding files and speed
=======================

Emms needs to traverse directories in order to find playable media. The default method Emms uses to achive this is emms-source-file-directory-tree-internal as defined in emms-source-file.el.  The above method is written portably and will always work, but might be too slow if we want to load several hundred tracks (or more).

emms-source-file.el defines another method for finding files, emms-source-file-directory-tree-find which uses GNU/find. emms-source-file-directory-tree-find is usually an order of magnitude faster, but of course will not work if you do not have GNU/find installed.

The method Emms will use is defined in the customisable variable EMMS-SOURCE-FILE-DIRECTORY-TREE-FUNCTION.

Setup Examples
==============

What follow are samples from real-world Emms configurations which show some of the variety and breadth of modifications people make to the default Emms setup.

The following excerpt includes dbus integration, defining a "recent" filter for the see The Browser, persistent playlist via emms-history.el, and enabling sending track information with emms-librefm-stream.el:

       ;; notifications
       (require 'emms-dbus)
       (emms-dbus-enable)
       ;; covers
       (setq emms-browser-covers #'emms-browser-cache-thumbnail-async)
       (setq emms-browser-thumbnail-small-size 64)
       (setq emms-browser-thumbnail-medium-size 128)
       ;; filters
       (emms-browser-make-filter "all" #'ignore)
       (emms-browser-make-filter "recent"
          (lambda (track) (< 30
             (time-to-number-of-days
       (time-subtract (current-time)
             (emms-info-track-file-mtime track))))))
       (emms-browser-set-filter (assoc "all" emms-browser-filters))
       ;; history
       (emms-history-load)
       ;; libre-fm
       (emms-librefm-scrobbler-enable)

In the following it is possible to see how some of defaults are set regarding saving playlists, playlist interaction, as well as adding special arguments to a specific player backend.

       (setq-default
        emms-source-file-default-directory "/mnt/db/mediaCore/sound_music/"

        emms-source-playlist-default-format 'm3u
        emms-playlist-mode-center-when-go t
        emms-playlist-default-major-mode 'emms-playlist-mode
        emms-show-format "NP: %s"

        emms-player-list '(emms-player-mpv)
        emms-player-mpv-environment '("PULSE_PROP_media.role=music")
        emms-player-mpv-parameters '("--quiet" "--really-quiet" "--no-audio-display" "--force-window=no" "--vo=null"))

Getting Help
************

If you have a bug to report, need help, or wish to suggest a feature, please feel free to use the Emms mailing list.  The address of the list is emms-help@gnu.org.  To subscribe to it, visit http://lists.gnu.org/mailman/listinfo/emms-help.

If you are familiar with the Gmane service, there is a Gmane newsgroup which mirrors this mailing address at gmane.emacs.emms.user.

Emms also has a website at http://www.gnu.org/software/emms/.

Formats and Freedom
*******************

Emms is free software, but some of the file formats it can play carry restrictions, they are proprietary file formats. Proprietary software companies are pushing out audio and video formats which restrict when, where and how you can play them, and restrict developers from writing free software which interacts with them.

Restrictive file formats put the corporate bottom-line before the public interest.

Fortunately there are alternatives like Ogg. Ogg is a professional grade multimedia format. Ogg Vorbis is the compressed audio format (like MP3), and Ogg Theora is the video format. For more information, go to http://www.xiph.org/.

If you want to transcode audio into a lossless format, you can try FLAC (Free Lossless Audio Codec). FLAC stands out as the fastest and most widely supported lossless audio codec, and the only one that at once is non-proprietary, is unencumbered by patents and has the source code for a reference implementation freely available. For more information about FLAC, go to http://flac.sourceforge.net/.

Basic Commands
**************

Before you can use the interface commands, you need a playlist to start with. The following commands allow you to add to the current playlist from different sources:

Note that the commands with the ``emms-add-'' prefix add the source to the playlist but do not start playing it immediately. Conversely, the commands with the ``emms-play-'' prefix begin playing the track immediately.

 -- Function: emms-play-file file
     A source for a single file - either FILE, or queried from the user. If called with a prefix the file will be added like emms-add-file.

 -- Function: emms-add-file file
     A source for a single file - either FILE, or queried from the user. If called with a prefix the file will be played like emms-play-file.

 -- Function: emms-play-directory dir
     A source for a whole directory tree - either DIR, or queried from the user.

 -- Function: emms-add-directory dir
     A source for a whole directory tree - either DIR, or queried from the user.

 -- Function: emms-play-directory-tree dir
     A source for multiple directory trees - either DIR, or the value of EMMS-SOURCE-FILE-DEFAULT-DIRECTORY.

 -- Function: emms-add-directory-tree dir
     A source for multiple directory trees - either DIR, or the value of EMMS-SOURCE-FILE-DEFAULT-DIRECTORY.

 -- Function: emms-play-url url
     A source for an URL - for example, for streaming.

 -- Function: emms-add-url url
     A source for an URL - for example, for streaming.

 -- Function: emms-play-playlist playlist
     A source for the M3u or PLS playlist format from the file PLAYLIST.

 -- Function: emms-add-playlist playlist
     A source for the M3u or PLS playlist format from the file PLAYLIST.

 -- Function: emms-play-find dir regexp
     A source that will find files in DIR or EMMS-SOURCE-FILE-DEFAULT-DIRECTORY which match REGEXP.

 -- Function: emms-add-find dir regexp
     A source that will find files in DIR or EMMS-SOURCE-FILE-DEFAULT-DIRECTORY which match REGEXP.

The basic functionality of Emms is just to play music without being noticed. It provides a few commands to skip the current track and such, but other than that it doesn't show up. Emms provides the following basic user commands (which you might want to bind to keystrokes):

 -- Function: emms-start
     Start playing the current playlist

 -- Function: emms-stop
     Stop playing

 -- Function: emms-next
     Start playing the next track in the playlist

 -- Function: emms-previous
     Start playing previous track in the playlist

 -- Function: emms-shuffle
     Shuffle the current playlist. This uses EMMS-PLAYLIST-SHUFFLE-FUNCTION.

 -- Function: emms-sort
     Sort the current playlist. This uses EMMS-PLAYLIST-SORT-FUNCTION.

 -- Function: emms-show &optional insertp
     Describe the current Emms track in the minibuffer. If INSERTP is non-nil, insert the description into the current buffer instead. This function uses EMMS-SHOW-FORMAT to format the current track.

The command emms-show-all will pop up a window with the complete information about the track being played. emms-show-all is provided by emms-show-all.el, which is included in the `emms-all' setup level. See Setup.

The Core File
*************

The core file emms.el provides the all basic functions for playing music, generating playlists and defining players.

User Variables
==============

The core file defines a number of user variables.

 -- User Option: emms-player-list
     A list of players Emms can use. You need to set this in order to use Emms to play media.

 -- User Option: emms-show-format
     The format to use for emms-show. Any "%s" is replaced by what EMMS-TRACK-DESCRIPTION-FUNCTION returns for the currently playing track.

 -- User Option: emms-repeat-playlist
     Non-nil if the Emms playlist should automatically repeat the playlist. If nil, playback will stop when the last track finishes playing.

 -- User Option: emms-track-description-function
     Function for describing an Emms track in a user-friendly way.

 -- User Option: emms-sort-lessp-function
     A function that compares two tracks, and returns non-nil if the first track should be sorted before the second (see also sort).

Hooks
=====

The core file provides hook variables for the basic functionality of Emms.

 -- User Option: emms-player-started-hook
     A hook run when an Emms player started playing.

 -- User Option: emms-player-stopped-hook
     A hook run when an Emms player stopped playing. See also EMMS-PLAYER-FINISHED-HOOK.

 -- User Option: emms-playlist-source-inserted-hook
     Hook run when a source got inserted into the playlist. The buffer is narrowed to the new tracks.

 -- User Option: emms-playlist-selection-changed-hook
     Hook run after another track is selected in the Emms playlist.

 -- User Option: emms-playlist-cleared-hook
     Hook run after the current Emms playlist is cleared. This happens both when the playlist is cleared and when a new buffer is created for it.

 -- User Option: emms-player-finished-hook
     Hook run when an Emms player finishes playing a track. Please pay attention to the differences between EMMS-PLAYER-FINISHED-HOOK and EMMS-PLAYER-STOPPED-HOOK. The former is called only when the player is stopped interactively; the latter, only when the player actually finishes playing a track.

 -- User Option: emms-player-paused-hook
     Hook run when a player is paused or resumed. Use EMMS-PLAYER-PAUSED-P to find the current state.

Core Functions
==============

The core file also defines all the functions important to the basic use of Emms.

There are functions which deal with movement in the playlist.

 -- Function: emms-next-noerror
     Start playing the next track in the Emms playlist. Unlike emms-next, this function doesn't signal an error when called at the end of the playlist. This function should only be called when no player is playing. This is a good function to put in emms-player-finished-hook.

 -- Function: emms-playlist-next
     Move to the previous track in the current buffer.

 -- Function: emms-playlist-previous
     Move to the previous track in the current buffer.

 -- Function: emms-random
     Jump to a random track.

 -- Function: emms-toggle-repeat-playlist
     Toggle whether emms repeats the playlist after it is done. See EMMS-REPEAT-PLAYLIST.

 -- Function: emms-toggle-repeat-track
     Toggle whether emms repeats the current track. See EMMS-REPEAT-TRACK.

 -- Function: emms-toggle-random-playlist
     Toggle whether emms plays the tracks randomly or sequentially. See

EMMS-RANDOM-PLAYLIST.

Some functions deal with the getting and setting track information.

 -- Function: emms-track type name
     Create a track with type TYPE and name NAME.

 -- Function: emms-track-type track
     Return the type of TRACK.

 -- Function: emms-track-name track
     Return the name of TRACK.

 -- Function: emms-track-get name track &optional inexistent
     Return the value of NAME for TRACK. If there is no value, return DEFAULT (or nil, if not given).

 -- Function: emms-track-set track name value
     Set the value of NAME for TRACK to VALUE.

 -- Function: emms-track-description track
     Return a description of TRACK. This function uses EMMS-TRACK-DESCRIPTION-FUNCTION.

 -- Function: emms-player-for track
     Return an Emms player capable of playing TRACK. This will be the first player whose PLAYABLEP function returns non-nil, or nil if no such player exists.

 -- Function: emms-playlist-current-selected-track
     Return the currently selected track in the current playlist.

There are also functions which deal with the playing itself.

 -- Function: emms-player-start track
     Start playing TRACK.

 -- Function: emms-player-stop
     Stop the currently playing player.

 -- Function: emms-player-stopped
     Declare that the current Emms player is finished. This should only be done by the current player itself.

 -- Function: emms-seek seconds
     Seek the current player SECONDS seconds. This can be a floating point number for sub-second fractions. It can also be negative to seek backwards.

 -- Function: emms-seek-forward
     Seek ten seconds forward.

 -- Function: emms-seek-backward
     Seek ten seconds backward.

For more basic commands defined in the core file see Basic Commands.

Sources
*******

Sources allow Emms to add and play tracks. Emms comes with a number of sources of its own. Sources are designed so that creating new ones will be easy.

For examples of Emms sources for files and directories see emms-source-file.el.

 -- User Option: emms-source-file-default-directory
     The default directory to look for media files.

 -- Function: emms-play-find
     Play all files in EMMS-SOURCE-FILE-DEFAULT-DIRECTORY that match a specific regular expression.

 -- Function: emms-source-file &optional file
     An Emms source for a single file - either FILE, or queried from the user.

 -- Function: emms-source-files files
     An Emms source for a list of FILES.

 -- Function: emms-source-directory &optional dir
     An Emms source for a whole directory tree - either DIR, or queried from the user

 -- Function: emms-source-directory-tree & optional dir
     An Emms source for multiple directory trees - either DIR, or the value of EMMS-SOURCE-FILE-DEFAULT-DIRECTORY.

 -- Function: emms-source-playlist file
     An Emms source for playlists.  See EMMS-SOURCE-PLAYLIST-FORMATS for a list of supported formats.

 -- Function: emms-source-playlist-native file
     An Emms source for a native Emms playlist file.

 -- Function: emms-source-playlist-m3u file
     An Emms source for an m3u playlist file.

 -- Function: emms-source-playlist-pls file
     An Emms source for a pls playlist file.

 -- Function: emms-source-find &optional dir regex
     An Emms source that will find files in DIR or EMMS-SOURCE-FILE-DEFAULT-DIRECTORY that match REGEXP.

 -- Function: emms-source-file-directory-tree &optional dir
     Return a list of all files under DIR which match REGEX.

 -- Function: emms-source-dired
     Play all marked files of a dired buffer

 -- Function: emms-source-file-regex
     Return a regexp that matches everything any player (that supports files) can play.

 -- Function: emms-locate regexp
     Search for REGEXP and display the results in a locate buffer

Simple Players
**************

 -- Macro: define-emms-simple-player name types regex command &rest args
     Define a simple player. NAME is used to construct the name of the function like emms-player-NAME. TYPES is a list of track types understood by this player. REGEX must be a regexp that matches the filenames the player can play. COMMAND specifies the command line argument to call the player and ARGS are the command line arguments.

For a discussion on how to define new players see New Player.

 -- Function: emms-player-simple-stop
     Stop the currently playing process, if indeed there is one.

 -- Function: emms-player-simple-start filename cmdname params
     Starts a process playing FILENAME using the specified CMDNAME with the specified PARAMS.

 -- Function: emms-player-simple-sentinel proc str
     Sentinel for determining the end of process for the process PROC and the sentinel string STR.

Playlists
*********

Emms uses Emacs buffers to store the media tracks for playing. We call one such buffer a ``playlist buffer'' or an ``Emms playlist buffer''. Emms then proceeds to play the media tracks in the buffer from top to bottom until the end of the playlist.

The name of the playlist buffer is defined in the variable EMMS-PLAYLIST-BUFFER-NAME and is set to be an invisible Emacs buffer by default. You can change to any name you want. For an example configuration see Configuration.

You can create any number of playlist buffers you wish. At any time Emms has a single ``current'' buffer through which it proceeds track by track.

 -- Function: emms-playlist-new &optional name
     Create a new playlist buffer. The buffer is named NAME, but made unique. NAME defaults to `emms-playlist-buffer-name'. If called interactively, the new buffer is also selected.

 -- Function: emms-playlist-save &optional format file
     Store the current playlist to FILE as the type FORMAT.  The default format is specified by EMMS-SOURCE-PLAYLIST-DEFAULT-FORMAT.

The current Emms playlist buffer is stored in the variable EMMS-PLAYLIST-BUFFER.

Track Information
*****************

By default Emms will only list tracks as file names or URLs in playlists (see Playlists) and the browser (see The Browser). However, Emms can be configured to utilize so-called info methods to augment tracks with metadata information, such as artist name, track name, album title, and the like.  We describe these methods and their use in this chapter.

Fundamentally, info methods are Emacs Lisp functions that are called for each track to provide information for that track.  Current info methods in Emms are restricted to tracks that are files; they do not work with stream URLs (see Streaming Audio).  Some of the methods require installation of some additional software that Emms can then call to read metadata from disk (see Metadata Utilities). Finally, some methods work only with a limited set of media file formats such as Ogg or MP3, while some methods support a wide variety of formats.

If caching is enabled (it is by default) then the metadata for each track will be stored in the cache for faster retrieval. That means if you change info method and want updated tracks, you will have to reset the cache M-x emms-cache-reset and then repopulate with M-x emms-add-directory-tree RET ~/Music/ RET or similar.

Automatic track information retrieval is enabled by default in the emms-all setup level (see Setup).  That setup level configures Emms to use emms-info-native and emms-info-cueinfo methods, as they are the only methods that do not rely on additional software.

Here is a list of all info methods distributed with Emms and their software requirements:

emms-info-native
     This method is implemented completely in Emacs Lisp and hence does not require any external software.  It supports Ogg Vorbis, Opus, FLAC and MP3 files.

emms-info-tinytag
     This method utilizes a small Python library tinytag.  It supports MP3, Ogg Vorbis, Opus, MP4, M4A, FLAC, WMA and WAV formats.

emms-info-exiftool
     This method calls exiftool utility written in Perl.  It supports dozens of media file formats, far too many to list here.

emms-info-libtag
     This method calls a small ``shim'' executable emms-print-metadata built around TagLib library.  It supports MP3, Ogg Vorbis, Opus, FLAC, MPC, Speex, WavPack, TrueAudio, WAV, AIFF, MP4 and ASF formats.

emms-info-metaflac
     This method calls metaflac utility.  It works only with FLAC files.

emms-info-mp3info
     This method calls mp3info utility.  It works only with MP3 files that have older id3v1 tags.

emms-info-ogginfo
     This method calls ogginfo utility.  It supports Ogg Vorbis and Theora formats.

emms-info-opusinfo
     This method calls opusinfo utility.  It works only with Opus files.

emms-info-cueinfo
     This is a special method that parses track information from an accompanying cue file for FLAC and APE files (see APE / FLAC Commands).  It does not require any additional software.

To use any of the methods, add the method to emms-info-functions list.  For example:

     (require 'emms-info-native)
     (add-to-list 'emms-info-functions 'emms-info-native)

You can also use a combination of format-specific tools if needed:

     (require 'emms-info-mp3info)
     (require 'emms-info-ogginfo)
     (add-to-list 'emms-info-functions 'emms-info-mp3info 'emms-info-ogginfo)

In this case both emms-info-mp3info and emms-info-ogginfo will be called for each track.

There are a number of user variables which control the behavior of emms-info:

 -- User Option: emms-info-auto-update
     Non-nil when Emms should update track information if the file changes. This will cause hard drive activity on track loading. If this is too annoying for you, set this variable to nil.

 -- User Option: emms-info-asynchronously
     Non-nil when track information should be loaded asynchronously. This requires the feature later-do which is provided by the file later-do.el, which comes with Emms.  See variable emms-later-do-batch for performance tweaking.

 -- User Option: emms-info-functions
     A list of functions (info methods) which add information to tracks. Each function is called with a track as argument.  If two info methods produce the same information (for example album name), the latter one takes precedence.

Metadata Utilities
==================

With the exception of emms-info-native and emms-info-cueinfo, Emms info methods require external metadata utilities to read metadata from media files.  If you plan to use a certain info method, make sure you have the corresponding utility installed.  All of these utilities are free software, and most of them are included in free GNU/Linux distributions.

tinytag
.......

tinytag is a Python library for reading metadata from music files.  It is available at https://pypi.org/project/tinytag/.  Naturally a working Python interpreter is also required.  The corresponding Emms info method is emms-info-tinytag.

It is best to configure emms-info-tinytag as the sole info method for Emms, because competing and overlapping methods can cause confusion.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-tinytag)
     (setq emms-info-functions '(emms-info-tinytag))

ExifTool
........

ExifTool is a platform-independent Perl library and a command-line application for reading, writing and editing meta information in a wide variety of files.  It is available at https://exiftool.org/.  Naturally a working Perl interpreter is also required.  The corresponding Emms info method is emms-info-exiftool.

It is best to configure emms-info-exiftool as the sole info method for Emms, because competing and overlapping methods can cause confusion.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-exiftool)
     (setq emms-info-functions '(emms-info-exiftool))

TagLib
......

TagLib is a library for reading and editing metadata of several popular audio formats.  It is available at http://taglib.github.io/.  Because TagLib is a C++ library instead of an executable program, you have to build and install a small ``shim'' executable emms-print-metadata around it. emms-info-libtag will then call this executable to read metadata from media files.

To compile emms-print-metadata invoke

make emms-print-metadata

in Emms directory.  For this to succeed you need to have a working C++ compiler and TagLib development libraries installed on your system. The resultant binary executable will be installed when you invoke

make install as in see Compiling Emms.

It is of course also possible to install only the emms-print-metadata binary where your system can find and execute it without installing all of Emms via the make command.

Once emms-print-metadata is available, it is best to configure emms-info-libtag as the sole info method for Emms, because competing and overlapping methods can cause confusion.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-libtag)
     (setq emms-info-functions '(emms-info-libtag))

metaflac
........

metaflac is the command-line FLAC file metadata editor.  It is included in FLAC source distribution available at https://github.com/xiph/flac.  The corresponding info method is emms-info-metaflac.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-metaflac)
     (add-to-list 'emms-info-functions 'emms-info-libtag)

MP3info
.......

MP3info is a small utility for reading and modifying id3v1 tags from MP3 files.  Note that more recent id3v2 tags are not supported; for those you need to use another info method, for example emms-info-native.  MP3info is available at https://ibiblio.org/mp3info/.

The corresponding info method is emms-info-mp3info.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-mp3info)
     (add-to-list 'emms-info-functions 'emms-info-mp3info)

ogginfo
.......

ogginfo is a small utility for extracting information about Ogg Vorbis and Theora files.  It is part of Vorbis Tools source distribution available at https://github.com/xiph/vorbis-tools. The corresponding info method is emms-info-ogginfo.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-ogginfo)
     (add-to-list 'emms-info-functions 'emms-info-ogginfo)

opusinfo
........

opusinfo is a small utility for extracting information about Opus files.  It is part of Opus Tools source distribution available at https://github.com/xiph/opus-tools.  The corresponding info method is emms-info-opusinfo.  To use it, add the following into your Emacs initialization file:

     (require 'emms-info-opusinfo)
     (add-to-list 'emms-info-functions 'emms-info-opusinfo)

Defining Info Methods
=====================

An info method essentially consists of a function which, given an Emms track, sets the appropriate info-symbols for that track.  Info symbols are keys that have an associated value stored in the metadata cache.  While info symbols can have arbitrary names, the following symbols are recognized by Emms:

info-album
     Album title.

info-albumsort
     Album title for collation.

info-artist
     Artist name.

info-artistsort
     Artist name for collation.

info-albumartist
     Album artist name.

info-albumartistsort
     Album artist name for collation.

info-composer
     Composer name.

info-composersort
     Composer name for collation.

info-date
     Release date.

info-originaldate
     Original release date.

info-performer
     Performer name.

info-title
     Track title.

info-titlesort
     Track title for collation.

info-tracknumber
     Track number.

info-discnumber
     Disc number.

info-year
     Release year.

info-originalyear
     Original release year.

info-note
     Free-form note.

info-genre
     Genre.

info-label
     Record label.

info-playing-time
     Playing time in seconds.

An info method does not need to add all of these symbols into the given track.  It can also add other symbols, but those extra symbols won't be used by Emms.

We can for example look at the predefined method for retrieving information about audio tracks in the Ogg format.  The function emms-info-ogginfo provided by emms-info-ogginfo.el accepts an Emms track TRACK as a single argument.  It uses ogginfo utility to extract a list of key-value metadata pairs from the file represented by TRACK.  Next, it sets the appropriate info symbols for TRACK by calling emms-track-set.  Info symbols are interned from the extracted keys.  Those keys can be arbitrary strings, but they typically coincide with the keys listed above; for example ``album'' and ``artist'' form info symbols info-album and info-artist.

Interactive Playlists
*********************

Emms provides a visual, interactive playlist mode as well as the ability to use playlists without ever looking at then. This visual, interactive mode is called the `emms-playlist-mode' and is defined in emms-playlist-mode.el.

The interactive playlist mode is enabled by default in the `emms-all' setup level. For more information about Emms setup levels see Setup.

 -- Function: emms-playlist-mode-go
     Switch to the current emms-playlist buffer and use emms-playlist-mode.

If you wish to make this the default Emms playlist mode, add the following to your .emacs.

     (setq emms-playlist-default-major-mode 'emms-playlist-mode)

The interactive playlist buffer shows the tracks in the current Emms playlist in the order in which they will be played. The current track will be highlighted.

When in the interactive playlist mode we can perform different actions on the current playlist.

a
     Add files in the playlist at point to the current playlist buffer. If we are in the current playlist, make a new playlist buffer and set it as current.

b
     Set the current playlist buffer.

n
     Start playing the next track in the playlist.

p
     Start playing the previous track in the playlist.

s
     Stop playing.

P
     Pause.

>
     Seek ten seconds forward.

<
     Seek ten seconds backward.

f
     Describe the currently playing track in the minibuffer.

c
     Display the current track in the center of the screen.

RET
     Start playing the track under point. Note that this is also available with <mouse-2>.

SPC
     Scroll up a near full page.

M-<
     Go to the first track in the playlist.

M->
     Go to the last track in the playlist.

r
     Go to a randomly selected track in the playlist.

q
     Put the interactive playlist buffer at the end of the list of all buffers.

C-x C-s
     Save the current playlist buffer to a file. By default, Emms will ask you for confirmation before overwriting an existing playlist. You can silently overwrite existing playlist by setting EMMS-SOURCE-PLAYLIST-ASK-BEFORE-OVERWRITE to nil.

?
     Describe the mode.

We can also edit the playlist using familiar GNU/Emacs commands:

C-k
     Remove the track under point from the playlist buffer. Also available using the d key.

C-y
     See the command yank

C-w
     See the command kill-region

M-y
     See the command yank-pop.

C-j
     Insert a newline at point.

We can use the regular GNU/Emacs killing and yanking commands to move and copy tracks in between playlist buffers. We can use the same commands to insert arbitrary text into the playlist buffers together with the playlist tracks. Text which is not a track is ignored by the program and can therefore be used to include titles and annotations within the playlist.

Markable Playlists
******************

The Markable Playlists provided by the file emms-mark.el are an alternative to the default interactive playlists, see Interactive Playlists. They allow marking tracks with keybindings familiar to users of dired.

To enable the Markable Playlists you have to add

     (require 'emms-mark)

to your .emacs. Then you can activate emms-mark-mode by executing M-x emms-mark-mode in a playlist buffer. You can return to the default interactive playlist mode with M-x emms-mark-mode-disable.

If you wish to make this the default Emms playlist mode, add the following to your .emacs.

     (setq emms-playlist-default-major-mode 'emms-mark-mode)

m
     Marks the current track and sets point one line forward. If a prefix argument ARG is given, it will mark the next ARG tracks and set point accordingly. A negative argument marks backward.

U
     Unmarks all tracks in the playlist.

t
     Toggles mark on the current track.

u
     Unmarks same way as emms-mark-forward marks.

% m
     Marks all tracks in the playlist matching the given regular expression. A prefix argument means to unmark them instead.

When tracks are marked you can operate on them:

D
     Deletes the marked tracks from the playlist.

K
     Deletes the marked tracks from the playlist and places them in the kill-ring, so that you can yank in into another playlist.

W
     Adds the marked tracks to the kill-ring, so that you can yank them into another playlist.

emms-mark is also intent to provide a way for user to select tracks for other command to operate on them. Currently, emms-tag-editor.el uses the emms-mark to edit the tags of selected tracks. Two functions are useful for the elisp programer to handle marked tracks.

 -- Function: emms-mark-do-with-marked-track
     This function take a function to perform on all marked tracks. A optional argument `move-flag' to tell the function to move forward line after calling given function. If the given function didn't change position, the second argument should set to non-nil.

 -- Function: emms-mark-mapcar-marked-track
     This function is very similar to `emms-mark-do-with-marked-track' except it collects result of given function (that's why named with `mapcar').

Extending Emms
**************

Emms introduces a high abstraction layer for playing music so you can customise it to your needs.

New Player
==========

The file emms-player-simple.el defines some easy players to start with, but it shouldn't be hard to provide a function for your favourite player. We will start with an easy example that shows how we can use the play command under Unix to play our WAV files.

Simple Player for `play'
========================

Play is a very easy command line player for various format. If you want your emms to play WAV files just put the following lines in you .emacs:

     (require 'emms-player-simple)
     (define-emms-simple-player play '(file) "\\.wav$" "play")

Huh! Wasn't that easy?

The macro function define-emms-simple-player takes a minimum of three arguments. The first argument (play in our example) defines the name of the player. It's used to name the player functions. The second is a regexp, that defines which files to play with our player. \\.wav$ matches any filename ending with a dot and the string wav. The last argument is the actual command line command we use to play our files. You can also add the path but we just assume that the command is in your path. All arguments you add to these three are optional. They define the command line arguments you want to add to your argument. If you want to hear the wav file of your favourite artist in the most possible volume use the following line:

     (require 'emms-player-simple)

     (define-emms-simple-player play
                                '(file)
                                "\\artist-*.wav$"
                                "play"
                                "--volume=100")

Please notice that you have to add the arguments as strings!

The command line tool you use for define-emms-simple-player has to take one song as argument and stop after playing that particular song. For any other concept you will need to customise emms a bit more...

More Complex Player
===================

The most players you use will be simple players so you don't need to read this chapter. But if you are curious how you can use (almost) every player in emms read further...

In this chapter we will use mpg321 to construct a player that actually can pause a track, restart it and show rest time. We won't implement all of that, but after that chapter you will know how to define it.

The command define-emms-simple-player is just a abstraction layer for define-emms-player, which is a little bit more complicated but much more powerful!

     (define-emms-player "emms-mpg321-remote"
       :start 'emms-mpg321-remote-start
       :stop 'emms-mpg321-remote-stop
       :playablep 'emms-mpg321-remote-playable-p)

So, that is almost all! define-emms-player takes a minimum of three arguments. The first is the name of the player. The rest are methods with functions to call. Three methods are required: start, stop and playable. Start says Emms how to start a track (sic!), stop how to stop a player and playablep should return non-nil if the player can play the track.

So we just need these three functions to get our mpg321-remote:

First we code the start function. We will check if there's a open process and start one otherwise. Then we send a string to the process with the filename and set a filter.

     (defun emms-mpg321-remote-start ()
       (unless (get-process ``mpg321-remote'')
         (setq emms-mpg321-remote-process
               (start-process "mpg321-remote-process"
                              "*mpg321*" "mpg321" "-R" "abc"))
       (process-send-string "mpg321-remote-process"
                            (concat "l " (emms-track-name track)))
       (set-process-filter emms-mpg321-remote-process 'emms-mpg321-remote-filter)))

We need the filter, as mpg321-remote won't quit after playing the track as the simple player do. We wait until the process sends the output ``(at-sign)P 0'' (the signal of mpg321 that the song ended) to the filter and call emms-mpg321-remote-stop.

     (defun emms-mpg321-remote-filter (process output)
       (when (string-match "(at-sign)P 0" output)
         (emms-mpg321-remote-stop)))

emms-mpg321-remote-stop won't do anything interesting. It just test if there are other files to play and close the process otherwise.

     (defun emms-mpg321-remote-stop ()
       (unless emms-playlist
         (process-send-string "mpg321-remote-process" "Q\n"))

And to make that a playable example I also added emms-mpg321-remote-playablep, which I really just steal from emms-player-simple.el

     (defun emms-mpg321-remote-playablep (track)
            "Return non-nil when we can play this track."
            (and (emms-track-file-p track)

Now we have a ready player and we could add commands like emms-mpg321-remote-pause for example.

The Browser
***********

The Browser allows you to browse the metadata cache and add tracks to your playlist. It includes a powerful interactive mode.

The Browser is defined in emms-browser.el and is included in the emms-all setup level. For more information about Emms setup levels see Setup.

You can also manually add the Browser to your Emms setup by loading it explicitly with:

     (require 'emms-browser)

To be properly useful, you should do M-x emms-add-directory-tree to all the files you own at least once so that the cache is fully populated.

Browser Interface
=================

The browser interface allows you to display and interact with your tracks in many different ways. There are a number of ways to start the browser.

 -- Function: emms-smart-browse
     Display browser and playlist. Toggle between selecting browser, playlist or hiding both. Tries to behave sanely if the user has manually changed the window configuration.

 -- Function: emms-browse-by-artist
     Display the browser and order the tracks by artist.

 -- Function: emms-browse-by-album
     Display the browser and order the tracks by album.

 -- Function: emms-browse-by-genre
     Display the browser and order the tracks by genre.

 -- Function: emms-browse-by-year
     Display the browser and order the tracks by year.

Once the Browser is displayed you can use it to managed your track collection and playlists. The Browser is interactive and has its own keybindings.

C-j
     Add all tracks at point, and play the first added track.

RET
     Add all tracks at point.

SPC
     Show or hide (kill) subitems under the current line.

1
     Collapse everything.

2
     Expand all top level items one level.

3
     Expand all top level items two levels.

4
     Expand all top level items three levels.

C
     Clear the playlist.

E
     Expand everything.

d
     View the current directory in dired.

q
     Bury the browser buffer.

r
     Jump to a random track.

/
     Isearch through the buffer.

<
     Redisplay with the previous filter.

>
     Redisplay with the next filter.

?
     See the Emacs documentation for the function.

C-/
     Undo the previous playlist action.

<C-return>
     Add all tracks at point, and play the first added track.

<backtab>
     Jump to the previous non-track element.

<tab>
     Jump to the next non-track element.

s A
     Search the collection by album.

s a
     Search the collection by artist.

s s
     Search the collection by names.

s t
     Search the collection by title.

b 1
     Browse the collection by artist.

b 2
     Browse the collection by album.

b 3
     Browse the collection by genre.

b 4
     Browse the collection by year.

W a p
     Lookup the album using Pitchfork.

W a w
     Lookup the album using Wikipedia.

Filtering Tracks
================

If you want to display a subset of your collection (such as a directory of 80s music, only avi files, etc.) then you can extend the Browser by defining ``filters''.

Show everything:

     (emms-browser-make-filter "all" 'ignore)

Set "all" as the default filter:

     (emms-browser-set-filter (assoc "all" emms-browser-filters))

Show all files (no streamlists, etc):

     (emms-browser-make-filter
      "all-files" (emms-browser-filter-only-type 'file))

Show only tracks in one folder:

     (emms-browser-make-filter
      "80s" (emms-browser-filter-only-dir "~/Mp3s/80s"))

Show all tracks played in the last month:

     (emms-browser-make-filter
      "last-month" (emms-browser-filter-only-recent 30))

After executing the above commands, you can use M-x emms-browser-show-all, emms-browser-show-80s, etc to toggle between different collections. Alternatively you can use '<' and '>' to cycle through the available filters.

The second argument to make-filter is a function which returns t if a single track should be filtered. You can write your own filter functions to check the type of a file, etc.

Show only tracks not played in the last year:

     (emms-browser-make-filter "not-played"
      (lambda (track)
       (not (funcall (emms-browser-filter-only-recent 365) track))))

Show all files that are not in the pending directory:

     (emms-browser-make-filter
      "all"
      (lambda (track)
        (or
         (funcall (emms-browser-filter-only-type 'file) track)
         (not (funcall
               (emms-browser-filter-only-dir "~/Media/pending") track)))))

Displaying Covers
=================

The browser will attempt to display cover images if they're available.

Customize EMMS-BROWSER-COVERS to configure how EMMS should retrieve the covers.

By default it looks for images cover_small.jpg, cover_med.jpg, etc. Note that you'll probably want to resize your existing covers to particular sizes. Suggested sizes are 100x100 for small, and 200x200 for medium.

The above behaviour demands manual processing on behalf of the user.  Instead, you might prefer to automate the process by setting EMMS-BROWSER-COVERS to 'emms-browser-cache-thumbnail': covers matching 'emms-browser-thumbnail-filter' will be automatically resized if necessary and cached to EMMS-BROWSER-THUMBNAIL-DIRECTORY.  The cache gets automatically updated upon change in the source folder.

Customize EMMS-BROWSER-COVERS-FILE-EXTENSIONS to include or exclude specific extensions.

'emms-browser-cache-thumbnail' might be everytime a cover is queried, so to help with performance you can also set EMMS-BROWSER-COVERS to 'emms-browser-cache-thumbnail-async'.  The latter is like the former except that it caches queries: every subsequent query will be much faster.  The drawback is that it won't see changes made to covers after the first query.  To force-refresh the thumbnail cache, you can run 'emms-browser-clear-cache-hash'.

Also, Emacs by default will jump around a lot when scrolling a buffer with images. In order to prevent that, you can set SCROLL-UP-AGGRESSIVELY and SCROLL-DOWN-AGGRESSIVELY to the number ``0.0''.

To show a 'no cover' image for albums which don't have a cover, add the following code to your .emacs:

     (setq emms-browser-default-covers
       (list "/path/to/cover_small.jpg" nil nil)

The medium and large images can be set as well.

You can download an example `no cover' image (http://repose.cx/cover_small.jpg).

Changing Looks
==============

The Browser's look can be customised. You can change the way the tree structure looks, the display format and display faces.

Changing Tree Structure
-----------------------

You can change the way the tree is displayed by modifying the function emms-browser-next-mapping-type.

The following code displays artist->track instead of artist->album->track when you switch to the 'singles' filter:

     (defadvice emms-browser-next-mapping-type
                                     (after no-album (current-mapping))
       (when (eq ad-return-value 'info-album)
         (setq ad-return-value 'info-title)))

     (defun toggle-album-display ()
       (if (string= emms-browser-current-filter-name "singles")
           (ad-activate 'emms-browser-next-mapping-type)
         (ad-deactivate 'emms-browser-next-mapping-type)))

     (add-hook 'emms-browser-filter-changed-hook 'toggle-album-display)

Furthermore, you can customize EMMS-BROWSER-GET-TRACK-FIELD-FUNCTION to choose which the metadata fields used for the different tree nodes ('info-artist, info-year, etc.).  For instance, you can choose whether to organize the tree by artist, album artist or performer.

Changing Display Format
-----------------------

Format strings govern the way items are displayed in the browser and playlist. You can customize these if you wish.

EMMS-BROWSER-DEFAULT-FORMAT controls the format to use when no other format has been explicitly defined. By default, only track and albums deviate from the default.

To customise the format of a particular type, find the name of the field you want to use (eg `info-artist', `info-title', etc), and insert that into emms-browser-<type>-format or emms-browser-playlist-<type>-format. For example, if you wanted to remove track numbers from tracks in both the browser and playlist, you could do:

     (defvar emms-browser-info-title-format "%i%n")
     (defvar emms-browser-playlist-info-title-format
       emms-browser-info-title-format)

The format specifiers available include:

  %i    indent relative to the current level

  %n    the value of the item - eg -info-artist might be ``pink floyd''

  %y    the album year

  %A    the album name

  %a    the artist name of the track

  %t    the title of the track

  %T    the track number

  %cS   a small album cover

  %cM   a medium album cover

  %cL   a big album cover

Note that if you use track-related items like %t, it will take the data from the first track.

Changing Display Faces
----------------------

The faces used to display the various fields are also customizable. They are in the format emms-browser-<type>-face, where type is one of "year/genre", "artist", "album" or "track". Note that faces lack the initial "info-" part. For example, to change the artist face, type M-x customize-face emms-browser-artist-face.

Sorting Playlists
*****************

The `emms-playlist-sort' module, defined in the emms-playlist-sort.el package provides functions for sorting Emms playlists, as well as keyboard shortcuts for invoking the functions in the playlist buffer. Most of the functions will sort in reverse order if the command is preceded by a prefix. `emms-playlist-sort' can be loaded by invoking:

     (require 'emms-playlist-sort)

 -- Function: emms-playlist-sort-by-info-artist
     Sort by artist name.

 -- Function: emms-playlist-sort-by-play-count
     Sort by number of times the track has been played.

 -- Function: emms-playlist-sort-by-info-album
     Sort by album name.

 -- Function: emms-playlist-sort-by-last-played
     Sort by time the track was played last.

 -- Function: emms-playlist-sort-by-info-title
     Sort by track title.

 -- Function: emms-playlist-sort-by-file-extension
     Sort by filename extension.

 -- Function: emms-playlist-sort-by-info-performer
     Sort by performer name.

 -- Function: emms-playlist-sort-by-info-year
     Sort by year.

 -- Function: emms-playlist-sort-by-info-note
     Sort by track notes.

 -- Function: emms-playlist-sort-by-info-composer
     Sort by composer.

 -- Function: emms-playlist-sort-by-name
     Sort by track name.

 -- Function: emms-playlist-sort-by-file-mtime
     Sort by file mtime.

Persistent Playlists
********************

The Emms module emms-history.el makes playlists persistent over emacs sessions.  To make use of this feature put this into your ~/.emacs.

     (require 'emms-history)

When you kill emacs all playlists will be saved in the file given by the variable:

 -- User Option: emms-history-file
     The file to save playlists in.  It defaults to "~/.emacs.d/emms-history".

After you started up emacs again, you can restore all saved playlists with this function.

 -- Function: emms-history-load
     Restore all playlists in `emms-history-file'.

If that should be done automatically on each startup, put these lines into your ~/.emacs.

     (require 'emms-history)
     (emms-history-load)

Normally emms-history only restores playlists.  If you want it to start playback afterwards, you can tweak this variable.

 -- User Option: emms-history-start-playing
     If non-nil emms starts playing the current track after `emms-history-load' was invoked.  The default value is nil.

Editing Tracks
**************

Using emms-tag-editor.el, emms can set tag informations of tracks and write them back to the file with the help of external programs, such as `mid3v2' and `vorbiscomment'.

Use the keybinding E to edit the tags of track under point in the playlist or all marked tracks (see Markable Playlists for how to mark tracks).  The track's tag informations are listed in a special buffer `*Emms-TAGS*' in text format.  Field names are marked in bold face and are not editable.  Any tag information is placed behind an equal sign and is changable.  A special field `name' is the track's file name.  If any change is made in this field, the track's file will be renamed to the new name.  When you finished editing the tag infos use C-c C-c (which calls emms-tag-editor-submit-and-exit) to submit the changes and close the `*Emms-TAGS*' buffer.

There are a few commands to perform changes on all tracks.

 -- Function: emms-tag-editor-set-all tag value
     Set TAG to VALUE in all tracks.

     If transient-mark-mode is turned on, you can apply the command to a selected region.

     If `transient-mark-mode' is on and the mark is active, the changes will only take effect on the tracks in the region.

 -- Function: emms-tag-editor-replace-in-tag tag from to
     Query and replace text in selected TAG.

     For example, if the info-title tag is selected, then only perform replacement in title tags.

     If `transient-mark-mode' is on and the mark is active, the changes will only take effect on the tracks in the region.

 -- Function: emms-tag-editor-transpose-tag tag1 tag2
     Transpose value of TAG1 and TAG2.

     If `transient-mark-mode' is on and the mark is active, the changes will only take effect on the tracks in the region.

 -- Function: emms-tag-editor-submit arg
     Make modified tags take affect.

     With prefix argument, bury the tag edit buffer.

If you want to extend the tag editor to work with file formats other than `mp3' and `ogg', have a look at these variables.

 -- Variable: emms-tag-editor-formats
     This variable determine how to insert track fields to `emms-tag-editor-edit-buffer'.  Emms tag info editable fields is usually determined by the extension of track name.  The variable `emms-tag-editor-tags' contains all tags that emms track may have.  A single charactar is assigned to the tag to make the `emms-tag-editor-formats' easier to generate.

 -- Variable: emms-tag-editor-tagfile-functions
     To write tags to track file, an extern program should specified in this variable.

Renaming Files
==============

The tag editor is also capable to rename the file of the track at point or all files of the marked tracks according to the value this variable.

 -- User Option: emms-tag-editor-rename-format
     When `emms-tag-editor-rename' is invoked the track's file will be renamed according this format specification.  The file extension will be added automatically.

     It uses the format specs defined in emms-tag-editor-tags.

     The default value is "%a - %l - %n - %t", so that files are named

     <Artist> - <Album> - <Tracknumber> - <Title>.<extension>

     after renaming.

To perform the renaming put point on the track you want to rename or mark some tracks.  Then hit R which calls this function:

 -- Function: emms-tag-editor-rename
     Rename the file corresponding to track at point or all marked tracks according to the value of emms-tag-editor-rename-format.

Emms Mode Line
**************

We can display information about the currenty playing track on the Emacs mode line using the package `emms-mode-line' which is provided by the file emms-mode-line.el.

To activate this feature invoke:

     (require 'emms-mode-line)
     (emms-mode-line 1)

It is also possible to display the amount of time a track has been playing. This feature is defined in the `emms-playing-time' package which is provided by the file emms-playing-time.el.

To use this feature invoke:

     (require 'emms-playing-time)
     (emms-playing-time 1)

A graphical icon can be displayed in the modeline when Emms is playing. This feature is provided by emms-mode-line-icon.el. To enable invoke the following and make sure that EMMS-MODE-LINE-ICON-ENABLED-P is set to a non-nil value:

     (require emms-mode-line-icon)

Note: `(emms-playing-time -1)' will disable emms-playing-time module completely, and is not recommended. (since some other emms modules may rely on it)

Instead, to toggle displaying playing time on mode line, one could call `emms-playing-time-enable-display' and `emms-playing-time-disable-display'."

 -- Function: emms-playing-time-enable-display
     Display playing time on mode line.

 -- Function: emms-playing-time-disable-display
     Remove playing time from mode line.

Limiting
********

The package `emms-playlist-limit', provided by emms-playlist-limit.el, allows creating a new playlist derived from the playlist in the current buffer. For instance, it is possible to create a new playlist containing only a certain artist or genre from the playlist in the current buffer.

If the playlist in the current buffer is the emms current playlist then the derived playlist becomes current.

/ a
     Create a new playlist buffer and populate it with tracks whose artist info field matches the given regular expression (default: the artist info field of the track at point).

/ b
     Create a new playlist buffer and populate it with tracks whose album info field matches the given regular expression (default: the album info field of the track at point).

/ c
     Create a new playlist buffer and populate it with tracks whose composer info field matches the given regular expression (default: the composer info field of the track at point).

/ d
     Create a new playlist buffer and populate it with tracks whose track description matches the given regular expression (default: the track description of the track at point).

/ g
     Create a new playlist buffer and populate it with tracks whose genre info field matches the given regular expression (default: the genre info field of the track at point).

/ n
     Create a new playlist buffer and populate it with tracks whose name matches the given regular expression (default: the name of the track at point).

/ p
     Create a new playlist buffer and populate it with tracks whose performer info field matches the given regular expression (default: the performer info field of the track at point).

/ t
     Create a new playlist buffer and populate it with tracks whose title info field matches the given regular expression (default: the title info field of the track at point).

/ y
     Create a new playlist buffer and populate it with tracks whose year info field matches the given regular expression (default: the year info field of the track at point).

/ /
     Switch to the original playlist buffer (if it still exists).

Music Player Daemon
*******************

Emms provides an interface to the Music Player Daemon (http://www.musicpd.org/)(MusicPD) software. The package is called `emms-player-mpd' and is provided by the file emms-player-mpd.el.

The advantages of using MusicPD as an Emms backend include the following.

  * minimal CPU usage

  * fast access of track information

  * optional crossfade

Setup
-----

To load `emms-player-mpd' invoke:

     (require 'emms-player-mpd)

Set the variables EMMS-PLAYER-MPD-SERVER-NAME and EMMS-PLAYER-MPD-SERVER-PORT to the location and port (respectively) of your MusicPD server. For example:

     (setq emms-player-mpd-server-name "localhost")
     (setq emms-player-mpd-server-port "6600")

If your MusicPD setup requires a password, you will to set EMMS-PLAYER-MPD-SERVER-PASSWORD as follows.

     (setq emms-player-mpd-server-password "mypassword")

To get track information from MusicPD, invoke the following:

     (add-to-list 'emms-info-functions 'emms-info-mpd)

Adding `emms-player-mpd' to your Emms player list is accomplished by invoking:

     (add-to-list 'emms-player-list 'emms-player-mpd)

Unless your MusicPD is configured to use absolute file names, you must set the emms-player-mpd-music-directory variable to the value of 'music_directory' in your MusicPD configuration.  There are additional options available as well, but the defaults should be sufficient for most uses.

Once you've done the above, run the M-x emms-cache-set-from-mpd-all command to fill the Emms cache with the contents of your MusicPD database. The music in your MusicPD database should then be accessible via the Emms browser.

You can set EMMS-PLAYER-MPD-SYNC-PLAYLIST to nil if your master Emms playlist contains only stored playlists.

Commands provided
-----------------

 -- Function: emms-player-mpd-connect
     Connect to MusicPD and retrieve its current playlist. Afterward, the status of MusicPD will be tracked.

 -- Function: emms-player-mpd-disconnect
     Terminate the MusicPD client process and disconnect from MusicPD.

 -- Function: emms-player-mpd-show &optional insertp
     Describe the current Emms track in the minibuffer. If INSERTP is non-nil, insert the description into the current buffer instead. This function uses EMMS-SHOW-FORMAT to format the current track. It differs from emms-show in that it asks MusicPD for the current track, rather than Emms.

Updating the MusicPD database
.............................

 -- Function: emms-player-mpd-update-directory dir
     Cause the tracks in DIR to be updated in the MusicPD database.

 -- Function: emms-player-mpd-update-all
     Cause all tracks in the MusicPD music directory to be updated in the MusicPD database.

emms-cache.el integration
.........................

 -- Function: emms-cache-set-from-mpd-directory dir
     Dump all MusicPD data from DIR into the Emms cache. This is useful to do when you have recently acquired new music.

 -- Function: emms-cache-set-from-mpd-all
     Dump all MusicPD data into the Emms cache. This is useful to do once, just before using emms-browser.el, in order to prime the cache.

emms-volume.el integration
..........................

To activate this, add the following to your .emacs.

     (require 'emms-volume)
     (setq emms-volume-change-function 'emms-volume-mpd-change)

Lyrics
******

We can display the lyrics of a song in time with the music using the `emms-lyrics' package provided by the file emms-lyrics.el.

The lyrics files should have the extention ``.lrc'', and can be placed under either the same directory as the music files or EMMS-LYRICS-DIR.

To add this feature we invoke:

     (require 'emms-lyrics)
     (emms-lyrics 1)

There are a number of variables we can set to define the way that `emms-lyrics' behaves, we can set these directly or by using the Customize feature in Emacs.

 -- User Option: emms-lyrics-display-on-minibuffer
     If non-nil, display lyrics on minibuffer.

 -- User Option: emms-lyrics-display-on-modeline
     If non-nil, display lyrics on modeline.

 -- User Option: emms-lyrics-dir
     Local lyrics repository. emms-lyrics-find-lyric will look for lyrics in current directory(i.e., same as the music file) and this directory.

 -- User Option: emms-lyrics-display-format
     Format for displaying lyrics. "%s" will be replaced by the lyrics string.

 -- User Option: emms-lyrics-coding-system
     Coding system used in the output of lyrics.

 -- User Option: emms-lyrics-scroll-p
     Non-nil value will enable lyrics scrolling.

 -- User Option: emms-lyrics-scroll-timer-interval
     Interval between scroller timers. The shorter, the faster.

We can control `emms-lyrics' with the help of the following functions:

 -- Function: emms-lyrics-start
     Start displaying lyrics.

 -- Function: emms-lyrics-stop
     Stop displaying lyrics.

 -- Function: emms-lyrics-toggle-display-on-minibuffer
     Toggle display lyrics on minibufer.

 -- Function: emms-lyrics-toggle-display-on-modeline
     Toggle display lyrics on mode line.

 -- Function: emms-lyrics-enable
     Enable displaying Emms lyrics.

 -- Function: emms-lyrics-disable
     Disable displaying Emms lyrics.

 -- Function: emms-lyrics-toggle
     Toggle displaying Emms lyrics.

Volume
******

We can use the `emms-volume' package, as provided by the emms-volume.el file, to manipulate the volume.

 -- User Option: emms-volume-change-amount
     The amount to use when raising or lowering the volume using the emms-volume interface.

     This should be a positive integer.

 -- Function: emms-volume-raise
     Increase the volume.

 -- Function: emms-volume-lower
     Decrease the volume.

If you feel like binding those two functions to global keys --- don't do it or you'll miss the convenience of `emms-volume-minor-mode'. Instead, bind the following two commands to some keys that you like.

 -- Function: emms-volume-mode-plus
     Raise volume and enable or extend the `emms-volume-minor-mode' timeout.

 -- Function: emms-volume-mode-minus
     Lower volume and enable or extend the `emms-volume-minor-mode' timeout.

Example:

     (global-set-key (kbd "C-c +") 'emms-volume-mode-plus)
     (global-set-key (kbd "C-c -") 'emms-volume-mode-minus)

Whenever you use one of these keys or call these functions with M-x, Emms will be put into `emms-volume-minor-mode' for a short period defined by `emms-volume-mode-timeout'.

 -- User Option: emms-volume-mode-timeout
     The timeout in amount of seconds used by `emms-volume-minor-mode'.

In this interval you can raise/lower the volume simply by pressing + or -, which will also reset the timer to its initial value. So instead of pressing C-c + six times to increase volume by six steps of emms-volume-change-amount, you would simply type C-c + + + + + +.

Emms can change volume with amixer, mpd, PulseAudio and mixerctl out of the box, see EMMS-VOLUME-CHANGE-FUNCTION.

Streaming Audio
***************

Emms is a great way to play streaming audio and internet radio. It is possible to add streaming playlists and URLs to any playlist, but Emms also comes with a built-in, eclectic list of streaming audio stations.  (Emms has no affiliation of any kind with the streaming audio stations included, nor is their inclusion an endorsement of these stations. Instead, this is a collection of stations submitted to the project over the years by people who enjoy Emms. We hope you will enjoy them too, and invite you to send in your suggestions to add to the list.)

The emms-streams.el package provides the command emms-streams.

Invoking emms-streams will pull up an Emms playlist buffer and populate it with the built-in list of streaming audio sources.

APE / FLAC Commands
*******************

Often, a single APE or FLAC file contains a complete album.  We can still play next or previous track in the album with the help of emms-cue.el package, provided there is a corresponding cue sheet file.  This package also defines emms-info-cueinfo for retreiving the track information for APE / FLAC itself.

To load emms-cue.el:

     (require 'emms-cue)
     (add-to-list 'emms-info-functions 'emms-info-cueinfo)

 -- Function: emms-cue-next
     Play next track from .cue file

 -- Function: emms-cue-previous
     Play previous track from .cue file

Bookmarks
*********

Emms can save a ``temporal bookmark'' in a media file via emms-bookmarks. The file emms-bookmarks.el provides the package emms-bookmarks.

While some media is playing, invoking M-x emms-bookmarks-add will first pause the playback and then prompt for a name describing the bookmark. Tracks can have multiple bookmarks associated with them.

To jump to the next and previous bookmarks in the current track invoke M-x emms-bookmarks-next and M-x emms-bookmarks-prev respectively.

To clear all of the bookmarks for the current track invoke M-x emms-bookmarks-clear.

Managing Playlists
******************

Emms can have multiple playlists, since a playlist is just another buffer with a list of tracks. You can manage multiple playlists using `emms-metaplaylist-mode', provided by the file emms-metaplaylist-mode.

Start the playlist manager with M-x emms-metaplaylist-mode-go. The playlist manager will list the playlists and mark the current one. The following commands are available:

RET
     Make the buffer at point the Emms playlist buffer and switch to it.

SPC
     Make the buffer at point the Emms playlist buffer (but do not switch to it).

n
     Move point to the next playlist.

p
     Move point to the previous playlist.

g
     Update the playlist manager buffer.

C
     Create a new Emms playlist buffer.

C-k
     Kill the Emms playlist buffer at point.

c
     Move point to the current playlist buffer.

q
     Kill the playlist manager.

GNU FM
******

GNU FM (https://www.gnu.org/software/gnufm/) is free software for running music community websites. It was created for the music community site, Libre.fm (http://libre.fm/).

Emms can send track information, and stream music from GNU FM servers using emms-librefm-scrobbler.el and emms-librefm-stream.el, respectively.

Emms is configured by default to use Libre.fm (http://libre.fm/), but can work with any GNU FM server by configuring the variable EMMS-LIBREFM-SCROBBLER-HANDSHAKE-URL to the URL of the GNU FM server.

The recommended way of providing your credentials to the GNU FM server is by using an authinfo file.  Add authentication to your auth-info file, typically ~/.authinfo.gpg, as:

     machine libre.fm login USERNAME password PASSWORD

If you are using some other server than libre.fm, change ``libre.fm'' to match EMMS-LIBREFM-SCROBBLER-HANDSHAKE-URL.

Alternatively, you can save the password in plaintext in your init-file by setting these variables:

     (setq emms-librefm-scrobbler-username "USERNAME"
           emms-librefm-scrobbler-password "PASSWORD")

Uploading Track Information
===========================

GNU FM servers, such as Libre.fm can optionally store a user's listening habits using information sent to the website's server from the Emms. By utilizing the records of users' listening habits, the website aims to be able to recommend music to users by analyzing their musical taste.

Load the feature into Emms with:

     (require 'emms-librefm-scrobbler)

This feature can also be enabled via see Setup, in the `emms-all' setup level.

Enable uploading the details of the tracks Emms plays to the GNU FM server with emms-librefm-scrobbler-enable. The track's details will be uploaded to the server when the track's playback ends. You can disable this behavior with emms-librefm-scrobbler-disable.

GNU FM Streaming
================

If the GNU FM server provides a streaming music service you can take advantage of it by loading:

     (require 'emms-librefm-stream)

This feature can also be enabled via see Setup, in the `emms-all' setup level.

Then invoke emms-librefm-stream and enter the URL of the station you wish to listen to, for example ``librefm://globaltags/Classical''.

     [file gpl.texi not included]
     [file fdl.texi not included]