I Love Fake Rock And Roll

Wednesday, February 6th, 2008

About a month ago, while utterly dominating ZZ Top on Guitar Hero, I got a dumb idea. Everyone loves Guitar Hero, right? How cool would it be to play a Guitar Hero guitar during a live show? Okay, bad question, but I intended to do it anyway. I couldn’t just play the game on stage, however. That would cross the very narrow line from geek-cool into Lamesville, USA, Population: The nerd playing Guitar Hero on stage. No, I’d have to play an actual song… so I did, and “Underneath Your Clothes” never sounded so dumb. The sound guy at Schubas seemed to get a kick out of it, though.

Several people have asked me how the dingus worked, so I will explain it below if you’re interested.

Wii controllers are actually bluetooth devices. Bluetooth is most commonly used for those wireless borg-esque cellphone ear-thingies but it can send other types of wireless signals as well. So the first step was getting a bluetooth receiver for my computer. (Thanks, eBay!)

I then found a little C# library written by Brian Peek that reads and processes the raw wireless signal from the Wii controller. It needed a little wrangling, but the software was soon reacting to button presses from the Guitar Hero controller.

The next step was to make those buttons do something. I figured out all the chords I would need to play the song and mapped them out to combinations of buttons on the controller as shown to the right. Single buttons were used for single notes and multiple buttons represented chords. I then recorded all of the guitar strums and plucks. The “up” strums were short and choppy, while the “down” strums were longer and more sustained. I did three versions of each sound so that repeated strums wouldn’t sound too, well, repeated.

Then, using the managed DirectSound library, the application plays the appropriate sound file based on the buttons that are being pressed, cycling to the next version each time a sound is played.

Next Steps
I had some motivation at one point to use midi instead of wave files, but decided wave files would be easier. Also, I don’t have any midi gear. I also had a fantasy of using the accelerometer values (which measure the position of the wiimote) to make a kind of theramin, basically manipulating a sine wave based on the tilt of the guitar. I realized, however, that I’m nowhere near coordinated enough to push the buttons and control the tilt of the guitar at the same time. I have a hard enough time with star power.

Download Source Code
If anyone is interested, you can download the crappy C# code I wrote here. I don’t know C# very well, so It’s pretty lame. Like I said, it’s based on Brian Peek‘s library. He did most of the hard work. I should probably clean this up before presenting it to the public. It’s pretty embarrassing that all of the sound files need to be in the C:\WiiChords folder, but I’m lazy like that. It’s also pretty embarrassing that all of the sounds are just loaded into memory. But, whatever, the dang thing worked, right? Anyone who wants can do whatever they want with this.

GuitarHeroWiimote.zip (1.44 MB .zip)

See Managed Library for Nintendo Wiimote by Brian Peek for more information.

You will need .NET and a Managed DirectX library to run this. I should probably, at some point, move the audio over to XNA. That seems to be where Microsoft is heading.

Comments

you’re such a fantastic dork. seriously.

No. You’re wrong, Shama. He’s seriously dorktastic!!

Post a Comment

NameE-MailWebsite