Indice Emms
Indice Emms
Table of Contents
1 Introduction
2 Quickstart Guide
3 Installation
3.1 Compiling Emms
4 Setup
5 Configuration
5.1 Finding files and speed
5.2 Setup Examples
6 Getting Help
7 Formats and Freedom
8 Basic Commands
9 The Core File
9.1 User Variables
9.2 Hooks
9.3 Core Functions
10 Sources
11 Simple Players
12 Playlists
13 Track Information
13.1 Metadata Utilities
13.2 Defining Info Methods
14 Interactive Playlists
15 Markable Playlists
16 Extending Emms
16.1 New Player
16.2 Simple Player for ‘play’
16.3 More Complex Player
17 The Browser
17.1 Browser Interface
17.2 Filtering Tracks
17.3 Displaying Covers
17.4 Changing Looks
18 Sorting Playlists
19 Persistent Playlists
20 Editing Tracks
21 Emms Mode Line
22 Limiting
23 Music Player Daemon
24 Lyrics
25 Volume
26 Streaming Audio
27 APE / FLAC Commands
28 Bookmarks
29 Managing Playlists
30 GNU FM
30.1 Uploading Track Information
30.2 GNU FM Streaming
GNU General Public License
Preamble
How to Apply These Terms to Your New Programs
31 GNU Free Documentation License
31.1 ADDENDUM: How to use this License for your documents
Concept Index
Function Index
Variable Index
Keybinding Index
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".
Starting out
Emms basics
Advanced Features
• Copying: The GNU General Public License gives you permission to redistribute Emms on certain terms; it also explains that there is no warranty.
• The GNU FDL: The license for this documentation.
Indices
• Concept Index:
• Function Index:
• Variable Index:
• Keybinding Index:
Here are some other nodes which are really inferiors of the ones
already listed, mentioned here so you can get to them in one step:
Installation
Track Information
Extending Emms
1 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.
2 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:
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.
You can also have Emms try to find which playes are installed on your machine and set them up for you by invoking M-x emms-setup-discover-players and following the interactive prompts.
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 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.
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).
3 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/")
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
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.
4 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.
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
You can of course write your own Emms setup functions like the above by looking at the existing function definitions in emms-setup.el.
5 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 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.
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.
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"))
6 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 [email protected]. 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.
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/.
Next: The Core File, Previous: Formats and Freedom, Up: Top [Contents][Index]
8 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.
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.
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.
A source for a whole directory tree - either dir, or queried from the user.
A source for a whole directory tree - either dir, or queried from the user.
A source for multiple directory trees - either dir, or the value of emms-source-file-default-directory.
A source for multiple directory trees - either dir, or the value of emms-source-file-default-directory.
A source for an url - for example, for streaming over http, playing over sftp, or playing local files (with the “file://” scheme).
A source for an url - for example, for streaming over http, playing over sftp, or playing local files (with the “file://” scheme).
A source for the M3u or PLS playlist format from the file playlist.
A source for the M3u or PLS playlist format from the file playlist.
A source that will find files in dir or emms-source-file-default-directory which match 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
Function: emms-stop
Stop playing
Function: emms-next
Function: emms-previous
Function: emms-shuffle
Function: emms-sort
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 See Setup.
A list of players Emms can use. You need to set this in order to use Emms to play media.
The format to use for emms-show. Any "%s" is replaced by what emms-track-description-function returns for the currently playing track.
Non-nil if the Emms playlist should automatically repeat the playlist. If nil, playback will stop when the last track finishes playing.
A function that compares two tracks, and returns non-nil if the first track should be sorted before the second (see also sort).
Next: Core Functions, Previous: User Variables, Up: The Core File [Contents][Index]
9.2 Hooks
The core file provides hook variables for the basic functionality of Emms.
A hook run when an Emms player stopped playing. See also emms-player-finished-hook.
Hook run when a source got inserted into the playlist. The buffer is narrowed to the new tracks.
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.
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.
Hook run when a player is paused or resumed. Use emms-player-paused-p to find the current state.
The core file also defines all the functions important to the basic use of Emms.
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
Function: emms-playlist-previous
Function: emms-random
Function: emms-toggle-repeat-playlist
Toggle whether emms repeats the playlist after it is done. See emms-repeat-playlist.
Function: emms-toggle-repeat-track
Function: emms-toggle-random-playlist
emms-random-playlist.
Some functions deal with the getting and setting track information.
Return the value of name for track. If there is no value, return default (or nil, if not given).
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
There are also functions which deal with the playing itself.
Function: emms-player-stop
Function: emms-player-stopped
Declare that the current Emms player is finished. This should only be done by the current player itself.
Seek the current player by duration from its current position. The argument duration can be:
In both forms seconds can be a floating point number. A negative value seeks backwards.
Seek the current player to timestamp. Acceptable forms for timestamp are the same as time duration in emms-seek, except that timestamps cannot be negative.
Function: emms-seek-forward
Function: emms-seek-backward
For more basic commands defined in the core file see See Basic Commands.
Next: Simple Players, Previous: The Core File, Up: Top [Contents][Index]
10 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.
Function: emms-play-find
An Emms source for a single file - either file, or queried from the user.
An Emms source for a whole directory tree - either dir, or queried from the user
An Emms source for multiple directory trees - either dir, or the value of emms-source-file-default-directory.
An Emms source for playlists. See emms-source-playlist-formats for a list of supported formats.
An Emms source that will find files in dir or emms-source-file-default-directory that match regexp.
Function: emms-source-dired
Function: emms-source-file-regex
Return a regexp that matches everything any player (that supports files) can play.
11 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 See New Player.
Function: emms-player-simple-stop
Starts a process playing filename using the specified cmdname with the specified params.
Sentinel for determining the end of process for the process proc and the sentinel string str.
12 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
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.
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.
Store the current playlist to FILE as the type FORMAT. The default format is specified by emms-source-playlist-default-format.
13 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)
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:
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.
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.
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.
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.
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
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)
info-album
Album title.
info-albumsort
Artist name.
info-artistsort
info-composer
Composer name.
info-composersort
info-date
Release date.
info-originaldate
Performer name.
info-title
Track title.
info-titlesort
info-tracknumber
Track number.
info-discnumber
Disc number.
info-year
Release year.
info-originalyear
Free-form note.
info-genre
Genre.
info-label
Record label.
info-playing-time
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.
14 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 See Setup.
Function: emms-playlist-mode-go
If you wish to make this the default Emms playlist mode, add the following to your .emacs.
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
Stop playing.
Pause.
>
Start playing the track under point. Note that this is also available with <mouse-2>.
SPC
M-<
M->
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.
?
Remove the track under point from the playlist buffer. Also available using the d key.
C-y
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.
15 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 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.
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.
Marks all tracks in the playlist matching the given regular expression. A prefix argument means to unmark them instead.
Deletes the marked tracks from the playlist and places them in the kill-ring, so that you can yank in into another playlist.
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’).
16 Extending Emms
Emms introduces a high abstraction layer for playing music so you can customise it to your needs.
Next: More Complex Player, Previous: New Player, Up: Extending Emms [Contents][Index]
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")
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")
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...
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.
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.
17 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 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.
Function: emms-smart-browse