Extending Looped Music for Fun, Relaxation and Productivity


Tags: , , and

Some work (like programming) takes a lot of concentration, and I use noise-cancelling headphones to help me work productively in silence. But for other work (like doing business paperwork), I prefer to have quiet music in the background to help me stay focussed. Quiet background music is good for meditation or dozing, too. If you can’t fall asleep or completely clear your mind, zoning out to some music is the next best thing.

The best music for that is simple and repetitive — something nice enough to listen too, but not distracting, and okay to tune out of when needed. Computer game music is like that, by design, so there’s plenty of good background music out there. The harder problem is finding samples that play for more than a few minutes.

So I made loopx, a tool that takes a sample of music that loops a few times, and repeats the loop to make a long piece of music.

When you’re listening to the same music loop for a long time, even slight distortion becomes distracting. Making quality extended music audio out of real-world samples (and doing it fast enough) takes a bit of maths and computer science. About ten years ago I was doing digital signal processing (DSP) programming for industrial metering equipment, so this side project got me digging up some old theory again.

Woothee (HTTP User Agent Parser)


Tags: , , and

I’ve written a D implementation of the Project Woothee multi-language HTTP user agent parser. Here are some notes about what it’s useful for, and a few things special about the D implementation.



Tags: , , and

TL;DR: I’ve translated Python’s urllib.parse to D for parsing, building and transforming URLs. You can get it from Gitlab.

URL handling is one of those things that most of the time can be done with a regex that mostly works. But sometimes I want a just-works tool when writing D, so I translated Python’s URL handling library. The API isn’t perfect (e.g., the url_split and url_parse distinction is a bit confusing), but it’s been tested against multiple RFCs and had plenty of real-world battle hardening.

My translation is meant to give the same output as Python does, so I’ve translated the Python test suite as well. I don’t plan to add any new features that aren’t in Python.

I hope someone else finds it useful.

D for Bare Metal Programming

Published , Updated

Tags: , and

This post is somewhat outdated. It’s still relevant, but some of the problems I discussed have already been fixed.

Previously I talked about booting a PC directly to bare metal D and said that Hello World is never a strong test of a programming environment. To get a better feel for what D is really like on bare metal, I wrote Xanthe, a simple, classic-style vertical scrolling shooter game with no dependencies on either the D or C runtime.