WII to MIDI WALKTHRU for Windows

Wiimote Video Mixer from Eric Medine on Vimeo.

This is a tutorial on how to mix video using a Nintendo Wii controller and VJ Software such as Resolume or Isadora for your PC. I used a Dell Inspiron 8100 with a gig of ram running WinBlows XP, some kinda ATI video card that has disappointed me in the past, and a 2.4 MHZ processor. Running Vista? Haven’t tried it yet. If you have Vista and this walkthrough works for you, let me know.
About the Wii
(from the excellent wii to midi walkthru by ANTIVJ.com)
In addition to the traditional buttons, force feedback and the integrated mini-speaker, the true innovation is the presence of a gravity and acceleration sensor (the ADXL330, used in the army or automobile safety, for airbags systems) inside the Wiimote which collects the movements and acceleration of the Wiimote on each of the 3 axis, X, Y et Z.

The good news is that rather than using a proprietary protocol to transmit the infos from the Wiimote to the Wii, and then lock its hardware to keep an exclusive use of it, Nintendo has made the excellent decision (probably by commercial will) to use the Bluetooth protocol, standard of communication on PC and Mac for several years. This means that you can connect your Wiimote to your computer, and program it rather simply for any use you want.

About this tutorial
Use this tutorial however you want, feel free to add to it, be sure to forward it to whomever and give it away for free. If you charge some lazy bastard for this tutorial, you suck. If you use it for a performance and you make money– you rock! If you have some questions, advice, or praise, contact me at:
info(at)ericmedine(dot)com

What you will need
– A Wiimote, of course (approximately £20/35$, online or at your local video games shop).
– A Bluetooth
Dongle
(if your computer doesn’t have Bluetooth already, about
$30).
GlovePie (freeware). Converts the signals sent from your wiimote to Midi (or anything else).
MidiOX
(freeware). Manages MIDI. Although I can use it to route my in and outputs, I really only use it as a MIDI monitor. You can contribute to MIDIOX thru Amazon.com– I gave them 10 bucks.

Other resources:
Using the wiimote with Resolume (very excellent walkthru, complete with midi scripts for RSLume that unfortunately I have not quite been able to get to work):
http://www.resolume.com/forum/viewthread.php?tid=3102

Wiimote to Midi tutorial from AntiVJ:
http://crustea.vjfrance.com/article-130714.html

STEPS:

1) Connect your wiimote to your pc
2) Convert the signals the wiimote sends to MIDI
3) Rock it, rockstar!

STEP ONE: Connect your wiimote to the PC

If you have Bluetooth built into your computer skip to part 2. If you dont, you may take this opportunity to install a ridiculously expensive Bluetooth adapter and construct a delicate web of buggy freeware– PC only, of course. If you have a mac you can probably just plug and play the damn thing.


A. Install your Bluetooth USB adapter (I used a $30
Kensington dongle from Best Buy
). I had to install the drivers
for a minute, plug the thing in, etc. Eventually you should get
that little message that says “your hardware is ready to use”.
If not, re-install, unplug it then plug it back in, go to the manufacturer’s
website and try to install the drivers there, make sure your adapter
is compatible with your PC and with a wiimote– you know the drill.
I have heard of people using Bluesoleil
software
to access their Bluetooth, but I always like to use
the software that comes with the device, and I thought Bluesoleil
was kinda buggy.


B. Configure your Bluetooth adapter. Once your driver and the Bluetooth adapter is installed, you should see the funky blue Bluetooth logo in your toolbar. Right click on it (or go thru your Start menu) and do a “Explore My Bluetooth Places”. A folder will open up, click on “Bluetooth Setup Wizard”, and you will get this dialog box.

Click on the second radio button to “find a specific Bluetooth device and configure how this computer will use its services”. Hit the 1 and 2 buttons simutaneously on your wiimote (switches it to “discoverable mode”) then hit “next” in the dialog box. Watch the flashing blue lights while the wiimote tries to talk to your Bluetooth adapter!

