Aanand Prasad

A chiptune cover of Phoenix’s “1901”
the technical details thereof
a gushing tribute

For your amusement, a hacked-together version of Phoenix’s most gorgeous serving of mirror-shiny happy-sad (mp3 here):

A man called _why has disappeared. If you’re not a programmer, this will mean nothing at all. If you’re a Ruby programmer, you probably remember where you were when you heard the news. _why was a creation unlike any I’ve encountered; prolific, talented, amusing and affable. I am not alone in considering him my biggest inspiration. He gave no notice of his departure and left no explanation—one day he was simply gone.

One of his later creations was bloopsaphone, a synthesizer for making chiptune-style music (“you know: the sounds of ataris, gameboys and the like”). The impulse to use bloopsaphone for something, anything, came to me out of nowhere and made sense instantly: pay tribute to the guy, guy! “1901” was just in my head at the right time.

A Technical Deep-Dive

bloopsaphone is a library, not a program—you use it by writing code, not by clicking buttons. Compositions are all code, all the way down. This is how you play the Simpsons theme:

require 'rubygems'
require 'bloops'

b = Bloops.new
b.tempo = 180

sound = b.sound Bloops::SQUARE
sound.volume = 0.4
sound.sustain = 0.3
sound.attack = 0.1
sound.decay = 0.3

b.tune sound, "32 + C E F# 8:A G E C - 8:A 8:F# 8:F# 8:F# 2:G"

b.play
sleep 1 while !b.stopped?

bloopsaphone displays many of the qualities typical of _why’s creations: cute name, ASCII-art banner in the README, tiny set of commands, little to no documentation. These alone make it irresistible; however, it also turned out to produce convincingly nostalgic noises out-of-the-box, which was a nice bonus.

However, I found it lacking when it came to arranging a tune of more than a few bars’ length, since it requires that you give it each instrument’s score upfront, just like you’d give to a real musician. This becomes unwieldy when working away at the particulars of a passage, say, right in the middle of a two-minute track. Either you play the whole tune from the start every time you make a change and quickly go insane, or you go through every instrument’s score and temporarily chop the beginning off every time you want to focus on a particular section, and quickly go insane.

When faced with a problem like this, a programmer will never back down and shove their nose onto the grindstone. This is a problem of automation, they will say to themselves sagely. The solution is clear: write some code to manage this stuff for me. And so, feepogram.

Yeah, I Made Something Else

feepogram is a notation for non-trivial bloopsaphone compositions. Its primary contribution to civilisation is that it lets you decompose your tune primarily by section, not by instrument. Slicing the grid this way rather than the other might well have its disadvantages (I haven’t really bothered to think about it), but one dazzling advantage is that listening to specific passages quickly becomes effortless.

For the Rubyists, here’s what a feepogram score looks like:

require 'bloops'
require 'feepogram'

bloops = Bloops.new
bloops.tempo = 320

song = Feepogram.new(bloops) do
  sound :crunch, Bloops::NOISE do |s|
    s.punch = 0.5
  end

  sound :oooo, Bloops::SINE do |s|
    s.sustain = 2.0
  end

  sound :plink, Bloops::SQUARE do |s|
    s.punch = 1.0
  end

  def and_one
    phrase do
      oooo   " 1:c2 " * 8
      plink  " c d e f g a b + c - " * 4
    end
  end

  def and_two
    phrase do
      crunch " c2 4 c5 4 " * 8
      oooo   " 1:g2 " * 8
      plink  " c d e f g a b + c - " * 4
    end
  end

  2.times do
    and_one
    and_two
  end
end

song.play

I’m not going to explain the workings of all of that here (aspiring composers are advised to consult the manual), but oh oh look did you see how I can get the entire thing to repeat itself by wrapping itself in a 2.times block? Mmmmmmmmmmmmmmmm. And so at the end of my 1901.rb source file I have this:

intro
verse_instrumental
verse_1
verse_2
chorus_1
chorus_2
post_chorus
outro_1
outro_2
the_end

Readable and malleable.

There Was a Point to All This

Several, actually. Firstly, look what I made! Seriously though:

I really do. A lot of us do. _why, your influence on us was indelible and wholly positive. This song’s for you. I hope we do our very best to keep all your little treasures alive. Wherever you are, I hope you’re okay.

Fonts by exljbris