Joysticks

Figure 2: A typical gaming joystick.
Image joystick

Anyone who has played a video game is familiar with a joystick. Joysticks come in a wide variety of shapes, sizes and forms. Joysticks can have between 7 and 10 bit resolution, and anywhere from a 25Hz to 250Hz sampling rate depending on the hardware and the drivers. The basic analog joystick is inexpensive and leaves a lot to be desired as a musical controller. Modern gaming devices are of much higher quality and are better suited to musical applications. A joystick provides two or three absolute axes of measure per hand. Since a joystick's position data is absolute, the position of the joystick can be tightly mapped to different control parameters. For example, StickMusic[] uses the axes of a joystick to control the timbre, therefore the timbre will be the same given the same position of the joystick.

There are two objects available in Pd for using joysticks: Joseph Sarlo's [joystick] [Sarlo()] and Hans-Christoph Steiner's [linuxevent] [Steiner(b)]. [joystick]'s outlets are dynamically created, providing an easy way to access all of the axe s a given joystick has. But it has the disadvantage of having different numbers of outlets with different joysticks, making it harder for a given Pd patch to work with multiple joysticks. [linuxevent] provides access to all supported buttons, hat switches, and axes through a fixed number of outlets. This data is provided out of 4 outlets: time, the timestamp of the data; type, the type of data, i.e. axis, button, etc.; code, the specific instance of the type, i.e. X-axis, trigger button; and value, the data for that specific instance. When using [linuxevent], the value data will need to be routed based on the type and the code

[linuxjoystick] is a simplified object based on [linuxevent]. It has a fixed amount of outlets, so that your patch doesn't need to change with different joysticks, with the disadvantage being that this object doesn't support axes beyond X, Y, twist, throttle, and 1 hat switch. You can make a custom object for your joystick using an abstraction based on [linuxevent] (see the Pd help patch for an example).

Hans-Christoph Steiner 2005-04-25