<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Emms on Emacs@ Dyerdwelling</title><image><url/><title>Emms on Emacs@ Dyerdwelling</title><link>https://www.emacs.dyerdwelling.family/tags/emms/</link><width>32</width><height>32</height></image><link>https://www.emacs.dyerdwelling.family/tags/emms/</link><description>Recent content in Emms on Emacs@ Dyerdwelling</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>captainflasmr@gmail.com (James Dyer)</managingEditor><webMaster>captainflasmr@gmail.com (James Dyer)</webMaster><lastBuildDate>Sat, 10 Aug 2024 09:42:00 +0100</lastBuildDate><atom:link href="https://www.emacs.dyerdwelling.family/tags/emms/index.xml" rel="self" type="application/rss+xml"/><item><title>Ready Player Mode with a little elisp Tweak</title><link>https://www.emacs.dyerdwelling.family/emacs/20240810072449-emacs--ready-player-mode-tweak/</link><pubDate>Sat, 10 Aug 2024 09:42:00 +0100</pubDate><author>James Dyer</author><guid>https://www.emacs.dyerdwelling.family/emacs/20240810072449-emacs--ready-player-mode-tweak/</guid><description>&lt;p>I&amp;rsquo;m really enjoying &lt;strong>ready-player&lt;/strong> at the moment, so much so I think it might end up replacing &lt;strong>emms&lt;/strong>.&lt;/p>
&lt;figure>&lt;img src="https://www.emacs.dyerdwelling.family/emacs/20240810072449-emacs--Ready-Player-Mode-Tweak.jpg" width="100%">
&lt;/figure>
&lt;p>I listen to music in a very simple, almost old-fashioned way, album by album, and I have my music collection well organized, with each album in a separate directory and in a way, &lt;code>emms&lt;/code> was a little too much.&lt;/p>
&lt;p>&lt;code>ready-player&lt;/code> is well integrated with dired, so opening an audio file, for example, will kickstart the listening process for me. I like to have shuffle on (&lt;code>ready-player-shuffle&lt;/code>), and with &lt;code>ready-player-repeat&lt;/code> if there is more media to play in the current directory then it will enter a continuous play mode.&lt;/p>
&lt;p>Here are my current settings:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(use-package ready-player
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> :init
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-mode &lt;span style="color:#ae81ff">1&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> :custom
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-thumbnail-max-pixel-height &lt;span style="color:#ae81ff">200&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-autoplay &lt;span style="color:#66d9ef">nil&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-repeat &lt;span style="color:#66d9ef">t&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-shuffle &lt;span style="color:#66d9ef">t&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (ready-player-open-playback-commands
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#39;&lt;/span>(
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;mpv&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;--audio-display=no&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;mplayer&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;ffplay&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;vlc&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> )))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>The only little issue I have run into so far (and I encountered something similar with &lt;code>emms&lt;/code>) is to figure out which media player back-end works best with my set-up, I am running SwayWM on Arch.&lt;/p>
&lt;p>For some reason &lt;code>emms&lt;/code> would only run well with &lt;code>vlc&lt;/code> (found by trial and error). With &lt;code>ready-player&lt;/code> the default &lt;code>mpv&lt;/code> worked well in most cases except it wouldn&amp;rsquo;t automatically move on to the next audio track when &lt;code>ready-player-repeat&lt;/code> was set.&lt;/p>
&lt;p>I am happy with &lt;code>ready-player&lt;/code> opening videos through &lt;code>mpv&lt;/code> by default and would only really want to ever use &lt;code>mpv&lt;/code> for video playback.&lt;/p>
&lt;p>So first things first, lets establish which back-end gives me a continuous audio playback.&lt;/p>
&lt;p>With a little trial and error (simply swapping around the back-ends) I found that &lt;code>mplayer&lt;/code> was the one that worked for me, &lt;code>mplayer&lt;/code> can play videos too but my muscle memory is so mpv-centric that I always want to be using mpv for video playback.&lt;/p>
&lt;p>With &lt;code>ready-player&lt;/code> as far as I can tell there is just a single list of potential playback commands which applies to all media types. &lt;code>ready-player&lt;/code> is in its early stages of development so I wouldn&amp;rsquo;t be surprised if at some stage this might get added for more flexibility/customization. But for me it doesn&amp;rsquo;t really matter and in fact gives me the opportunity to flex my elisp know-how.&lt;/p>
&lt;p>Can I write something to overcome this issue?&lt;/p>
&lt;p>Emacs is essentially just an elisp machine anyway, so lets write some elisp to augment the current &lt;code>ready-player&lt;/code> functionality to suit my multiple playback-end needs, here is some elisp:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(defun set-ready-player-commands ()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;Set `ready-player-open-playback-commands` based on file extension.&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (let ((file-extension (file-name-extension (&lt;span style="color:#a6e22e">buffer-file-name&lt;/span>))))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (setq ready-player-open-playback-commands
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (cond
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ((&lt;span style="color:#a6e22e">member&lt;/span> file-extension &lt;span style="color:#f92672">&amp;#39;&lt;/span>(&lt;span style="color:#e6db74">&amp;#34;mp4&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;mkv&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;mov&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;avi&amp;#34;&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#39;&lt;/span>((&lt;span style="color:#e6db74">&amp;#34;mpv&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;--audio-display=no&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;mplayer&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;ffplay&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;vlc&amp;#34;&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ((&lt;span style="color:#a6e22e">equal&lt;/span> file-extension &lt;span style="color:#e6db74">&amp;#34;mp3&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#39;&lt;/span>((&lt;span style="color:#e6db74">&amp;#34;mplayer&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;mpv&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;--audio-display=no&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;ffplay&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;vlc&amp;#34;&lt;/span>)))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#66d9ef">t&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">&amp;#39;&lt;/span>((&lt;span style="color:#e6db74">&amp;#34;mpv&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;--audio-display=no&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;vlc&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;ffplay&amp;#34;&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (&lt;span style="color:#e6db74">&amp;#34;mplayer&amp;#34;&lt;/span>)))))))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(add-hook &lt;span style="color:#e6db74">&amp;#39;find-file-hook&lt;/span> &lt;span style="color:#e6db74">&amp;#39;set-ready-player-commands&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Simply, I just added some extra &lt;code>ready-player&lt;/code> setup whenever a buffer is loaded from a file, essentially when I select it from dired.&lt;/p>
&lt;p>I set the playback commands based on the extension, so for a video file it can use &lt;code>mpv&lt;/code>, for an mp3 it prefers &lt;code>mplayer&lt;/code>, with a fallback for any other type of file. I guess I could have been a little more flexible in defining a wider range of audio file, but I generally only listen to mp3.&lt;/p>
&lt;p>With that addressed, &lt;code>ready-player&lt;/code> now seems to give me much less friction than &lt;code>emms&lt;/code>, with &lt;code>emms&lt;/code> I would have to perform roughly the following steps to even begin listening to a music album:&lt;/p>
&lt;ul>
&lt;li>first initialise - add files so emms can load in metadata&lt;/li>
&lt;li>browse to select music album&lt;/li>
&lt;li>push to a playlist&lt;/li>
&lt;li>jump to playlist to perform track functions&lt;/li>
&lt;/ul>
&lt;p>I would have to remember &lt;code>emms&lt;/code> commands, or build up muscle memory, but with &lt;code>ready-player&lt;/code> I just need to navigate to the relevant music folder using &lt;code>dired&lt;/code>, open a file and I&amp;rsquo;m ready to go!, and the front-end is like any standard media player which makes more sense to me.&lt;/p>
&lt;p>If I want to modify playback then I&amp;rsquo;m quite happy to jump to the playback buffer which can be accomplished quickly through vertico by fuzzy finding &amp;ldquo;ready&amp;rdquo;, or by pushing &lt;code>ready-player&lt;/code> to its own tab.&lt;/p>
&lt;p>I think I will continue to play around with this cool little package.&lt;/p></description></item><item><title>Creating Album Art Thumbnails for EMMS</title><link>https://www.emacs.dyerdwelling.family/emacs/20230112122044-emacs--creating-album-art-thumbnails-for-emms/</link><pubDate>Fri, 13 Jan 2023 00:00:00 +0000</pubDate><author>James Dyer</author><guid>https://www.emacs.dyerdwelling.family/emacs/20230112122044-emacs--creating-album-art-thumbnails-for-emms/</guid><description>&lt;p>I have been looking for a music player on Linux for a while now but haven&amp;rsquo;t really settled on one; I have simple requirements:&lt;/p>
&lt;ul>
&lt;li>A view showing album art&lt;/li>
&lt;li>An easy way to play random tracks&lt;/li>
&lt;li>A quick method to skip a track&lt;/li>
&lt;/ul>
&lt;hr>
&lt;p>To date I have only been considering players with a graphical front end but it always seems a hassle to, open the program, look for some music, figure out how the shuffle and play work; and then what if I don&amp;rsquo;t like the current track playing?, my laptop isn&amp;rsquo;t really set up to quickly skip the track.&lt;/p>
&lt;p>Now I am delving further into the integrated environment of emacs I thought I would see what was on offer.&lt;/p>
&lt;p>A little research and I settled on &lt;strong>EMMS&lt;/strong>&lt;/p>
&lt;p>I will go into a deeper review after I have used it for a few months but mainly for this post I wanted to share a quick bash script I created to allow album art to be shown in EMMS.&lt;/p>
&lt;p>By default EMMS looks for a &lt;strong>cover.jpg&lt;/strong> file in the current music directory. My collection is neatly split into directories for each album with album art embedded into each mp3 track. This has given me the opportunity to write a bash script to automate the creation of these cover.jpg files.&lt;/p>
&lt;p>The script is as follows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">#!/bin/bash
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e">&lt;/span>DIRS&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#66d9ef">$(&lt;/span>find &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$HOME&lt;span style="color:#e6db74">/MyMusicLibrary&amp;#34;&lt;/span> -type d -printf &lt;span style="color:#e6db74">&amp;#39;%p;&amp;#39;&lt;/span>&lt;span style="color:#66d9ef">)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>export IFS&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;;&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">for&lt;/span> dir in $DIRS; &lt;span style="color:#66d9ef">do&lt;/span> cd &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$dir&lt;span style="color:#e6db74">&amp;#34;&lt;/span> files&lt;span style="color:#f92672">=(&lt;/span>*&lt;span style="color:#f92672">)&lt;/span> &lt;span style="color:#66d9ef">if&lt;/span> &lt;span style="color:#f92672">[[&lt;/span> &lt;span style="color:#e6db74">${&lt;/span>files[0]: -4&lt;span style="color:#e6db74">}&lt;/span> &lt;span style="color:#f92672">==&lt;/span> &lt;span style="color:#e6db74">&amp;#34;.mp3&amp;#34;&lt;/span> &lt;span style="color:#f92672">]]&lt;/span>; &lt;span style="color:#66d9ef">then&lt;/span> echo $dir ffmpeg -hide_banner -loglevel panic -stats -y &lt;span style="color:#ae81ff">\ &lt;/span>-i &lt;span style="color:#e6db74">&amp;#34;&lt;/span>&lt;span style="color:#e6db74">${&lt;/span>files[0]&lt;span style="color:#e6db74">}&lt;/span>&lt;span style="color:#e6db74">&amp;#34;&lt;/span> -an -c:v copy &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$dir&lt;span style="color:#e6db74">/cover.jpg&amp;#34;&lt;/span> convert -resize 120x120 &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$dir&lt;span style="color:#e6db74">/cover.jpg&amp;#34;&lt;/span> &lt;span style="color:#e6db74">&amp;#34;&lt;/span>$dir&lt;span style="color:#e6db74">/cover.jpg&amp;#34;&lt;/span> &lt;span style="color:#66d9ef">fi&lt;/span> &lt;span style="color:#66d9ef">done&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Of course change the &lt;code>&amp;quot;$HOME/MyMusicLibrary&amp;quot;&lt;/code> to your music library location and then in the emacs init file add the following:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(setq emms-browser-covers &lt;span style="color:#e6db74">&amp;#39;emms-browser-cache-thumbnail-async&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>and this is an example of the result (my music collection is larger than this!):&lt;/p>
&lt;figure>&lt;img src="https://www.emacs.dyerdwelling.family/emacs/20230112122044-emacs--Creating-Album-Art-Thumbnails-for-EMMS.jpg" width="300px">
&lt;/figure></description></item></channel></rss>