Wiimote to MIDI Tutorial using GlovePIE

This post is a simple step-by-step guide on how to control your MIDI devices with a Wiimote. This MIDI equipment could be a hardware synth, a DAW like Abelton Live, or any other MIDI capable hardware or software. The tutorial will use GlovePIE which is available for free download. This software is Windows only, so this tutorial only applies to Windows uses, but Mac users looking for an alternative should check out OSCulator. The other software I’ll be using in this tutorial is LoopBe1 which is a free virtual MIDI driver which I’ll explain more about later.

So some people might be wondering why you would want to control MIDI devices with Wiimote, I mean sure it’s cool if your a nerd, but what’s the point? I thought the same thing until I saw this guy:

[youtube]http://www.youtube.com/watch?v=LKV_bxid_Xs[/youtube]

So the answer is performance. One of the biggest challenges facing electronic music is the performance aspect; standing behind a pile of gear and twiddling some knobs doesn’t really make for an interesting live show. With a Wiimote, you can turn your knob twiddling into dramatic waggling that the audience can see!

Now this is a lot easier then you might think, you don’t need any programming experience, just a basic grasp of what MIDI is and you should be up and waggling in no time. First of download and install LoopBe1 and GlovePIE (you’ll have to click “I already have 100% green power” and you can get the one without Emotiv support).

The Wiimote is easy to connect to your PC  because it communicates using the popular Bluetooth protocol. So the next thing you want to do is pair your Wiimote with your PC using Bluetooth. Most laptops have a Bluetooth receiver built in, but if you don’t have this you can get a USB Bluetooth adapter for a few dollars off ebay. Now the actual pairing process varies depending on which Bluetooth software you have on your PC, but the process is the same as for adding any other Bluetooth device so there should be all the info you need on the net or in help files. All you need to know is that you press tha “1” and “2” buttons at the same time so that the lights flash before you try to connect to the remote, and then select “Pair with a code” or similar if you are asked. Once you have done this successfully your software should be telling you that you are connected, but there won’t be any lights showing on your Wiimote so don’t worry.

Next load up GlovePIE. GlovePIE uses a simple scripting language to convert between different input and output. So for example you could set it up to make the “A” button on your Wiimote act as the “Enter” key on your keyboard; or a joystick, gamepad, x-box controller to act as your mouse, keyboard etc. whatever way you program it. It is a very powerful program and when you realise what it’s capable off it opens up a whole range of possibilities. The great thing about GlovePIE for our purposes is that it has built it support for both Wiimotes and MIDI!

First lets just make a simple MIDI note assignment, we’ll make the “A” button on the Wiimote play MIDI note C3. To do this we need to define our MIDI output, and we need to have something that will play this MIDI note. If you have a hardware MIDI interface and a synthesiser this involves simply connecting a cable between your interface and synth and away you go. If you want to control your software this is where LoopBe1 comes in. LoopBe is a virtual midi cable, it does the same thing as connecting a cable between your MIDI interface and synth, but all inside your PC. For this tutorial I’ll assume you are controlling software, but all the same things apply if you are controlling hardware, you’ll just be using a different MIDI output (your interface instead of LoopBe).

GlovePIE assigns a device number to each of your MIDI outputs, to work out which one LoopBe1 is go to the “GUI” tab, click “Choose Manually” and then click the “Output Device” drop-down box.

Here you can see on my PC LoopBe is Midi2. Take note of what number LoopBe is on your PC since it may be different.

Now click back to the “Untitled” tab and type this into the text area:

midi.DeviceOut = 2
midi.DefaultChannel = 1
midi.c3 = Wiimote1.A

Replace the “2” with whatever device number you noted down before. So what this is doing is telling GlovePIE to use LoopBe as the MIDI output device, to output on MIDI channel 1, and to assign the “A” button on the Wiimote to MIDI note C3. Note that GlovePIE isn’t case sensitive so you can write MIDI.c3 = wiimote.a and it won’t matter.

So now go ahead and click “Run”. If your Wiimote is paired correctly light’s 1 and 4 should light up while the program initialises, and then the only the 1st light will be lit when the program is running. If you don’t see any lights your Wiimote isn’t connecting properly. I’ve found this part of the process a little buggy but always manage to get it working. First of all check that in your Bluetooth software it is still telling you that your Wiimote is connected. If it isn’t, try pairing it again. If it is, just try clicking “Stop” in GlovePIE and then start again, sometimes it takes a couple of goes for some reason. Also try going to the “TroubleShooter” menu in GlovePIE and clicking “No bluetooth auto-connect”, I haven’t had much luck using GlovePIEs auto connect, and have found it messes up my connection sometimes, but it may work for you. After a bit of mucking around it will connect, and the good news is, once connected I’ve found the connection to be very stable, no drop outs.

So now your GlovePIE script is running, your Wiimote light is one, all you need to do is assign the midi to something. This is the same process as assigning a MIDI keyboard, which you should be familiar with in your DAW or soft synth of choice. Here I’m using Massive:

Now press “A” on your Wiimote and you will hear sound!

Ok now here’s where it starts to get fun; lets assign the pitch of the Wiimote to a MIDI control value so we can turn knobs by waving our hand around. Press stop and type this into the text box underneath what you have just typed:

if Wiimote1.B then
midi.control10 = maprange(wiimote1.smoothpitch, -90 degrees, 90 degrees, 0, 1)
endif

Let’s break down what’s happening here. The first line is called an “If statement” and is a common construct in programming, what it says is “if something happens, then do this” . In our case the something is “Wiimote button B pressed” and the this is mapping the pitch (tilt) of the Wiimote to MIDI control message 10. The number 10 is completely arbitrary here, though some soft synth’s (and most or all hardware synths) do have pre-assigned control values, so e.g. 74 might be filter cutoff. If not already assigned, most software has some sort of MIDI learn function, so you should be able to choose a parameter of your synth (e.g. filter cut off), hold “B” and wave your hand and it should automatically assign that MIDI control value to that parameter.

So now press run again, and go an assignment your MIDI control value. Spend the next 10 minutes or so waving your hand around like a idiot, like I do here:

[youtube]http://www.youtube.com/watch?v=c7bPkouoLdk[/youtube]

If you’ve got this far, you’re more than capable of reading through GlovePIEs documentation and utilising all the great inbuilt functions for wiimotes, so have a look and get creative. Get in touch with me if you have any troubles, go to megatroid.com and hit me up on twitter!

3 Responses to Wiimote to MIDI Tutorial using GlovePIE

  1. Thanks so much for posting this!  I know a lot of people have some Wii -> Midi tutorials, but this one is very clear and straight to the point.  Thanks again!

  2. Pingback: Using the Wii Remote with Pure Data | audio destrukt

Leave a Reply