06
Nov
13

Notes on game controllers

I decided to write this post just to tie together some of my experiences of using game controllers of various sorts to make music.

Generic USB controllers like these are generally pretty easy to use:

Game Controller 3

StyloSim6sm

Since computers come with USB ports on them, it’s usually just a case of plug them in and get going.  There are lots of them about and they can be picked up cheaply on eBay and Gumtree or from local charity shops.

The main consideration is what program to use which can interpret the signals the controller is sending out and allow you to use those signals for your own purposes.  There are many of these, ranging from simple apps to tweak the operation of a particular device, to large and complex  programs designed to customise a device’s every action to the user’s requirements.

This is made possible by the existence of the ‘HID’ standard for USB devices.  HID = ‘Human Interface Device’, a description which can be used to cover devices such as computer keyboards, mice, game controllers, joysticks, and the like – all the things which humans use to interact with computers.  As long as the device is made to conform to the standard – and manufacturers have readily got used to the idea of doing so – these programs can interpret the input and make it available to be changed to a different input; to perform an action completely unrelated to the device’s original purpose; or send data to another program which can use it creatively.

I’ve used several of these for different purposes.  There’s Multicontrol, which I used for this MIDI Drum controller:

MultiControlDrums1

Multicontrol has the ability to interpret the game controller’s signals and pass them on in the form of MIDI messages, or OSC (Open Sound Control).  Designed by Alexander Refsum Jensenius, it’s distributed free for Mac OS.  There is a source file downloadable from the site referenced above, although I have no idea if this can be compiled for Windows PC’s.

I’ve also used a commercial program, ControllerMate, which enables very sophisticated interpretation of controller signals.  This allows not only for simple button ‘mapping’, where you specify, for example, keystrokes for each controller button, but also, with this window you can build up complicated series of events, initiated by a button press.:

ControllerMate window

The small drop-down list to the right indicates the wide variety of actions that can be incorporated into the instructions for each button or other control.

The list in the left-hand column indicates a couple of devices which I’ve made customised groups of special controls for: once you’ve set the controls up, you can save them and call them up by name.  It’s possible in this way to have several different set-ups for the same device, depending on what you want to use it for at different times.

*

My favourite program is PureData, or Pd for short.  Using Pd means you have to write the programs yourself – but this is done graphically, rather in the manner of flow-charts, rather than by writing lines of code, and the program is specifically designed for making music, so it has typical audio and MIDI functions (Pd calls them ‘objects’) ready to use.

I’ve used Pd both for creating instruments, like the Theresynth, which uses the PCLine Rumble Pad pictured above, and for sound and sample manipulation.  The blog post for the Theresynth (which uses one of the joysticks on the controller for changing pitch in a way reminiscent of a theremin), also has quite a detailed description of the Pd programming.  I’ve also blogged about various sound manipulation apps (or ‘patches’) in the past, including the StyloSim, which uses the joystick controller pictured above, and the Black Widow.

The StyloSim patch isn’t very extensive, and looks like this:

StyloSim2

The small box with ‘hid’ in it, near the top right-hand corner, is the Pd object which recognises input in the HID standard; the ‘route’ objects below split up the different inputs, and then you can send them off to do whatever you need them to do – control oscillators or filters, perform mathematical functions, create MIDI messages, and so on.

While on the subject of software, a handy piece of freeware which I often use is Joystick and Gamepad Tester from AlphaOmega Software.  AlphaOmega produce a number of simple but ingenious apps which help you with your Mac, including an app which cuts out that annoying ‘chime’ when the computer opens (my car doesn’t sing at me when I turn the ignition, my hi-fi stays silent until I put in a CD, my TV remains mute until I select a channel – why on earth do computer manufacturers think we want to hear the machine start up!  One of life’s unexplained mysteries . . .), but also some apps which can have a value in computer music.  I may well have blogged about some others elsewhere.

The purpose of Joystick and Gamepad Tester is to tell you what controls your USB device has, and if they are devices like joysticks, what are the minimum and maximum readings you can get from them: 0 – 127, 127 – 255, etc.

I recently bought a game controller like this from a charity shop:

Logitech Buzz

It looked as if it was originally part of a quiz game, and had a USB connector, so it looked as if it would be easy to use with the computer.

