The hidden music of the web: HTTP response codes arranged for guitar
Nowadays, one of the perks of a desk-based job is a Slack channel. It's supposed to be an efficient way to communicate across your department, but in reality it's mostly a place to share animated gifs and dumb news stories. It was there that a colleague recently shared the amusing 404 page from the Ultimate-Guitar.com guitar tablature website.
A "404", for the benefit of those not in the industry, is a reference to the error code that a web server sends when it can't locate the page that you asked for. In the case of Ultimate-Guitar.com, instead of a boring server error message, they opted instead to show a full-page video clip of someone comprehensively failing to guitar. There are several different clips available; refresh the page to see a new video. It's a nice easter egg, and probably one of the few places where the web designer(s) of that particular site were able to stretch their creative muscles.
Perhaps it's just the way my mind works, but the juxtaposition of guitar tabs and server codes got me wondering: What if server response codes actually were guitar tabs?
As it turns out, they kind of are.
A brief guitar tab primer
Guitars, as you probably already know, have six strings, which are tuned to E, A, D, G, B and E (assuming you haven't opted for some strange Joni Mitchell-esque alternate tuning scheme). In guitar tablature (or "tab"), the positions you place your fingers on the fretboard are shown as numbers. For example, 0-2-2-1-0-0 means your fingers should be on the second fret for the second and third strings, and the first fret of the fourth string, while playing the rest of the strings without touching them (also known as "open"). Place your fingers as indicated, and strum the guitar. Congratulations, you just learned to play E major!
Since HTTP response status codes are also numeric, albeit only three digits in length, it's pretty easy to pretend that they are guitar tabs. For the sake of argument, let's assume we only want to play the bottom three strings, and see what sort of music we can make.
The Hallelujah Chorus: Success codes
When your browser requests a web page, it sends a request out onto the internet, which via a series of tubes eventually finds its way to the correct server. That server responds with a code, and (hopefully) sends back the web page that you asked for.
The most basic success code is
200 OK, which basically means "your request found the right page, and here it is". Translating 2-0-0 into a guitar chord gives us F♯-A-D. Hey, that's D major! A nice round major chord, signifying success and happiness. Here's your web page, ta-da!
Occasionally you might instead receive a
204 No Content response, indicating that the request was successful, but no content is being returned. That gives us the chord F♯-A-F♯; either D major missing its tonic root, or F♯m with no dominant fifth. Either way, we're rather appropriately missing some content here too.
One (Re)Direction: Redirect codes
Response codes that begin with a three are all related to redirected requests. That might be because some content on a web site or service has been moved, or due to the server passing a request around as part of an authorisation process.
301 Permanent Redirect, much beloved of webmasters eager to retain their ranking in Google, gives us G-A-D♯ (or E♭ if you prefer), which is a pretty gnarly Adim7 (A with a diminished 5th and the minor 7th note played). But wait! Musical harmony theory states that dissonant chords like this one want to resolve. A is the dominant chord of D, which means that our 301 redirect wants to resolve back to its tonic ... which is the
200 OK response above. Rather poetically, the redirect response resolves into a successful result, both musically and on the web.
302 Temporary Redirect code behaves in almost the same way, except where the 301 had a highly dissonant diminished 5th (or augmented 4th, they mean the same thing), 302 turns into the far simpler G-A-E, or A7. Again, it resolves to D major.
Whoops, I Did It Again: Error codes
HTTP error codes, such as the 404 mentioned at the start of this article, all begin with a four. Right off the bat, we can tell this isn't going to sound very nice, since the fourth fret on the low E string is G♯, which is only a semitone below the open A string. Virtually all our error codes will feature this most dissonant interval possible ... which seems appropriate, really, since we want to alert users to their mistakes or failed requests, and there's nothing like dissonance to shake up an audience -- just ask Bernard Herrmann!
Here are the most common error response codes, and their associated guitar chords:
400 Bad Request- G♯-A-D (AM7sus4)
401 Unauthorized- G♯-A-D# (D♯sus4♭5)
403 Forbidden- G♯-A-F (Fadd♭3)
404 Not Found- G♯-A-F♯ (F♯madd2)
Most of these assonant chords resolve quite nicely to our D major root
200 OK chord/code too, although in reality you're unlikely to find a server that knows what to do next when one of these responses is thrown.
There's another class of error code -- server errors -- that start with a five. These are going to be far cleaner chords, since the fifth fret is the same note as the open A string:
500 Internal Server Error- A-A-D (D major)
501 Not Implemented- A-A-D♯
502 Bad Gateway- A-A-E (A major)
503 Service Unavailable- A-A-F (D minor)
My favourite of these is the 503 error code, which is returned when the server is overloaded, down for maintenance, or otherwise unreachable. Pretty sad, right? Which makes it entirely appropriate that, although it's lacking a root, A-A-F could easily be a D minor chord, the saddest of all keys.
Music, music everywhere
The basic construction blocks of music (at least in the diatonic scale used most frequently in the West) have their roots in simple physics. Intervals between octaves, thirds, fourths, and fifths follow logical frequency ratios, in much the same way that pleasantly logical ratios crop up in nature's sunflower seed and snail shell spirals (and have been copied by architects and designers of all stripes for thousands of years).
The universe clearly has a plan; perhaps, then, it should not be too surprising that converting HTTP response codes into guitar chords might produce the same pleasing sounds that music theorists have recognised as being the most pleasing to the ear for thousands of years.