C. Select your Bluetooth device (in this case, a wiimote). Now the dialog box will say “Select a Device” and there will (hopefully) be a picture of your wiimote to select. Select it, then hit “Next!” If your wiimote does not show up, try to re-initiate: hit “search again” in the dialog box, switch to “discoverable mode” on your wiimote (hit the 1 and 2 buttons simultaneously), etc.

Once you select your wiimote and hit “next”, you will get to the “pairing” screen. Ignore it– hit “skip pairing”. I tried to initiate pairing, but I couldn’t find a number on my wiimote, except some weird serial number that didn’t seem to do anything. What is pairing? I don’t know. This is taking too long.

D. Configure your wiimote. Now that your computer sees your wiimote, you need to select it. Again. It seems like I needed to constantly switch to “discoverable mode” on my wiimote (hit the 1 and 2 buttons simultaneously) during this entire process.

Hit “Finish”. Your Bluetooth logo in your toolbar should turn green. Your wiimote is now connected to your PC!


STEP TWO: Convert the signals the wiimote sends to MIDI

Now that your wiimote is talking to your computer, it’s time to configure some softwares to listen to what it says! You will be using GlovePie, a program that was originally created to work with the Essential Reality P5 Glove— classic! This software developed by Carl Kenner has the role of converting any type of signal (from a mouse, Joystick, a P5 glove) into another signal (MIDI, variables…) using a simple scripting language and/or a GUI.

A)
Start up GlovePie.
I don’t recall if it even needs an install,
but I remember having some problems when running it off my desktop,
then moving it to my Programs folder, then running it again.

Anyway, when you open it up it displays an empty script editor,
basically you type in the commands you want your control module
(in this case, the wiimote) to execute and hit “Run”.
There’s an autogenerate, but I have not really experimented with
it yet.

Raw coding is intimidating, but fortunately there are loads of
scripts provided with the install: for example, go to the “File”
dropdown menu, then open “WiimoteScripts/WiiMouse 0.1.PIE”,
and click on RUN, and you can now control your mouse cursor with
your Wiimote.This is what I used to make sure that the wiimote is
actually working– up untill now, the only proof you have that it
works is a stupid dialog box. If you run “WiiMouse 0.1.PIE”
and your cursor drifts up to the top left of your screen– your
wiimote has not been detected properly. Go back to some previous
steps, try again! I sometimes use “WiimoteIdentifier.PIE”
to check if it sees any wiimotes, but it seems like it can “see”
the wiimote without “hearing” the data. If you are dancing
your mouse around the screen with your wiimote, you are almost done!

B) Load the Wiimote to Midi script into GlovePie.
Antivj.com
has the newest version of the script
here
, or you can copy, paste and RUN the script below. After
you copy and paste this code into GlovePie, be sure to save it for
later– call it something like “WIItoMIDI.PIE”. Be sure
to uncomment/comment out the appropriate sections to disable key
commands from your wiimote if you are planning to use it more…
unconventionally. This script ( beta0.1), you get the value of X,
Y and Z slope value from your Wiimote, which are converted into
#CC values 30, 31 and 32, variables from 0 to 127. Sometimes this
seems to make sense to me, sometimes not. Are we done yet?

/********************************
Wiimote to midi, beta 0.1
Use your Wiimote to control Ableton live, Arkaos midi..
contact: crustea@gmail.com
www.antivj.com
********************************/
/********************************
Wiimote’s buttons
********************************/

//Keyboard notes
//To send “keyboard events” instead of “midi notes”,
uncomment this part, and comment “Midi notes” part above.
//Values before the “=” caracter are the keyboard events
that you emulate.

