Categories
Articles Spacemacs

Playing Music in Spacemacs with EMMS

I have been thinking about playing songs inside Spacemacs for quite a while, so that I don’t have to leave my favorite editor for just playing music. After a small exploration I found out that all I need is to enable EMMS inside Spacemacs.

I have been thinking about playing songs inside Spacemacs for quite a while, so that I don’t have to leave my favorite editor for just playing music. After a small exploration I found out that all I need is to enable EMMS inside Spacemacs.

Spacemacs

Spacemacs is a community-driven Emacs distribution. It is a new way to experience Emacs with a sophisticated and polished set-up focused on ergonomics, mnemonics and consistency.

EMMS

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.

Getting EMMS

Clone the spacemacs-emms repo

cd into your .emacs.d/private directory. clone the repository into the emms folder

Add emms layer

Add emms as a layer to your dotspacemacs-configuration-layers to enable emms within Spacemacs.

mplayer

EMMS is just like the back-end to setup a music system, and we need a front-end, a player to actually play the music. We are going to use mplayer as the player for EMMS. Add /usr/local/bin (where mplayer is located) to Emacs’s exec-path by adding the following line to your ~/.spacemacs file in the spacemacs/user-config section.

Setting up emms

The next thing you have to do is telling Spacemacs where Emms is located. Let’s say you have it in ~/.emacs.d/site-lisp/emms/lisp. So add this line to your .emacs:

You’ll then want to load Emms into Spacemacs. To achieve this you invoke the emms-standard setup function by adding the following lines.

Next you want to setup the file extensions you want to play with your player. And you specify mplayer as the emms simple player.

Final config (full)

This is the full configuration all you need to set up EMMS in Spacemacs.

That’s all, now you need to restart Spacemaces Spc-q-R

Bonus content (Some helpful key-bindings)

Adding emms to Spacemacs is not enough, you need some good key bindings to control your playback within Spacemacs. So I found this keybindings here and tweaked it a bit to my liking.

Playing music on Spacemacs startup

And if you are like me who wants to start playing music as soon as you open your text editor you can add this little function in your dotspacemacs/user-config

References: