In the spirit of MIT hacking culture, allow us to present: Twitch Plays Glockenspiel!

Recently-graduated MIT CS students Zachary Neely and I put together this hack for our final project as part of MIT’s 6.S08 Interconnected Embedded Systems class. The rig lived a short but sweet life until I deconstructed it prior to my journey to SF. Check out our code.

Overview

Twitch Plays Glockenspiel, a month-long project in the style of Twitch Plays Pokemon, centers around a Twitch channel where viewers enter musical commands in the form of notes and chords. The automatic glockenspiel player then plays received commands as requested, streamed live to the same Twitch channel.

Viewers can send individual notes or chords via our channel’s Twitch chat, or use the provided Python script to send a series of time-separated commands to the channel. The demo video above plays through a few hard-coded fan-favorites.

Check out the decommissioned channel here.

Technical description

Software

Since Twitch chat exposes an IRC-like API, we programmed a Teensy microcontroller to poll the IRC channel for commands via an ESP8266 wifi chip.

Command parsing occurs in the Teensy using custom code, then sends around 10 millisecond pulses to appropriate output pins.

Hardware

We used five 3-to-8 decoders to create an effective 5-to-32 decoder, allowing us control of all 25 glockenspiel keys using the Teensy’s limited number of output pins. From the decoder, 25 of the 32 outputs each route to a transistor. When activated, the transistor allows power to flow from a variable power supply to a 5V solenoid, actuating an individual key.

Each pulse lasts around 10 milliseconds, and chords are actuated one note at a time (e.g. a chord with three notes would take 30 milliseconds to actuate).

See our initial design plans for a more in-depth design document.

Post-demo shot of the glockenspiel-player rig

Future

Although our hardware rig has been deconstructed to parts, we did take a few learnings forward. First, Twitch’s IRC channels are actually pretty nice, and the combination of a free-to-use IRC channel along with video streaming service makes for some nice quick-fix message passing infrastructure for personal projects. Can’t recommend it as a best practice, but it was fun.

Second, building physical things is hard. It took us almost as much time assembling the solenoid rig and connecting power circuits as it did writing code and designing control circuits. But that probably also has to do with us being CS majors rather than EE or MechE.

Overall, had a great experience, and highly recommend MIT students take 6.S08 (now 6.08).