Myo SDK – 0.9.0
The Myo SDK

Getting To Know The SDK

Contents of the SDK

The SDK is divided into the following directories:

  • bin/ contains binary executables included in the SDK
    • on Windows, this contains the DLLs required to use the SDK
  • docs/ contains this documentation
  • drivers/ (Windows only) contains components that need to be installed to use the SDK
    • On Windows, this includes drivers for the Bluetooth dongle bundled with Myo
  • include/ (Windows only) contains C/C++ header files
  • lib/ (Windows only) contains link-time libraries
    • on Windows, this contains the LIB files required to link with the SDK
  • samples/ contains sample programs using the SDK

Additionally, the root directory of the SDK contains:

  • myo.framework (Mac OS X only), which includes the headers and libraries needed to use the SDK
  • MyoUnity.unitypackage, a Unity package that provides support for the Myo armband on Mac OS X and Windows

The libmyo Library

At the core of the Myo SDK is a library, libmyo. This library allows applications to interact with the Myo armband. All functionality in libmyo is exposed through a plain C API.

Typically, applications do not interact with the libmyo C API directly. Instead, they use a language binding corresponding to the programming language used by the application. For example, the C++ bindings in Myo SDK provide convenient access to libmyo through a familiar C++ interface.

The following diagram illustrates the Myo development stack from an application using the SDK down to a physical Myo device:


Core SDK Concepts

In addition to the concepts explained in A Developer's View Of The Myo Armband relating to the Myo armband itself, the SDK exposes a few other concepts detailed here.

The Hub

The entry point into the SDK is the hub. A hub simply provides a way to connect to one or more Myo armbands. On a PC or Mac computer, the Myo Connect application acts as the central hub allowing multiple applications to connect to one or more Myo armbands and taking care of things like pairing and global user preferences.


The SDK provides data to the application in the form of events. There are three categories of events: spatial events (corresponding to spatial data from a Myo armband), gestural events (corresponding to gestural data a Myo armband) and auxiliary events.

Generally, spatial events occur regularly at some fixed rate, whereas gestural events occur irregularly. For example, a pose event will occur whenever the Myo armband has detected that the wearer has changed their hand's configuration to one of the detected poses. An orientation event, on the other hand, will occur regularly at the rate at which the Myo armband updates its internal measurement of the orientation.

Auxiliary events typically occur infrequently and correspond to situations such as the Myo armband becoming disconnected or connected. While the SDK will generally maintain a connection with the Myo armband once it is established, it will inform the application when the Myo armband is disconnected. This might happen, for example, when the Myo armband is moved out of range of the device it has been connected to.

All types of events identify the Myo armband from which they occurred and provide a timestamp at which the event was received by the SDK.

The C++ Bindings

The C++ bindings are provided as a set of header files in the include/ directory of the SDK. The only header you need to include to use the bindings is <myo/myo.hpp>.

All types provided by the C++ bindings are located in the myo namespace.

SDK concepts map to C++ constructs in the C++ bindings. Specifically:

  • The hub is represented by the myo::Hub class, which the application instantiates to use the SDK.
  • The Myo armband is represented by the myo::Myo class.
  • Poses are represented by the myo::Pose class.
  • Orientations are represented as myo::Quaternion objects, and three-dimensional vectors (such as the acceleration vector) are represented by the myo::Vector3 class.

In the C++ bindings, events are received by application classes that inherit from myo::DeviceListener and are registered with the hub using myo::Hub::addListener(). In order to receive events, the application must call myo::Hub::run(), which will notify registered device listeners of any events that occur. An application might call myo::Hub::run() from its existing event loop (e.g. once per frame in a game) or it might spawn a dedicated thread to call myo::Hub::run() for the lifetime of the application.

To get started with the C++ bindings, compile and run the hello-myo.cpp sample in the samples/ directory. Project files are provided in the directory to help you get started quickly.

Building Applications With The Myo SDK

The SDK is designed to be straightforward to use from your own applications. This section describes the settings you will need to apply when compiling an application using the Myo SDK.

Building The Samples

Each of the samples found in the samples/ directory of the SDK includes project files that can be used to build the sample and run it. If you like, you can use one of these project files as a starting point for building a new application that uses the Myo SDK.

Building C++ Applications With The Myo SDK

Building Apps on Windows

The following tables provides the settings required to use the Myo SDK in C++ applications built using Microsoft Visual Studio:

Visual Studio Setting Visual C++ Compiler Flag Value
C/C++: Additional Include Directories /I include directory of SDK
Linker: General: Additional Library Directories /LIBPATH: lib directory of SDK
Linker: Input: Additional Dependencies List each file For 64-bit build: myo64.lib
For 32-bit build: myo32.lib

At runtime, your application will require the myo64.dll dynamically-linked library for a 64-bit build, or myo32.dll for a 32-bit build. An easy way to include the required DLL is to copy it from the SDK bin/ directory using a post-build event in Visual Studio. Have a look at the hello-myo sample project for an example of how to do this.

The Myo SDK does not place any special requirements on your application in terms of the application's runtime library or debugging settings.

Building Apps on Mac OS X

On Mac OS X, the Myo SDK libraries are provided as a framework, myo.framework. This framework contains all the necessary libraries and headers to use the SDK.


To use myo.framework in an Xcode project, follow these steps:

For a typical Cocoa Application

1) Drag myo.framework into the Frameworks group in your project.

2) In Build Settings, add @loader_path/../Frameworks to "Runpath Search Paths".


3) Add a "Copy Files" Build Phase. Select "Frameworks" as the destination, and add myo.framework to the list.


For a typical Command Line Tool

1) Drag myo.framework into the Frameworks group in your project.

2) In Build Settings, add @loader_path to "Runpath Search Paths".


3) Add a "Copy Files" Build Phase. Select "Products Directory" as the destination, and add myo.framework to the list.



To link with myo.framework when using Xcode's command line tools, pass the following options:

-F/path/to/myo/sdk -framework myo

The install name for myo.framework's libraries is set up so that it will be found at runtime if the framework is located in one of the directories on an application's runtime search path or rpath.

For example, if a copy of myo.framework is going to be in the same directory as the program or library you are linking, you would pass the following as a linker option:

-rpath @loader_path

The OS X dynamic loader will replace @loader_path with the location of your program or library at runtime, so the framework will be found there.

If myo.framework will be located at a specific absolute path at runtime, you would instead pass the following linker option:

-rpath /path/where/myo/framework/lives