/*
Up = Wiimote.Up or Wiimote.Classic.Up
Down = Wiimote.Down or Wiimote.Classic.Down
Left = Wiimote.Left or Wiimote.Classic.Left
Right = Wiimote.Right or Wiimote.Classic.Right
Q = Wiimote.A or Wiimote.Classic.a
W = Wiimote.B or Wiimote.Classic.b

One = Wiimote.One
Two = Wiimote.Two
Home = Wiimote.Home or Wiimote.Classic.Home
Minus = Wiimote.Minus or Wiimote.Classic.Minus
NumPadPlus = Wiimote.Plus or Wiimote.Classic.Plus

X = Wiimote.Classic.x
Y = Wiimote.Classic.y
v = Wiimote.Nunchuk.ZButton or Wiimote.Classic.ZL or Wiimote.Classic.ZR
L = Wiimote.Classic.L
R = Wiimote.Classic.R
C = Wiimote.Nunchuk.CButton
*/

//Midi notes
//To send MIDI notes, uncomment this part (done by default), and
comment the “Keyboard notes” part
//The value before the “=” caracter is the midi note.

midi2.C0 = Wiimote.Up or Wiimote.Classic.Up
midi2.D0 = Wiimote.Left or Wiimote.Classic.Left
midi2.E0 = Wiimote.Right or Wiimote.Classic.Right
midi2.F0 = Wiimote.Down or Wiimote.Classic.Down

midi2.G0 = Wiimote.A or Wiimote.Classic.a
midi2.A0 = Wiimote.B or Wiimote.Classic.b

midi2.B0 = Wiimote.Minus or Wiimote.Classic.Minus
midi2.C1 = Wiimote.Home or Wiimote.Classic.Home
midi2.D1 = Wiimote.Plus or Wiimote.Classic.Plus

midi2.E1 = Wiimote.One
midi2.F1 = Wiimote.Two


//midi2.A2 = Wiimote.Nunchuk.CButton
//midi2.B2 = Wiimote.Classic.x
//midi2.C2 = Wiimote.Classic.y
//midi2.D2 = Wiimote.Nunchuk.ZButton or Wiimote.Classic.ZL or Wiimote.Classic.ZR
//midi2.E2 = Wiimote.Classic.L
//midi2.F2 = Wiimote.Classic.R

/********************************
Setup for gravity values
********************************/

// these are the magic line, which converts X, Y
and Z rotation values to Midi #CC 31, 32 and 33.
var.xOffset = 1
var.yOffset = -28
var.zOffset = 2

var.xRot = Wiimote.RawForceX + var.xOffset
var.yRot = Wiimote.RawForceY + var.yOffset
var.zRot = Wiimote.RawForceZ + var.zOffset

midi2.Control31= (EnsureMapRange(var.xRot, 26,-26,
0,1))
midi2.Control32= (EnsureMapRange(var.yRot, 26,-26, 0,1))
midi2.Control33= (EnsureMapRange(var.zRot, 26,-26, 0,1))

//Old code: (MapRange(var.xRot, 26,-26, 1,127)-1)/127


/********************************
Setup for acceleration values
********************************/
//Just a test for now, comment the line above to disable X acceleration
to midi note
midi2.C3 = Wiimote.RelAccX >= 15


C) LAST STEP! Configure your computer to send and receive MIDI data


Now it is time to check to make sure Glovepie is sending the appropriate data by installing and running MidiOX (a virtual MIDI port, which emulates a MIDI device to use like a “bridge” with your midi softwares).

After you install MidiOX, you should see something like this. The blue numbers should be scrolling as you move the wiimote, and green numbers should appear when you click on some of the buttons. If this is not the case, hit “Select MIDI devices to open” (the round blue button that looks like a midi input). I just opened and closed midi ins and outs untill it worked. Configuring your computer to run Midi properly in the way you want is beyond the scope of this tutorial. For more info, check out the MidiOX site.

If the numbers are scrolling rapidly, YOU ARE GOOD TO GO! Your wiimote is going into GlovePie, and then into MIDIOX, and from there you can send it to another MIDI device, or use it to control video mixing software.



Comments are closed.