I took it home, plugged it in and started up Joystick and Gamepad Tester.

JAGT 1

The instructions say to press all the buttons and move joysticks and other controls so they’re recognised. but when I clicked ‘OK’ on the screen above, I saw this:

JAGT 2

I found out first of all what the device was – a ‘Logitech Buzz Controller V1’ – and was able to select it from the drop down list.  Note by the way that all the normal USB-connected devices are also listed: in my case, there’s the laptop keyboard, the infrared receiver on the front and the trackpad.

The Apple IR Remote – listed in the screenshot above as ‘IR Receiver’ – isn’t exactly a game controller, and isn’t exactly an HID device like the others discussed here, but it’s worth a brief digression as its uses are very much the same.

As far as  Joystick and Gamepad Tester is concerned, nothing was listed when I selected ‘IR Receiver’ or registered when I pressed buttons on any of my Apple remotes – only when I selected one of the two entries ‘IOSPIRIT IR Receiver Emulation’.  I don’t know why there are two entries, but they’re identical and are the result of installing either the app Remote Buddy, or its free driver Candelair – or very probably both – as I’ve been working on using Apple Remotes recently (see blogposts, starting here).

A useful feature of  Joystick and Gamepad Tester in this respect was that it showed the remote’s individual ID No. in the ‘Now’ column.  (The ID numbers in the ‘Min’ and ‘Max’ columns are irrelevant, as they will just show the highest and lowest Remote ID numbers used in the past).  Just picking up a remote and pressing a button will change the now column to verify the number.

When I selected ‘Logitech Buzz Controller V1’, all the controls were already listed:

JAGT 3

There are 5 buttons on each of the controls, and the list suggests that they are unique – that’s quite a decent number of buttons for a game controller, so that could be handy in some situations.  Buttons usually show up with a minimum and maximum of ‘0’, so it was quite interesting see that 4 of them with a different reading in ‘Max’: perhaps these were the big red buttons, one on each handset?

Actually, there weren’t: as you go round the buttons pressing them, you can see exactly which is which – the value appears in the ‘Now’ column: ‘1’ for pressed, ‘0’ for not pressed, which is typical for buttons, so by the time you’ve finished, they all have ‘0’ in the ‘Min’ column and ‘1’ in the ‘Max’ column.  If you’re intending to modify the controller you’re testing by taking it out of its case and fixing new buttons to it, this is very useful because you can make a note at this point of which one is which.

Better still, if you click the ‘Save’ button – indicated by the arrow on the screenshot above – you can save the list as a text file, print it out and make your notes on that.

First you’re given the usual ‘Save’ options:

JAGT 4

Then  Joystick and Gamepad Tester confirms that the text file has been saved and it’s safe to quit or begin testing another device.

JAGT 5

I was impatient and clicked ‘Save’ before testing all the buttons, so the text file shows an incomplete test – I haven’t verified yet that each of the buttons gives a maximum ‘1’ when pressed and goes back to a minimum ‘0’ when released.

JAGT 6

I was intrigued by the two entries at the bottom for ‘X-Axis’ and ‘Y-Axis’.  I studied the device carefully, and could find no control on it which resembled a joystick, which is what an entry like this would be for: data from these sources wouldn’t just be a ‘0’ or ‘1’, but a number moving from perhaps as low as -255 to +255.  I’m assuming this indicated that the chip used in the device is capable of supporting a joystick, but this hasn’t been implemented.  Perhaps, if one knew how, one could hack the PCB which controls the buttons and add this capability.

*

There are two things worth mentioning about HID devices at this point.  The first is that, provided you leave the USB output leads intact, you can remove the circuit board from the original case, solder your own buttons and potentiometers to it and it will still be recognised as the same device by the computer.  This was the theory tested by the Cybersynth, which is basically a Theresynth, as described above, with the PCB removed from the Rumble Pad and put into a completely different case.  It doesn’t look like it any more, but the computer still thinks it’s a game controller.

Cybersynthsm

In fact, you can also do this with an old computer keyboard.  It’s possible to remove the PCB from these, work out which connections make which letters and wire these connections to your own buttons or switches.  I did this with the board from inside an old Apple keyboard (as described here):

Blueberry keyboardsm

It was very cheap, having been scrapped as being broken, but what was wrong with it was nothing to do with the electronics.  I took the board out, rewired it, and use it for controlling a looping program.

