Skip to content

Mohsen Banan Portal

Personal tools
You are here: Home » My Latest » Quick Notes » Quick Notes

Quick Notes

[Web Pointer:] EmacsWiki: EMMS


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Web Pointer:] EmacsWiki: EMMS



Attched HTML part was extracted from:
http://www.emacswiki.org/emacs/EMMS#toc21 
on Monday 09/14/09 04:56:58 PM PDT

Title: EmacsWiki: EMMS

Overview

EMMS is the Emacs Multi-Media 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.

http://www.gnu.org/software/emms/

Quick start

The best way to get started with EMMS is to read the quick start guide here:

http://www.gnu.org/software/emms/quickstart.html

For information on how to develop EMMS or submit patches to it, please visit the EMMSDevelopment page.

Various Notes

Caching of tags & Async reading

Caching has now been implemented, and this largely solves the problem of slow metadata gathering. Do we still need an async process which spits out the data, so we can process it in a filter?

Missing

  • emms-lang.el - i18n support
  • emms-remote.el - Popup window/frame with widgets for the main functions
    • Maybe a popup window like CEDET’s browser with the playlist would be also interesting. For the main functions I have global keys (previous, next, pause…) in four consecutive keys.
  • Some more player files (xmms, xine)

(simple players like ‘play’ are trivial to implement with emms-player-simple - info is in the manual)

    • Have you thought of using mpg321’s remote control capabilities (LOAD <file>, PAUSE, JUMP [+-]<frames>, STOP, QUIT)?

now implemented - see emms-player-mpg321-remote

MOD, XM, S3M and similar

For those who like to play MOD, XM, S3M and similar files, here’s a way to do it using mikmod:

    (require emms-player-simple)
    (define-emms-simple-player mikmod (file)
      (regexp-opt '(".669" ".AMF" ".DSM" ".FAR" ".GDM" ".IT" ".IMF"  
                    ".MED" ".MTM" ".OKT" ".S3M" ".STM" ".STX" ".ULT" 
                    ".APUN" ".XM" ".MOD" ".amf" ".dsm" ".far" ".gdm"                            
                    ".it" ".imf" ".mod" ".med" ".mtm" ".okt" ".s3m" 
                    ".stm" ".stx" ".ult" ".apun" ".xm" ".mod" ".MOD")
                    ) "mikmod" "-q" "-p" "1" "-X")
    (add-to-list 'emms-player-list 'emms-player-mikmod)

However, since I seem unable to pass multiple arguments to mikmod correctly, you might need to enable these settings in ~/.mikmodrc:

    LOOP=no
    EXIT_AFTER=yes
    PM_MODULE=no
    PM_MULTI=no

MartinSchoenmakers

Just fixed: “mikmod” “-q” “-p” “1” “-X”, at the end of definition

– Aitherios

Mix CD Creation

While this code won’t burn a CD for you (any suggestions there?), it will take your current EMMS playlist buffer and symlink those tracks (in the order they are in your playlist buffer) to a given directory. Please feel free to post improvements (but do note what you change; I’m curious).

Note that you probably need to make some adjustments if you don’t use a fairly uniform naming scheme for your music files. You definitely need to adjust at least one path in the code (just take a look).

Here it is:

