maxton.xyz (because maxton.net was taken)

Back to Blog

GamepadMidi: Using Rock Band 3 Xbox 360 Instruments as Wireless MIDI Controllers

Rock Band 3 was the first and last Rock Band game to feature a keyboard as one of the playable instruments in the game, allowing you to pretend to play all the classic piano, synth, and organ parts of your favorite songs — at least, if your favorite song was released for Rock Band after October 26, 2010.

Harmonix developed and shipped a wireless 25-key keytar in addition to a MIDI-to-Xbox/PS3/Wii controller adapter, giving you, the user, the flexibility to use your own MIDI keyboard if you preferred. They also helpfully placed a MIDI out connector on the keytar itself, just in case you want to use it as a normal MIDI controller, which I'm sure dozens of people took advantage of.

That's all cool, but what I was interested in was a way to use this keytar as a wireless MIDI controller, which was not one of their envisioned use-cases. Being able to play a synth solo without the restrictions of a MIDI cable seemed like a fun idea, and I already had a knock-off Xbox 360 wireless controller adapter for my PC, so I got to work on a program that would take the XInput messages from the keyboard and translate them into MIDI messages. It turns out that it works pretty well! Once I had the keytar more-or-less working, I even added support for the drum kit as well.

GamepadMidi

This is the name I settled on for my software, after initially calling it "KeytarPoller." The original name made less sense once I added drum kit support, so "GamepadMidi" it was.

GamepadMidi screenshot
This is the spartan interface of my software. It gets the job done.

If you have a keytar or drum kit, an Xbox 360 controller adapter, and a Windows PC, you have all you need to try out GamepadMidi.
Download GamepadMidi-x.x.x.x.zip here

Using with a DAW

So, if all you want is to play around with the Microsoft software synthesizer or send MIDI messages out through another USB-MIDI device, GamepadMidi is all you need. But if you want to control a DAW then you need a MIDI loop-back driver. I recommend LoopBe1 which works great and is free for non-commercial use. You can use LoopBe1 as the output device in GamepadMidi, and the input device in your DAW. I guess if you have a MIDI cable and MIDI in/out ports you could also just use a physical cable to do the same thing.

How it Works

There are 3 main parts to GamepadMidi: the controller monitor, the MIDI translator, and the GUI. The controller monitor is essentially just a thread that checks for new Xbox controller input as quickly as possible. The XInput API is a polling-based API, not an event- or interrupt-driven one, so this is the only way to get near-real-time data from the controllers. The controller monitor generates C# events that the MIDI translators are subscribed to. Each instrument type has its own MIDI translator class to convert from joystick, trigger, and button data into C# events representing MIDI messages.

The GUI deals with presenting a list of Xbox controllers and MIDI devices to the user, and wiring up the controller monitors to the MIDI translators, and taking events from the MIDI translators and sending them to the selected MIDI device. It also shows you the battery status for the controller and the current base note of the keytar — since the keytar is only 2 octaves, I added a feature to transpose up and down octaves using the D-pad.

Further Development

I really would like to add support for the touch-pad on the neck of the Keytar, since it would be great as a pitch-bend or modulation controller. Unfortunately, the data for that touch-pad does not appear to be present in any of the XInput structs. I suspect there is a secret API that's only exposed to Xbox 360 developers for adding more data than just button presses, joystick positions and trigger values to the controller state. Please let me know if you come across this API (or if it even exists on Windows)!

I have some ideas for extending this software to work with the guitar controllers as well. I'd mostly be interested in the monstruous "PRO" guitar controller since it has buttons on every fret, but sadly I do not own one of those. Even the 5-button guitar could be an interesting, albeit limited addition. I also have some ideas to make the software more configurable so you can e.g. remap the midi notes for the drum pads or add MIDI controller events to the A/B/X/Y or D-pad buttons. But for now, the software is feature-complete for my use case.

Sorry, there is no way to comment directly on my blog posts.
But feel free to contact me if you have questions or comments!