MIDI CPU insidesm

You may be able to tell from this picture – although the scale isn’t particularly evident – that the PCB inside this particular brand of keyboard is ridiculously large.  You could undoubtedly find a make with a much smaller board which would be more practical.

As it happens, I’m using this particular board for an application which requires letters as an input, and no remapping – i.e. ‘A’ is ‘A’, ‘B’ is ‘B’ and so on.  However, since the keyboard is an HID device, using one of the programs above, you could change the functions of the buttons and have a very large number of different control buttons available: the equivalent of 26 letters, 10 numbers, numerous punctuation keys; and programs will normally distinguish between lower and upper case letters, increasing the total number of controls even further.

The second thing to mention is that there are many PCBs on the market with circuitry on them to output HID standard signals, and allowing you to attach your own combinations of buttons, switches, knobs and joysticks.  People who make their own arcade games like them, so this is where you’re likely to come across them (on sites like this, for example).

Some of these are relatively inexpensive.  I got this one, which can encode 12 buttons and 2 joysticks for £8.00, complete with connecting leads for the buttons, joysticks and USB:

Zero Delay Encoder Board Rev2 -2

You have a free choice of what kind of buttons to attach, and using a board like this is easier than extracting and rewiring an existing game controller board

*

As for other types of controller: there are many.  This one by Nyko for Playstation – which I have in the collection, but haven’t worked on yet – combines the traditional game controller with a QWERTY keyboard:

Nyko IMG_1668

This one, the Airpad, is interesting because it contains a tilt mechanism which enables control by tipping the device up:

Airpad IMG_1667

You may notice something odd about the above two controllers – the funny connectors on the end.  Your computer probably doesn’t have sockets that shape.  This is no problem, though, as Playstation to USB adapters are easy to come by and not expensive.  This one cost less than £2:

PS Adapter IMG_1669

It’s also possible to find extenders and hubs for Playstation devices, and these don’t usually cost much second-hand on eBay:

Extension IMG_1255

Hub IMG_1561

Using PS3 (wireless) controllers is also perfectly possible.  There are drivers for Windows; later versions of Mac OS (from 10.6 upwards, I believe: see here for further details) have drivers built in, using Bluetooth.  Earlier versions of the Mac OS can work with a driver from Tattiebogle.

USB adapters also exist for XBox controllers, although replacing the proprietory connector with a USB plug doesn’t seem difficult,  according to this illustrated article.

[Edit: unfortunately, both the sites I used for this information are unavailable now.  I’ve left the link in case that site’s unavailability is temporary, and I have an image from the other one:

xboxcablemodpaintThis implies that the Xbox cables have wires using the standard USB colour-coding, so if the wire attached to your USB plug uses these standard colours, they can simply be attached like-for-like].

Once again, Tattiebogle provides a driver for wireless XBox controllers – although you’ll also need one of these wireless receivers:

wireless receiver2

Third-party receivers can cost as little as £5.

At the time of writing, the most advanced consumer-oriented controllers are the Nintendo wii and Microsoft’s Kinect.  The wiimote controller is a hand-held device which uses accelerometers and infrared to detect position and motion in addition to control by button-presses; Kinect uses infrared, cameras and microphone to detect spoken commands as well as hand and body positions from a distance.  I’ll be looking at musical uses of these two systems in the next post in this series.

Advertisements

