Playing Synthesizers with a Teensy Controlled Game on a LaunchPad

Updated 16 March 2022

I am an amateur musician, coder, and electronics maker. When I found out that the Novation Launchpad (mine is a mini MK3) can be programmed, I was excited about creating unique music. The idea is to use the Launchpad to play a game and use the game to generate notes for the synthesisers to play. In this version, you can play Naughts and Crosses (Tic Tac Toe). The Teensy sends a predetermined sequence and altered notes, which vary as you play the game, to the synths.

To make this device I had to “nerd out” on MIDI commands and connections. I had so much fun I ended up making many synth playing games with the same hardware. You can check all of them in my playlist on YouTube.

Step 1: Determine the connections to the Teensy 4.1.

  • USB Host Mode: The Teensy needs to be used in USB Host Mode to control, power and respond to the Launchpad via MIDI. Luckily this means that by powering the Teensy via a USB wall wart the Launchpad is also powered. In the following diagram you can see the pins to use for USB Host mode. Watch out! Not all Teensys can be used in host mode.
  • Toggle Switches: I used pins 33 to 37 for these.
  • 5 pin MIDI out: I used TX1 and TX2 to send MIDI over serial to external synths. I am thinking I should add another of these to control more. The Teensy 4.1 has 8 Serial outs!

Teensy pinout and used pins

Step 2: Hardware.

Here are the parts needed to make it:

I also used a proto-board to make the connections but this isn’t necessary. My Teensy had headers on it already, so the Protoboard was the easiest option for me.

Step 3: Wiring:

This project doesn’t have much in the way of wiring, it is mostly coding.

The USB HOST mode is connected using a USB cable.

The Teensy uses this USB cable to power the Launchpad and to communicate with it.

You will need to solder header pins to the Teensy so the cable can be connected like this:

USB Host connected to Teensy

Switches: These are connected in the standard way. One side to a GIO pin the other to ground. As stated above I used pins 33 to 37.

MIDI connections: MIDI is a standard based on the amount of current rather than voltage.  Standard MIDI uses 5V, however the Teensy 4.1 uses 3.3V so different resistors are needed to increase the current. You can find these details at midi.org 

Looking at the back of each MIDI socket, connect TX1 and TX2 according to the following.

MIDI pin descriptions

Step 4: Putting it all together:

Mount the switches, MIDI DIN connectors, and USB connectors where you want. I mounted mine in these positions:

Toggle switch setup

USB Host input

teensys usb cable

Here’s a picture of the insides (If I knew it was going to be shared I might have been neater)...

Inside of the enclosure

Here's how all parts of the systems interact:

Overall system diagram of the tic tac toe game

Step 5: Coding

The most complicated part of this project is the coding. Essentially, the Launchpad works as a screen and a keyboard for the Teensy. The Teensy sends MIDI messages to and receives MIDI from the Launchpad via USB to do this. It also sends MIDI clock (for timing) and MIDI notes to external synths via the MIDI DIN connections.

The full code with comments is available on my GitHub repo (Tic-Tac-Toe-Launchpad-Note-Generator)

You will need to install Teensyduino from PJRC's website

There are other ways of programming a Teensy but Teensyduino is the recommended IDE and I prefer it.

The Launchpad needs to be in programmer mode to use it with the Teensy. Long press the “Session” pad and then press the following sequentially: “stop/start/mute”, “Session” and finally “User”. You can find a manual for programmer mode on the Novation Web Site and many other “manuals” websites.

 

Sending MIDI to the Launchpad: To change the colour of a pad you send a “note on” value and a velocity via a MIDI channel.

  • Note Value = Which Pad to light
  • Note Velocity = What colour to use
  • MIDI channel = how the pad is displayed (e.g. static or flashing)

Colour pallet used on the Launchpad

Receiving MIDI from the Launchpad: The main 8x8 grid sends MIDI notes to the Teensy to indicate which pad has been pressed. The black function pads send MIDI CC messages, hence the code has different functions to respond to these two types of messages.

The launchpads pixel addresses

I use XY grids to organise the game, hence my code includes functions to translate between MIDI notes and grid positions. In the code pad, 36 is designated (1,1) on my xy grid. Pad 99 is the Novation Logo which lights up but is not a pad.

I use the Launchpad upside down to these diagrams so I don’t cover it with my hands when using the function pads.

The base board for the game

The four arrow pads at the bottom are used to do the following:

Left Arrow: speedup the sequence by reducing the wait time by 100ms

Right Arrow: slowdown the sequence by increasing the wait time by 100ms

Up Arrow: Clear the Naughts and Crosses grid (New game)

Down Arrow: Reset the sequence offsets to zero.

Essentially, the program works by repeatedly playing notes on external synths. The notes are in a sequence that is stored in an array that corresponds to the key C minor. As the game is played extra note offsets are generated based on the position of the naughts and crosses. These differ for naughts and crosses. One synth plates the entire altered synth. The second synth only plays the altered notes. There is a pseudo-randomness to the music created depending on how the game is played, which I find enjoyable and I hope you do too.

Example game

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.

Comments


Loading...
Feedback

Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.