(require 'emms-playlist-mode)
(require 'cl)

(defun emms-playlist-make-mix (dir) "Eases mix creation by doing the symlinking for me." (interactive "FWhere should I make the mix? ") (save-excursion (unless (progn (get-buffer-create emms-playlist-buffer) (set-buffer emms-playlist-buffer) (> (count-lines (point-min) (point-max)) 0)) (error "There is no playlist")) (if (file-exists-p (if (string-match "/$" dir) (replace-in-string dir "/$" "") dir)) (if (not (file-directory-p dir)) (error "File %s exists and is not a directory" dir) (unless (y-or-n-p "Directory exists. Continue? ") (error "Not continuing"))) (make-directory dir)) (set-buffer emms-playlist-buffer) (emms-playlist-current-select-first) (let ((counter 1) (lines (count-lines (point-min) (point-max)))) (unless (string-match "/$" dir) (setq dir (concat dir "/"))) (while (<= counter lines) (let ((track (cdr (third (emms-playlist-current-selected-track)))) (symlinkname (replace-in-string (cdr (third (emms-playlist-current-selected-track))) "/home/user/media/music/.*/[0-9][0-9]-" (concat (if (< counter 10) "0") (number-to-string counter) "-")))) (make-symbolic-link track (concat dir symlinkname) t) (emms-playlist-current-select-next) (setq counter (1+ counter)))))))

Screenshots

[1]

Questions

How about movies, and subtitles?

The home page says that EMMS supports playing movies too and I am too lazy to find out how far that goes? For example, does it support selecting of sub text files for mplayer or other players? Some more detailed information about this would be nice. – MaDa

It supports movies, just define a new player than can play the extensions you want. What it doesn’t support, though, is subtitles selection. If you have an idea about how to enable that, we’d like to hear it :) Currently I just use a custom python script that parses mplayer output and let me choose among the different tracks embedded in a .MKV. But for video clips, EMMS just works. -- LucasBonnet

I am not aware of .MKV files, so I will ignore you just said that, for now. :) What I do know, however, is that sub text files most of the times have the same base name as the movie file, and ends in .srt or .sub. Yes, there are other variants too, with “vobsub” files. EMMS should be able to make quite good guesses. I have some example elisp at home that I can publish here later, that makes such guesses. Many times, mplayer will guess the correct file automatically though. – MaDa

Here is the code I promised. I use it to more easily play movie files using mplayer in dired:

(defvar dired-mplayer-program "c:/pgm/mplayer/mplayer.exe")

(defun dired-mplayer () (interactive) (let ((file (expand-file-name (dired-get-filename))) ext files basename dir curr-file idx-file sub-file srt-file command options) (setq basename (file-name-nondirectory (file-name-sans-extension file))) (setq dir (file-name-directory file)) (setq files (directory-files dir t basename)) (delete file files) (while files (setq curr-file (car files)) (if (string= (file-name-extension curr-file) "idx") (setq idx-file curr-file)) (if (string= (file-name-extension curr-file) "sub") (setq sub-file curr-file)) (if (string= (file-name-extension curr-file) "srt") (setq srt-file curr-file)) (setq files (cdr files))) (if (and idx-file sub-file) (setq options (format "-vobsub \"%s\"" (file-name-sans-extension idx-file)))) (if (and sub-file (not idx-file)) (setq options (format "-sub \"%s\"" sub-file))) (if (and srt-file (not sub-file)) (setq options (format "-sub \"%s\"" srt-file))) (setq options (format "%s -font \"%s\" -subfont-text-scale 4 -really-quiet" options "c:\\windows\\fonts\\arial.ttf")) (setq command (format "\"%s\" \"%s\" %s" dired-mplayer-program file options)) (if (y-or-n-p (format "Run command %s?" command)) (shell-command command))))

Use it in EMMS if you like.

MaDa

Or simply put “sub-fuzziness=1” into your ~/.mplayer/config.

WilliamXu

Streaming radio?