7 Responses to “Notes on game controllers”


  1. November 24, 2013 at 8:47 am

    Hi Andy,
    I am about to retire and will have much more time to devote to programming my Midi Integrator general-purpose any-pc-input to any-instrument software that you kindly mentioned a few months back.
    Are there any features that you would like it to have? I am adding some displays, so I can show people what I am playing, for example.
    Ken

    • November 28, 2013 at 9:58 am

      Ken,

      This is good news! I was delighted to find MIDI Integrator, as it did exactly what I wanted, which was to use a QWERTY keyboard as a MIDI input device, with the ability to reconfigure the keys to various layouts (Janko, Wicki-Hayden, etc.). I’ve just re-read the manual, and it’s surprisingly powerful, but I’ll have a go with it over the weekend and see if there’s anything I can think of!

      Best wishes for a productive retirement!

      Andy

  2. April 19, 2014 at 7:07 pm

    I spent some time on controller utilities many years ago.I used a ps2 controller & a Rockfire usb adaptor on windows Xp… I was deejaying , playing drums & creating effects chains for guitar & remixes…

    The most reliable & simplistic quickstart tools ive auditioned for live use were .

    Virtuasonic Mijoy Pro …. It’s a vst instrument which can swiftly convert multiple gamepad functions into midi.No virtual midi cables are required. It also does cc .. Mijoy pro Is windows only but you can use a device ( wrapper ) if your on another platform. Or disregard the daw & use free standalone software ( Audiostrom LiveProfessor ) which hosts vst’s for live work.

    Paul Dean aka Aquawicket created E drum monitor ( freeware ) which evolved into E trigger. It was created for electronic drums but can accommodate Game pads & qwerty keyboards.. The interface was based on a mixer channel with vu meters , faders & dials to calibrate everything in detail.

    Glovepie & scripts was also popular utility but i believe it’s discontinued.

  3. 5 Hicham
    December 16, 2015 at 2:59 pm

    Hello Andy my name is Hicham, i am interrested in converting a gamepad to a midi controler, but i want to trigger the notes like a trupet player would do with valves. is it possible to program this sort of playing midi notes on these gamepads? can i have 3 buttons that, pressed at the same time give a note, 2 butoons give an other note etc,… thanx a lot for your help. I like very much your projects, very creative and open a whole lot of possibilities

    • December 22, 2015 at 8:13 pm

      Hicham, I don’t think you can use a game controller this way, as they’re normally designed for one button to be pressed at a time. You might be able to do it by hacking a controller. The hatswitch buttons, in particular, can be redesigned to give different outputs if two buttons are pressed at once. There’s a description of how I did this here: https://andymurkin.wordpress.com/2015/03/13/guitar-fxbox-part-2-the-hardware/.

    • 7 Element
      December 28, 2015 at 3:25 pm

      It’s possible to use one or more game controllers as a polyphonic midi triggering device. But there may be some artistic disadvantages . You can confirm if your gamepad has simultaneous outputs by testing & calibrating your controller within the control panel on your computer.

      See my previous post from 2014 for sources.

      Do a search for… ” glovepie gamepad to midi ” or ” Fergo JoystickMIDI ” for a pc solution to your question.
      Do a search on …” keyboard ghosting ” for further information on qwerty to midi input in music software.

      Expanding & responding to your questions.

      A trumpet cannot play chords so I would not focus on the actual instrument as you are simply triggering midi notes. The setup , software , workspace & results is far more important.

      A typical gamepad has 12 buttons so you should really aim to optimise the use of those 12 buttons with macros & key bindings ( 2 or 3 buttons per note is very wasteful… The directional pads & potentiometers should be expoited & used to control additional features in the software to expand the range & palette.

      Eg. Select instrument , scroll the musical scale , sustain pedal.

      Artistic disadvantages & technical issues.

      Many brands of music software also have a qwerty keyboard input to trigger the sounds. This may be a quick option for a casual user to investigate before they consider using gamepads As many gamepads do not have pressure sensitive buttons or the os software doesnt recognise it. So your triggered sounds may not have any velocity and will eventually sound boring & lifeless if they have no dynamics.So you may need to edit the performance afterwards.

      Sidenotes.

      I’m a casual gamer & use a dualshock wired ps2 gamepad & a usb adaptor on my windows pc for everything. certain moves & holds in emulated console games like Tekken 6 & Dead or Alive 5 require more than one button to be pressed or held but they may be buffered. And undetectable in a gaming scenario. But very noticeable in music creation.

      There was a budget 8 piece electronic drumkit named the Ion ied05. Which was basically simulating 2 gamepads in an adaptable box. The kick drum & hi hat pedal utilised the normally open switching. And the piezo transducers utilised the x / y axis of the potentiometers. It had no midi capabilities but many solutions were found to enable midi. The glovepie scripts or etrigger kit files can be found all over the net & slightly modified to accommodate multiple gamepads on pc.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


andymurkin

November 2013
M T W T F S S
« Oct   Dec »
 123
45678910
11121314151617
18192021222324
252627282930  

Enter your email address to follow this blog and receive notifications of new posts by email.


%d bloggers like this: