Hexo Audio Plugins

Shea rocks out.

Literally the best photoshop I've ever done. Err, I mean, what photoshop? That dog is totally wearing those headphones.

As mentioned elsewhere, I use Hexo as my static site framework. It does most of what I want out of the box, and it has plugins for most everything else.

On my homepage I’ve embedded the SoundCloud widget in a Bootstrap flexbox. But it would be nice to put audio directly into a blog post as well, without too much hacking. Fortunately, Hexo has plenty of audio plugins available, and in less time than it took to write this post I added a couple.

Aplayer

The installation of hexo-tag-aplayer is straightforward using the documentation on its Github page. Inserting the player is pretty much a cinch, but I hit a wrinkle: I can’t figure out how to make the audio not loop by default. Personally I find auto-looping second to only autoplay in terms of internet annoyances, so it was important that I overcome it.

After struggling with this a few minutes I hit upon an unseemly solution: I would insert a playlist, even it only contains one track, so that I might take advantage of the loop keyword. So my template expression winds up looking like:

1
2
3
4
5
6
7
8
9
10
11
12
13
{% aplayerlist %}
{
"loop": false,
"music": [
{
"title": "DX E. Piano",
"author": "Every Musician in the 80's",
"url": "/audio/dxEpiano.m4a",
"pic": "/images/rockinDog.jpg"
}
]
}
{% endaplayerlist %}

Which produces:

How 'bout that MODX7? Does a pretty great DX7 impression, right?

SoundCloud

Right now I host all my songs on SoundCloud. The hexo-soundcloud plugin is pretty good. The default player looks like:

Spotify

What easier way to reference a song than embed a link to the ubiquitous Spotify. And, yes, there is a Hexo plugin for it:

And More‽[1]

I don’t know if Hexo has plugins for every audio use-case, but the certainly have plugins sufficient for my audio use-cases. Writing a Hexo plugin sounds like it could be a fun project but, in this case, I see no cause for it. I’m very content with the open-source tools available.[2]


  1. This use of the interrobang goes out to one of my friends. You know who you are. ↩︎

  2. Shoutout to the FOSS devs who have published great little plugins to make my life easier. You’re making the internet a better place. ↩︎