Can I use this package to listen to streaming radio (as is available from http://www.kfai.org for example)? – JoeCorneli

Yes! Now you can! It’s in CVS. I’ve been using it for a while, and it works really well once you find a good station. Just do (require ‘emms-streaming) followed by ‘M-x emms-streams’ to start it up. – DanielBrockman
At least of my Debian EMMS (version 1.3), the correct require is (require ‘emms-streams). – LucaCapello

How about AlsaPlayer?

AlsaPlayer? is a generic command line (--interface text) music player that can play back a large amount of file formats, including CDDA (CD) audio playback and icecast/shoutcast streaming support.

The name AlsaPlayer? might be confusing a bit today since it now supports a whole bunch of different output systems. The old default OSS audio interface is supported, as well as Esound, NAS (Network Audio Server), Sparc and SGI audio outputs. The most interesting new output is JACK.

Yes! You can! Follow these two simple steps.
  • Customize emms-player-list variable so that it looks like
(emms-player-list (quote (emms-player-alsaplayer)))
</pre><p>in your <strong>custom-set-variables</strong> section of your .emacs file.</p><ul><li>Conveniently add the following line in your .emacs file </li></ul><pre class="real">(define-emms-simple-player alsaplayer (file url) (regexp-opt
'(".ogg" ".mp3" ".wav" ".flac" ".pls" ".m3u" "http://"))
"alsaplayer" "--quiet" "--nosave" "\"--interface text\"")

Note: alsaplayer’s icecast/shoutcast streaming support is not (yet) integrated with EMMS, but usable.

How about a CD player ?

Is emms-cd.el deprecated ?

See AlsaPlayer? notes, above.

How about using the Apple Remote control?

How about MPD?

MPD or MusicPD? is an audio player. It acts as a daemon that can be controlled with different user interfaces, all audio files must be on one directory.

I found this, but I’m unable to configure emacs correctly. I would like to know how to play all the supported files with mpd and I have all my audio files on a specific directory in my user /home.

http://cvs.savannah.gnu.org/viewvc/checkout/emms/emms/emms-mpd.el?revision=HEAD

Here is the site: http://musicpd.org


Bug: For some reason, if the playlist in MPD is very long (i.e., for listening to songs on random, out of an entire music selection), it always displays as the playing song the song prior to the actual currently-playing song in the playlist.

Bug: Also, using emms-cache-set-from-mpd-all (in ~/.emacs), even if the MPD cache is updated, calling this function either in a running emacs session or in a brand-new emacs session will fail to update the cache accordingly.

How about UADE?

UADE means Unix Amiga Delitracker Emulator. It emulates part of the Amiga computer hardware (using code from the UAE Amiga emulator) for running the original players of tons of audio formats, most of these formats are of the mod type and composed using tools known as “trackers”. Amiga computers were mainly used by the multimedia stuff (before the term was invented), largely known by its games and demoscene productions, meaning there are tons of music files.

Stuff like mikmod is usable for a few of formats, but it can’t play lots of others from Amiga platforms and others.

Site is here: http://zakalwe.fi/uade/

emms-print-metadata binary

Is there somewhere a win32 binary for emms-print-metadata or another way to get all my tags work?

I’ve uploaded w32 build of emms-print-metadata to [2]. It is compiled with MinGW. --DiGash

Getting lyrics

I’ve written a few lines to get the lyrics to the song that emms is currently playing. (Just the lyrics, it doesn’t get the lyrics in the format that will allow emms to display the lyrics synchronically.) It’s a bit rough, but it works for me, so I thought I’d post it.

Lisp:emms-get-lyrics.el

Jay

JohnSturdy has written a major mode for creating and editing lyric files; it connects directly to ogg123, and doesn’t actually use EMMS, but might be useful alongside it.

LyricMode

Getting it to work on win32

I’ve recently downloaded EMMS, mplayer for windows, and vorbis-tools in cygwin, but i can’t seem to get emms to work.

The config i used is the following:

;;EMMS player (a music/video player for emacs)
(add-to-list 'load-path "D:/emacs/site-lisp/emms/")
(add-to-list 'load-path "C:/mplayer/")
(require 'emms)
(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)
      emms-source-list '((emms-directory-tree "D:/My Music/")))

Where C:/mplayer/mplayer.exe is where i downloaded the windows version of myplayer.

When i enter emms-play-file D:/abc.mp3 (a small test file), it returns symbol’s value as variable is void: emms-player-mplayer Thanks alot!

You’ll need to add

(require 'emms-player-mplayer)

as well. --MichaelOlson

Well, i added that, but now when i tried to play the file, it gave me this error: Don’t know how to play track: (track (type . file) (name . “D:/abc.mp3”))

It is probably that i cannot figure out or find how to get mpg321/mpg123 working on windows, i got cygwin and vorbis-tools in it as per advice from MpthreePlayer page. Anyone got any ideas?

Thanks alot!

You need to put the player executable (mpg321/mplayer/whatever) in Emacs’ exec-path list:

 (add-to-list 'exec-path "C:/mplayer/")

--LucasBonnet

Images in Playlist Buffer?

So on the EMMS website, there’s a screenshot in which the playlist buffer (not just the browser buffer) displays cover images! I’ve tried googling around but haven’t found the code that enables that particular feature, but would really like to prettify the playlist buffer some…basically, it would be cool to have the default display mode, plus images.

Anyway…any response is much appreciated. And just think--then this’ll be on the internet and will come up in google searches the first time around.

This is part of emms-browser.el - when you add tracks from the browser into the playlist, it automatically adds the images as well. If you want to use images without the browser, you’ll need to write your own code to insert the images into the buffer.

- Well, that’s the thing! I always use emms-browser. When I add tracks from the browser into the playlist, it does not insert an image (whether inserting individual tracks, a whole album, or everything by an artist). And I use a recent (a few days old) darcs version (this didn’t work on the Debian version either, back when I used that). What might be causing this abnormal behavior?

The playlist uses a different size image by default. Have a look at the variable ‘emms-browser-covers’

DVD's and CD's Using MPlayer Player?

Is this possible? Would I just point EMMS to the /mnt/cdrom directory?

Deleting Items From Cache Without Deleting Files

Since EMMS seems to cache everything (which, normally, is useful since I like to use the Browser), is there a way to delete items from the cache without deleting the files? For example, I might move a file to a different location, eject a CD (if there’s a way to play CD’s), or delete it from somewhere else--in which case, when I try to remove it from the cache using “D” in browser-mode, I get an error about the file not existing (and the item remains in the cache), so I have to use “touch” to create new files for it to delete. Any thoughts?

Run M-x emms-cache-sync and it will look through your cache for files which have been updates or deleted.

Playing files from Apache directory listing

I share my whole mp3-collection through a secret link (i.e. you need to know the exact link to access them) on my Apache server, and some of my friends does too. So I wanted an easy way to get EMMS to play all mp3 files found in such a directory listing. It was quite easy to do. Enjoy!

(defun my-emms-play-apache-mp3-folder (folder-url)
  "Plays mp3 files found in Apache directory listing."
  (interactive "sURL to Apache directory listing: ")
  (let ((tmp-file "~/.my-emms-play-apache-mp3-folder-tmp"))
    (when (file-exists-p tmp-file)
      (delete-file tmp-file))
    (url-copy-file folder-url "~/.my-emms-play-apache-mp3-folder-tmp" t)
    (while (not (file-exists-p tmp-file))
      (sleep-for 0 500)
      (message "Looking for file..."))
    (message "Listing downloaded. Parsing...")
    (with-temp-buffer
      (insert-file-contents "~/.my-emms-play-apache-mp3-folder-tmp")
      (goto-char (point-min))
      (while (search-forward-regexp "a href="" nil t)
        (emms-add-url (concat folder-url (match-string 1))))
      (message "Done."))))

Usage: Copy the URL to a specific folder with mp3-files. Execute the command above and paste the URL. The URL needs to end in a slash, I was lazy and did not want to check for it in the code…

MaDa

Keybindings

This code sets up the arrow keys to control the player:

    (global-set-key (kbd "C-c e <up>") 'emms-start)
    (global-set-key (kbd "C-c e <down>") 'emms-stop)
    (global-set-key (kbd "C-c e <left>") 'emms-previous)
    (global-set-key (kbd "C-c e <right>") 'emms-next)

Calculating Total time of all tracks in emms playlist, below the point

I just started out with lisp and there can be any better thing to hack on but emms!

(defun my-emms-playlist-total-time-below-point ()
"Calculates the total time taken for all the tracks currently in playlist and below point"
(interactive)
(let ((move-forward t)
      (total-playlist-time 0))
  (save-excursion               
    (while move-forward
      (setq total-playlist-time (+ total-playlist-time (or (emms-track-get (emms-playlist-track-at (point)) 'info-playing-time) 0)))
      (forward-line 1)
        (setq move-forward (next-single-property-change (point) 'emms-track))))
(setq total-hour-only (/ total-playlist-time 3600)
        total-minutes-only (/ (% total-playlist-time 3600) 60)
        total-seconds-only (% total-playlist-time 60))
(message "Total time is %dh:%dm:%ds" total-hour-only total-minutes-only total-seconds-only)))

– shyam_k

Discnumber and discsubtitle

The discnumber tag is supported by at least mp3 and ogg files, and most players understand it. Is there a special reason EMMS ignores it ? It kinda messes up my media library, since files are played by track number apparently and thus when playing an album with two disc, both first tracks are played, then both second tracks, etc.


Main Index | Thread Index

Created by sa-20000
Last modified 2010-06-11 07:54 PM
 

Powered by: •Debian GNU/Linux      •Apache      •Plone      •Qmail      •DjbDNS      •....