Difference between revisions of "Media player"
(→Mpg123: Emacs 28 notice) |
(→Mpg123: extensions: ID3 tags, drag and drop) |
||
Line 116: | Line 116: | ||
It is maybe the simplest player for Emacs you will find. | It is maybe the simplest player for Emacs you will find. | ||
+ | |||
+ | With extensions you can also: | ||
+ | |||
+ | * control the player from outside | ||
+ | * edit ID3 tags | ||
+ | * drag and drop music files from Dired | ||
== Installation == | == Installation == |
Revision as of 07:50, 22 February 2024
What are the available media players for Emacs ?
EMMS
EMMS, The Emacs Multimedia System.
EMMS is the Emacs Multimedia System. It tries to be a clean and small application to play multimedia files from Emacs using external players. Many of its ideas are derived from MpthreePlayer , but it tries to be more general and cleaner.
The fact that EMMS is based on external players makes it powerful, because it supports all formats that those players support, with no effort from your side.
Features
- Audio support : MP3, Ogg Vorbis, FLAC
- Video support : MPEG, WMV, MOV, AVI, OGM, MKV, etc...
- Tagging capability, possibly batched
- Playlist management
- Remotely drivable via emacsclient (playlist creation via rox-filer, for example)
- covers display
- Dired integration
- interactive metadata browser
- synchronized lyrics display
- connection to GNU FM radio streams
- Extensible
Installation
Install the needed packages with the package manager of your system :
sudo apt-get install emms vorbis-tools
(you may also try with el-get.)
add the following to your ~/.emacs :
(require 'emms-setup)
(emms-all)
(emms-default-players)
and, as usual, restart emacs or M-x eval-current-buffer RET.
Usage
You can play a file or a directory with the command M-x emms-play-file or emms-play-directory.
You can add files and directories to the emms playlist (which will be created if it doesn't exist yet) with M-x emms-add-file, play it with emms-start and you can visit the playlist buffer by simply calling M-x emms RET. Hitting '?' in the playlist buffer will show you all the available shortcuts.
Add other file extensions
If you want to, say, be able to read flv videos :
;; add flv and ogv
(define-emms-simple-player mplayer '(file url)
(regexp-opt '(".ogg" ".mp3" ".wav" ".mpg" ".mpeg" ".wmv" ".wma"
".mov" ".avi" ".divx" ".ogm" ".asf" ".mkv" "http://" "mms://"
".rm" ".rmvb" ".mp4" ".flac" ".vob" ".m4a" ".flv" ".ogv" ".pls"))
"mplayer" "-slave" "-quiet" "-really-quiet" "-fullscreen")
Extensions
Get lyrics of current song
We have to install emms-get-lyrics.el.
With el-get : el-get-install RET emms-get-lyrics RET.
Or :
- save https://raw.github.com/talau/elisp/master/emms-get-lyrics.el in your ~/.emacs.d/my-extensions
- be sure you have emacs-w3m installed
- add those two lines in your ~/.emacs :
(add-to-list 'load-path "~/.emacs.d/my-extensions/")
(require 'emms-get-lyrics)
- M-x evaluate-current-buffer
Then start playing a song and call M-x emms-get-lyrics-current-song.
Excerpt from its documentation :
The function 'emms-get-lyrics-current-song' tries to get the lyrics of the song that emms is currently playing [from http://www.lyricwiki.org/]. It currently requires w3m to get the lyrics. It copies the lyrics to a file ending in .lyrics; if the variable `emms-get-lyrics-use-files' is nil, it will just display the lyrics in a buffer without saving them to a file. If the variable `emms-get-lyrics-dir' is non-nil, then the lyrics will be put in this directory with the file ARTIST-TITLE.lyrics; otherwise it will be put in the same directory as the song file, in a file with the same name as the song file except the extension will by ".lyrics".
External links
The official documentation: https://www.gnu.org/software/emms/manual/
http://www.emacswiki.org/emacs/EMMS
http://www.gnewsense.org/Documentation/Emacs#Listening_to_Music an easy tutorial to begin with.
Mpg123
mpg123 is a package written by HiroseYuuji for playing .mp3 and .ogg files with the mpg123 and ogg123 programs. It can:
- play local music
- create and save playlists
- play randomly
- repeat songs
- loop inside songs
It is maybe the simplest player for Emacs you will find.
With extensions you can also:
- control the player from outside
- edit ID3 tags
- drag and drop music files from Dired
Installation
package.el
mpg123.el is on MELPA.
Its latest version (2023-05 at the time of writing) is for Emacs 28. You might experience a freeze of the interface in Emacs 27 when playing.
Debian system
You'd be better off using package.el, but you will also find a (historical) Debian package.
Install the mpg123-el package :
apt-get install mpg123-el
restart emacs, and you can start using it.
Dependency for all systems
Install the mpg123 and ogg123 programs with your system's package manager :
apt-get install mpg123 ogg123
Manual install
The sources are on mpg123.el's git repository. You can save them in ~/.emacs.d/mpg123.el.
Check you have the following in your Init_File :
(add-to-list 'load-path "~/.emacs.d/")
restart emacs or M-x eval-current-buffer.
Usage
M-x mpg123
- start mpg123, choose a directory or a mp3/ogg file and start listening. The buffer shows a complete list of commands.
1 --:--/--:-- Hurricane by Kyuss
0%--------------------------------------50%-------------------------------------100%
Volume: [N/A] Repeat: [--] Loop: [--]
mpg123:
W Show the real filename
g Go to current music line
SPC Play or pause
RET Play
m Mark position (when playing)
r Restart from marked position
w Where is the marked position
< <<
> >>
f Forward 1 sec
b Backward 1 sec
F Forward 10 sec
B Backard 10 sec
n Move to next line
p Move to previous line
g Go to current music line
- Volume down
+ Volume up
o Open other directory or playlist file
a Add other directory or playlist file
S Save current playlist to a file
i Increase repetition count
d Decrease repetition count (-1 for infinity)
L Increase current loop count
l Decrease current loop count. Also toggles between 0(no loop) and -1(always loop)
s Shuffle music list
D Delete music file
. Display playing position indicator
k Kill music line and push onto stack
y Yank music line from stack
I Intro-quiz mode ON/OFF (Stop at marked position)
q Quit
Q Quit without query
<down-mouse-2> Select a music directly on the mouse cursor
0..9 Digit argument (ex. 50V increase volume by 50steps)
----
The delimiter line "-------" is the indicator of currently playing position.
You may see the slider on the line running from left to right while the
music's going ahead. If you hit RET or <down-mouse-2> on the indicator line,
the music will immediately move to that position.
Remote control
Save this file somewhere, like in .emacs.d/my-plugins: http://www.gentei.org/~yuuji/software/mpg123el/mpg123-remote.el
add in your .emacs:
(load "path/to/mpg123-remote")
restart emacs. To control mpg123 from the outside, you have to start a server, for example with M-x server-start. Now you have access to a few functions that you can call this way:
emacsclient -e '(remote-mpg123-pause)' ; next and prev are also available
define a global shorcut with your desktop manager and you're done !
sources : http://www.gentei.org/~yuuji/software/mpg123el/
Bongo
Bongo is a beautiful, flexible and usable buffer-oriented media player for Emacs, developed in parallel to EMMS 2.0. If you store your music collection locally and use structured file names, then Bongo is a great way for you to play music from within Emacs.
Notable features of Bongo include :
- separate playlist and library buffers (each of which you may have any number — even zero of both is okay if you don’t need playlist functionality),
- hierarchical buffers with collapsable sections for each artist and album,
- familiar Emacs bindings for editing Bongo buffers (edit playlists much like you would regular text),
- a nice visual seeking interface doubling as a progress meter (hit ‘s’),
- a visual audio volume control (Volume, which is actually a stand-alone package),
- built-in support for playing and retreiving information about audio CDs,
- built-in support for submitting information to Last.fm using ‘lastfmsubmitd’,
- the ability to perform arbitrary actions (stopping playback is a simple example) once playback reaches certain points in the playlist, using so-called “action tracks”,
- an XMMS-like keymap for XMMS refugees,
- zero-configuration, out-of-the-box rock’n’roll action.
Bongo woks with many backend processes : mpg123, mplayer, vlc, ogg123, timidity and others.
An advantage of Bongo over EMMS may be that it can hook into Dired, so one would sort and manage files in Dired and press e to add a track to the playlist.
Installation
There is no el-get recipe for bongo (is there for MELPA in emacs24 ?). You have to install it from git. It is a 3 steps process :
- go to where you want to put the sources :
cd ~/.emacs.d/your-extensions
- retrieve the sources :
git clone git://github.com/dbrock/bongo.git
- Add the Bongo directory to your ‘load-path’, and then run M-x load-library RET bongo RET. Here’s what you’ll want to put in your ~/.emacs:
;; Change this to the correct directory name for you.
(add-to-list 'load-path "~/.emacs/your-extensions/bongo")
(autoload 'bongo "bongo"
"Start Bongo by switching to a Bongo buffer." t)
Usage
Run Bongo with (have a guess) M-x bongo and you'll be left with a quite explicit buffer. To learn more commands, please notice the menu entry and see the documentation at the project's page.
[here a nice Bongo logo]
Welcome to Bongo, the buffer-oriented media player!
This is a Bongo library buffer. It's empty now, but in a
few moments it could hold your entire media collection ---
or just the parts that you are currently interested in.
To insert local media files or directories, use `i'.
To insert the URL of a media file or stream, use `I u RET'.
To insert other things, use `I TAB' to list possibilities.
To enqueue tracks in the nearest playlist buffer, use `e'.
To hop to the nearest playlist buffer, use `h'.
Enabled backends: mpg123, mplayer, ogg123
To modify this list, customize `bongo-enabled-backends'.
Bongo is free software licensed under the GNU GPL.
Report bugs to <bongo-devel@nongnu.org>.
Basically, you're going to switch between a library buffer and a playlist buffer. You have to add tracks to the library, as indicated. Then you can start playing a track (enter). This adds the track on the playlist buffer. You can switch between buffers with h.
When on the library buffer, to add a track to the end of the playlist, press e. To add it at the beginning, press E.
- Pause playback : SPC
- Stop playback : C-c C-s
Getting further
Check the good documentation on the project's page : https://github.com/dbrock/bongo
Play radio
Bongo can read online streams out of the box. As said in the buffer, press i and paste your stream's url.
Remote control
Use bongo-pause/resume, bongo-next and bongo-previous and couple them with EmacsServer.
emacsclient -e '(bongo-pause/resume)'
Issues
Can't play tracks continuously
If Bongo plays a track and stops, try only enabling the mplayer backend only:
(setq-default bongo-enabled-backends '(mplayer))
External links
Official site : https://github.com/dbrock/bongo Some hacks : http://www.emacswiki.org/emacs/BongoHacks (edit tags, add files from dired,…)
mpdel, a client to MPD
MPDel is an emacs client for the Music Player Daemon. MPDel provides an Emacs user interface to control playback (play, pause, next, volume up…) and to display and control the current playlist as well as your stored playlists (e.g., “my favorites”, “wake me up”, “make me dance”, …).
Dionysos music player
Dionysos (in melpa) is a music player which accepts as backends mpv, mpd and vlc.
Vuiet
Vuiet is a music player and explorer, with recommendations based on Lastfm or Spotify. It can:
- search songs and artists
- create playlists, including smart playlists which play songs indefinitely based on criteria
- explore artists and genres with Lastfm
- search tracks on youtube and play them with mpv
- display and save lyrics
- search inside the saved lyrics