Monthly Archives: January 2008

Using the Guitar Hero controller as a musical instrument

At the show last night I played the Guitar Hero X-Plorer controller. No, really, as if it were a real instrument. Like, I could actually determine whether I played a C or a D.

After the show people asked me how I did it. XNA easily interfaces with the X-Plorer controller as a standard xbox 360 controller. So I built a little C# program (after learning C# with some of Jude’s help) using XNA and the C# MIDI Toolkit to map the controls to MIDI notes (in a clever way, see the program documentation for more details) and output to a MIDI Yoke port which was read by Reason. Then I just used Reason’s excellent guitar and synth patches and played away. There will be YouTube videos of the show soon :-).

The C# program is here, called Guitar Hero Hero, and here is the source.

Orson Scott Card Improvs

Last week I picked up a book of short stories by Orson Scott Card. Two of them (so far) have inspired improvisations:

  • The Maker (from “Unaccompanied Sonata”)
  • Songbird (from “Mikal’s Songbird”)

The Maker is an uptempo and very dissonant, built on augmented chords and a random alternating bassline.

Songbird is one of the most complex pieces I have improvised so far. It is harmonious (it stays diatonically in one scale almost the whole time), but there are at least three voices that I can identify. While improvising this one, I kept thinking to myself that I should end it soon before I mess up, because I can’t keep up the complexity… but I didn’t. I just kept going until the song wanted to end. In my opinion, this is one of my best improvs to date.

Oh, I should say something about “Mikal’s Songbird”. This is a jewel of Orson Scott Card’s work: great story, beautifully written, captivating to read. I highly recommend it.

Non-improv band

In the style of the SNW call for musicians which created the last year of great music, I just posted the following to craigslist Denver.

I’m trying to create a project, in whatever genre that emerges from it, which is inspired by the ideas of classical music. That is, a project where members write complex songs with beautiful harmonic interplays and variety, not songs based on repetition of the same idea for five minutes and then end.

I come from a background of improv jazz/funk and classical piano music. Basically I want to see what music with a jazz/funk instrumentation sounds like if it’s be finely arranged and rehearsed, in a way that would be impossible to improvise. Hmm, it might end up sounding kind of prog-rocky. I’m open to whatever happens with it, though.

So, I’m looking for any talented instrumentalists regardless of their instrument (in order to put together a balanced ensemble for the first session). You get extra points for each of these things: * reading music, * being a composer, * open-mindedness.

Don’t worry, SNW is not dying1. At the risk of musicing myself out, this is an additional band.

1 However, it will undergo a personnel change in the near future. Eric is moving to Argentina :-(. Farewell Eric, it will be damn near impossible to replace you.

FRP: What’s the big deal?

I really have to get to bed, but I just did a little test and am so excited I need to say something:

AFRP sucks. The incredible amount of trouble I had to go through just to implement extremely simple physics with a dynamic number of balls within FRP (none of that cheating by factoring the physics elsewhere; while that may be a good thing to do, it’s a point for the power of FRP if you can do it directly in FRP) indicates that AFRP is absolutely not suitable for games. The short reason is that is chokes when faced with dynamic behavior.

On the other hand, classical comonadic FRP is great; it supports such dynamism without a sweat. That is, if it weren’t for the spacetime leak that results when you have value recursion like:

  e = integral 1 e

Which is horrible because that is the form of every differential simulation (read: games).

Because of that leak, I tried three different approaches with arrows, with varying flexibility trade-offs, but they were all bad for making games. I wanted to go back to comonadic FRP so badly, but the spacetime leak loomed in the darkness, condemning my programs to progressively slow down (and eat up more and more memory) as they ran.

As refresher, the data structure for comonadic FRP is:

  type DTime = Double
  data Signal a = Signal a (DTime -> Signal a)

And today something hit me, something so simple that it made me reconsider my sanity:

  -- 'runSignal step sig' produces the infinite list of
  -- values every 'step' seconds from 'sig'
  runSignal :: Double -> Signal a -> [a]
  runSignal = ...

  -- listSignal is the inverse of runSignal, constructing
  -- a signal from a list
  listSignal :: Double -> [a] -> Signal a
  listSignal = ...

  buffer :: Double -> Signal a -> Signal a
  buffer step = listSignal step . runSignal step

The buffer function just samples a signal at regular intervals, caching the results internally in a list. The implementation of these three functions combined is 13 simple lines; the concepts are easy too. Again, foreheadslap! Why? This is why:

  e = buffer 0.05 $ integral 1 e

No more spacetime leak! The nth timestep of e is found in linear time and constant space. To generalize the technique, just put a buffer between any value recursion to fix the leak. No, it’s not a perfect solution, but it’s a good compromise. You still get perfect granularity in your event handling (to me, an essential property), and you get to use comonadic FRP.

I’m so excited!