Example code

Quick Start Pack

This contains a small number of very useful executable examples for inputs, outputs, and teaching.

Download All Source

Want to jump right in and start with the source code? If so, you can download the very latest source for all examples from github.

Pick & Choose: Inputs

Arduino

Audio

BBC micro:bit

  • Step 1. Download this file and save it on your microbit (e.g., in Mac Finder or Windows Explorer). It should be the only file on your microbit.
  • Step 2. Download the desired version of your desktop software below:
  • Step 3. Plug in your micro:bit to your computer via USB, run the desktop software you just downloaded, and change the device ID in the top dropdown box until you see the accelerometer numbers changing.
  • Step 4. In the same program, choose which input types you want to send to Wekinator using the bottom dropdown box, and look at the screen to see how many inputs you have total. Tell Wekinator to listen for this many inputs.

Bitalino (biosignals)

  • Coming soon

GameTrak “Real World Golf” tether (game controller)

iOS / iPhone / iPad

  • Louis McCallum has made the free MotionSender app to send accelerometer, gyroscope, and attitude data to Wekinator.
  • You might also check out the TouchOSC app, which is more complex to set up but allows you to use other controls (e.g., touch buttons)

Java

Leap Motion (hardware sensor)

Logitech Extreme 3D Pro Joystick

Max/MSP (audio)

Microsoft Kinect (3D body tracking/game controller)

Myo Armband (EMG/muscle sensing and movement)

  • You can use the Myo Mapper software to connect Myo to Wekinator. You’ll first have to install the Myo Connect software and connect your Myo to your computer.
  • Alternatively, you can use myo for max within Max/MSP
  • Or you can use this JS command-line tool by Jonathan Wohl

openFrameworks (C++, animation)

PureData (PD) (audio)

Processing (animation, screen-based input)

Python

TouchOSC for mobile devices and tablets (iOS, Android):

Video/Webcam

  • Simple 10×10 color grid (not useful for much)
  • Track the x,y position of a coloured object using your webcam
  • Face Tracking (Processing version; tracks the x- and y- position and width of one face)
  • Face Tracking (openFrameworks version; tracks the x- and y- position and width of one face)
    • Source code in openFrameworks
    • Mac executable Note: If this doesn’t put sunglasses on your face when you run it, drag the app to a new location (e.g., your desktop) then back. Make sure the app and the data/ directory share the same parent directory. Run it again. (This is due to a peculiarity in security settings on OS X 10.12 and higher.)
  • More detailed facial feature tracking (e.g., for facial expressions), with openFrameworks
  • Face tracking on iOS (thanks Scott Hawley!)
  • Deep learning features for training object recognisers (e.g., hand versus cup versus shoe): more sophisticated, but very slow. See README for information about how to run it.

Wacom / Graphics tablet stylus

WebSockets (for desktop & mobile via browser apps)

WiiMote (game controller)

word2vec

  • This python script allows you to type English words on the command line. A feature vector capturing information about the linguistic context of the word (roughly related to its semantic and syntactic function) is sent to Wekinator. This feature extractor uses the word2vec word embedding using the glove-twitter-25 dataset (which is pre-trained and downloaded automatically by the python script).

XBox 360 and similar USB gamepads

Pick & Choose: Outputs

AbletonLive (audio)

ChucK (audio)

IFTTT (“if this then that”)

Max/MSP (audio)

MIDI

openFrameworks (C++, animation)

  • Simple 3D squirrel rotation
    • Source code
    • Mac executable Note: If you don’t see the squirrel when you run it, drag the app to a new location (e.g., your desktop) then back. Make sure the app and the data/ directory share the same parent directory. Run it again. (This is due to a peculiarity in security settings on OS X 10.12 and higher.)

PureData (PD) (audio)

Processing (animation + audio)

Unity (game engine)

Teaching Examples

Classification Explorer

Regression Explorer

DTW Mouse Explorer

OSC Data Plotter

Plots data received by OSC in real-time. Good for inspecting features and/or Wekinator output.