I have figured out how to use my Guitar Hero World Tour (Wii) drum kit as a drum machine.

Ingredients

Overview


wiimote -> python -> hydrogen
Naturally there are two parts, getting the wiimote data and translating that data into midi events to be sent to hydrogen. The first part is accomplished with cwiid, the second with python and pyPortMidi.

cwiid


Install cwiid, create a config file (see below) and then run
sudo wminput -c drums
Note drums is the config file. Note how when you hit a drum, the character for the color, such as b for the blue drum, shows up in the terminal according to the mapping file below.
# GHWT drums
# Classic.B is Red
# Classic.Y is Yellow
# Classic.X is Blue
# Classic.ZL is Orange
# Classic.A is Green
# Classic.ZR is Foot Petal
Classic.B		= KEY_R
Classic.Y		= KEY_Y
Classic.X		= KEY_B
Classic.ZL		= KEY_O
Classic.A		= KEY_G
Classic.ZR		= KEY_F

python


The python program will listen for the characters from cwiid (they will show up in the terminal) and then dispatch them over midi to hydrogen. The final python program is below. To run first start cwiid, then hydrogen. After that run the script without any arguments to find out which midi port hydrogen is listening on. Then run the script with that port number as the first argument. Make sure the input is focused on the terminal and hit some drums! Depending on the hydrogen drum kit and your preferences, you may want to change the mapping from drum characters to drum sounds.
import pypm
import array
import time
from sys import argv
INPUT = 0
OUTPUT = 1
## }
def PrintDevices(InOrOut):
    for loop in range(pypm.CountDevices()):
        interf,name,inp,outp,opened = pypm.GetDeviceInfo(loop)
        if ((InOrOut == INPUT) & (inp == 1) |
            (InOrOut == OUTPUT) & (outp ==1)):
            print loop, name," ",
            if (inp == 1): print "(input) ",
            else: print "(output) ",
            if (opened == 1): print "(opened)"
            else: print "(unopened)"
    print
def Usage():
    print("python drum_midi_magic.py [midi out dev number]")
def DrumLoop(midi_out_dev_num):
    latency = 0
    MidiOut = pypm.Output(midi_out_dev_num, latency)
    print "Midi Output opened with ",latency," latency"
    print "Press q to quit"
    while(1):
        c = getch()
        print(c)
        # play note 36 (C1) the first hydrogen drum, with velocity 100
        # MidiOut.WriteShort(0x90,36,100)
        if c == 'q':
            break
        if c == 'f':
            MidiOut.WriteShort(0x90,36,100)
        if c == 'r':
            MidiOut.WriteShort(0x90,38,100)
        if c == 'y':
            MidiOut.WriteShort(0x90,46,100)
        if c == 'b':
            MidiOut.WriteShort(0x90,43,100)
        if c == 'o':
            MidiOut.WriteShort(0x90,49,100)
        if c == 'g':
            MidiOut.WriteShort(0x90,41,100)
    del MidiOut
pypm.Initialize() # always call this first, or OS may crash when you try to open a stream
if len(argv) != 2:
    Usage()
    PrintDevices(OUTPUT)
else:
    DrumLoop(int(argv[1]))
pypm.Terminate()