JAMES BRITT

Current album
Loosies

Get it here ...

Wiivisiting old software

Back around 2007 or 2008 I started hacking around with Wii controllers (AKA “wiimotes”). People like Johnny Lee were doing some cool stuff by repurposing the controllers.

I even gave a talk about this at the 2009 Mountain West Ruby Conference as well as at Ignite Phoenix IV.

I’ve continued to experiment with game controllers and music generation, but at some point the Wii sort faded into the distance. It occurred to me that I know a fair bit more now than I did then and decided to dig up the old code and give it a whirl.

I had about six or eight local repos of stuff, some for music, some for demos of one kind or another. None of them still ran.

Changes to Ruby, JRuby, and Java broke things in subtle ways. I had updated my JRuby install because I didn’t see much point in having working code that depended on an already outdated JRuby. Likewise for Java. Use the latest, and get stuff working.

A casual endeavor

I’ll admit right now that I did not track all the things I had to change, or the underlying reasons for the changes. I do recall that these JRuby Wii projects were created using an older version of Rawr, and certain config options had changed.

Another cause of trouble was files not being found. I believe this was due to a change in Ruby, where the current folder is no longer on the load path. I ended up having to add in new code in the sample programs to correctly populate $:. I took a pretty casual approach; if some hack seemed to move me in the right direction I just kept it up.

Once I got something to actually run I set out to build a program fresh, and avoid the hacks. I think I mostly succeeded. The problem is that there are a number of moving parts. The examples were all Monkeybars programs, and I had not done anything with Monkeybars in quite a while. A Monkeybars program relies on manifest.rb to load up some key files and, typically, prep the program with fundamental application jars and such. There are opportunities to load this or that depending on OS, load things depending or not the program is run from a jar, and push things onto the Java classpath and Ruby load path. I had reached a point where having a precise understanding of why some particular app-priming set-up worked was not a priority.

Of course, this sounds horrible. What I really wanted to avoid was any variant of yak shaving. I wanted a reasonably simple and clean program that responded to the Wiimote. If something didn’t work and I could trace it to a Rawr or Monkeybars I went to the troublesome code and made adjustments. But if something worked I was happy.

Success, sort of

I had been using two underlying Java libs: WiiUseJ and WiiRemoteJ. According to my slides from 2009 I apparently preferred WiiUseJ, but almost every program I dug up was using WiiRemoteJ, and it was with WiiRenmoteJ that I first got something working again. I took a old Wii program meant to send MIDI messages and updated it to use some more current (J)Ruby gems, and was able to use the Wiimote to play through Renoise. This was on an aging install of Ubuntu; time to try it on Windows 7.

It’s Windows 7 and not Windows 8 because my laptop runs 7 and it works perfectly fine for me. One challenge when writing software is checking that it works on assorted platforms (assuming you intend it play nice on more than one version of one particular OS). Ideally your stuff works on the current versions of whatever your targets are. Having suitable testing machines can be a problem. Virtual machines can help, but for some things (e.g. hardware stuff like the Kinect or Leap Motion) you really need a dedicated device.

Lacking motivation to acquire and maintain such a setup I go with what I got. Bottom line is that I’m writing this for me, so “works for James” is pretty much the goal. (Mind you, when someone pays me to write something for a specific platform I do make sure I have the appropriate testing environment.)

Back in 2009 I was probably using Windows XP, and it was probably 32-bit, and the Wii JRuby code worked fine. 64-bit Windows 7 does not play nice with the WiiRemoteJ Bluecove Bluetooth requirements. I tried to get it working, did some serious Googling for answers, but finally gave up in despair.

I figured maybe WiiUseJ would work better. No such luck. It, too, was unhappy with my Windows Bluetooth arrangement. It’s entirely possible I have a quirky set of drivers or just botched something, but after much frustration I gave up.

Wrapper libs

There were two repos from 2010 for making WiiRenmoteJ and WiiUseJ easier to use from JRuby. Seems they were never quite completed; that has now been corrected. Under the Neurogami account on github you can find WiiRemoteJRuby and WiiUseJRuby. Each contains a simple Monkeybars example program that works for James on Ubuntu 10.10 and 12.10.

An attempt was made to get them to run on OSX Yosemite, but I ran into the issues similar to what I had on Windows 7.

Stuff

Since some minor changes were made to Rawr and Monkeybars, new gems were released.

The next step is to finish up a more interesting Wii MIDI program for use with Renoise and probably revisit getting one or the other Wii libraries to work on OSX and Windows 7. Another likely path to explore is finding any other Wiimote applications that I can get running on ether Win7 or Yosemite and sort out what makes them special.

My Music

Loosies


American Electronic


Small Guitar Pieces

Maximum R&D



Love me on Tidal!!111!

Neurogami: Dance Noise


Neurogami: Maximum R&D