Latest

The serendipitous digital audio player

I like to listen to albums, and I like to listen to them all the way through, from beginning to end.

I own a digital audio player, a kind of modern iPod. I have fitted it with a 256 GB microSDXC card for storage, which is enough for over 500 losslessly-compressed albums.

However, this leaves me with a couple of problems:

  1. Between ripped CDs I own (which is a lot, because they are very cheap these days) and downloads from Bandcamp, I already have more music than that.
  2. There’s no good way to navigate that number of albums on a tiny screen.

I could solve the first problem with lossy compression, and at my age, at reasonably high quality levels I probably wouldn’t even notice.

I could solve the second problem if I just listened on shuffle the whole time, but I like to listen to a whole album. I’m not sure if my player has an album shuffle feature, but even then, I still want more control, to be able to pick something appropriate to my mood.

My solution is to put 40 randomly-selected albums on the player each week. This is enough variety for a range of moods, not so many as to to be overwhelming, and few enough that I end up listening to albums I haven’t heard in a while.

Here’s my script. It picks albums and symlinks them into a new timestamped directory, which is then synced to the player using rsync:

#!/usr/bin/env ruby

DEST = "/media/paul/R1 Music/Albums/"
SUBSET_COUNT = 40

require "fileutils"
include FileUtils

subset_dir = Time.now.strftime("Subset-%Y-%m-%d")

mkdir_p subset_dir
cd subset_dir do
  albums = Dir["../Processed/*"]
  subset = albums.sample(SUBSET_COUNT)
  subset.each do |album|
    ln_s album, "./"
  end
end

sh %{rsync -av --delete --copy-dirlinks "#{subset_dir}/" "#{DEST}"}

The --copy-dirlinks option is needed to turn the symlinks into actual directories on the destination.

There are a few assumptions in this script that mean it won’t work for anyone else who just copies it:

  • The script is being run from the ~/Music directory.
  • There is a directory full of albums (one directory per album, no artist hierarchy) in ~/Music/Processed.
  • It won’t be run more than once per day.

The rsync at the end is potentially dangerous, because --delete means that it will replace everything in that directory. Be careful. Make sure your carefully-ripped collection is backed up – but please do that anyway!

I didn’t bother removing old subset directories because it’s interesting to see past selections, and automated deletion is risky (see previous paragraph).

Older

  • Week 239: Just one small detail

    L— got a flat tyre cycling home – the first time in at least seven years – in an inconvenient location nowhere near public transport. Her bike is a Brompton, so I attached my bicycle trailer and rode the fifteen minutes to Burgess Park to pick it up while she rented a Lime bike to get home.

    More …

  • Week 238: Unbalanced

    I picked up 2 kg of rice from the no-packaging shop on Tuesday, along with a few other things, and with all that in one pannier my bike was noticeably unbalanced as I cycled home. That’s OK: I’m used to cycling with a one-sided load. What I’m not so good at is manoeuvring the bike when I’m walking it. I stopped off at Lidl to pick up a couple of things, and as I pushed my bike towards the stands it fell over.

    I really should just have let the bike fall, but instinct took over and I grabbed it and wrangled it upright again. I won, but at what cost? My leg and shorts were covered in muck from the tyre, and my leg was gouged by the pedals. They don’t call those grippy flat pedals “shin tenderisers” for nothing, but at least it was a meaty bit and not the actual shin.

    More …

  • Beep to get your attention (but not if you’re on a call)

    Want to get a script on Linux to play a sound to get your attention, without embarrassing you if you’re in the middle of a call? I have found just the trick.

    More …

  • Japan Week Manchester tries to exploit performers

    According to Manchester City Council, Japan Week is

    More …

Older entries can be found in the archive.