Skip to content

Tutorial: Myo Wekinator PD

Jonathan Wohl edited this page Jun 6, 2016 · 3 revisions

Myo -> Wekinator -> PD

Overview

In this example we'll create a simple controller using Wekinator, trained on orientation data from the Myo. We'll use the output to control an FM synth in PureData (PD).

Before starting, make sure you have your Myo set up and synced, and that the Myo Connect app is running.

If you haven't already, install Wekinator and PD. Also download the PD patch we'll be controlling:

PureData FM Synthesis

Install myow

Install myow globally via npm:

$ npm install -g myow

Start myow

We're going to be using orientation data from the Myo, so let's start listening for this data and translating it to OSC messages for Wekinator:

$ myow -l orientation

The -l flag indicates that we want to log the OSC messages being sent. You should see output in the terminal which looks like this:

myow-output

Set up Wekinator

Open up Wekinator. The orientation data is represented as a quaternion, so we'll have four input values. The PD patch we'll use expects three values, so we'll need three outputs from Wekinator.

wekinator-setup

We can leave the rest of the default settings. Press next.

Train!

Record Position A

To keep things simple, we'll train the three output models with the same data. Choose two arm positions that you'd like to transition between. Place your arm in the first position, and press the Start Recording button. You should see the number of examples rising. After a few moments, press Stop Recording.

Record first position

Record Position B

Now we'll adjust the three sliders on the outputs all the way to the right, to value 1. Move your arm to the second position, and record another few moments.

Record second position

Train and Run!

We have our data recorded, so we can press Train.

Alright! Now if you press Run, you should see the sliders moving between 0 and 1 as you move your arm between the two positions.

Run

Connect to PureData

Open up the patch we downloaded earlier. It's set up to listen for the OSC messages from Wekinator and use them to control a simple FM synth. If myow and Wekinator are still running, you should see your arm movement affecting some values in the patch. You can enable DSP and slowly bring up the volume slider at the bottom of the patch... sound should ensue.

That's it!

There you go. Play around, try training on different data streams from the Myo. My initial interest was in the EMG data, though this data stream seems to be the noisiest, and hasn't yet produced any valuable results. Let me know if you come up with anything interesting!