Drum Machine using Wii GHWT Drum Kit, Python, and Hydrogen
I have figured out how to use my Guitar Hero World Tour (Wii) drum kit as a drum machine.
Ingredients
- pyPortMidi (For sending MIDI events to the drum machine)
- Patch to make pyPortMidi work
- cwiid (for wiimote communication)
- Hydrogen (drum machine software)
Change pypm.pyx line 357 to:
while(Pm_Poll(self.midi) != pmNoError):
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.
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.