Stegoaurus is an open-source MIDI controller. The controller is built around the Arduino framework and uses the MIDI protocol to communicate with a computer. It is designed to be easily configurable, with the ability to change the behavior of the controller using SysEx messages.
TODO:
- Add hardware MIDI support to the Pico
- Add SysEx support to the Pico
- Web interface for programming
- Basic interaction
- Add SysEx messages
- EEPROM module
- Pinouts
THis project is organized as follows:
firmware/
: main firmware codeinterface/
: code for the web interface
This project runs on the Raspberry Pi Pico. To set it up in the Arduino IDE, follow this guide. You will probably have to hold down the BOOTSEL button while plugging in the Pico to get it into bootloader mode for the first time. Pay attention to these upload settings:
Make sure the selected port matches the port that the Pico is connected to.
Required libraries:
- EasyButton (@v2.0.3)
- Adafruit TinyUSB (@v3.1.4)
This will have to use WebMIDI to communicate with the Arduino.
A good first step for this is to get a list of MIDI devices. I want to do this in React.
See this page for a good reference on MIDI messages.
The Stegosaurus will use SysEx messages to change the behavior of the controller.
The manufacturer ID for the USB MIDI SysEx messages is 0x00 0x53 0x4D
. The 0x00
indicates that the message has a vendor ID, and the 0x53 0x4D
is the ASCII representation of "SM". This is a unique identifier for the Stegosaurus MIDI controller (I think it is unique). So, if you see a message with this ID, it is likely from the Stegosaurus. The rest of the message is the actual data.
To program the controller behavior, the interface will send a SysEx message with the manufacturer ID, followed by the command byte, and then the data. Keep in mind that the SysEx message maximum length is 128 bytes. This is using this here, but I don't think that any of the messages will be even close to that length.
The Stegosaurus will use the following MIDI messages. Keep in mind that the first 4 bytes of the message are specific to the SysEx MIDI protocol. The rest of the message is the actual data. Every message is concluded with the SysEx end byte 0xF7
.
The message is broken up into 2 parts: the header and the data. The header is the first 4 bytes of the message, and the data is the rest of the message.
Types of messages:
- Control change
- Program change
- Variable set
Byte | Value |
---|---|
0 | 0xF0 (SysEx start) |
1 | 0x00 (Three-byte Vendor ID) |
2 | 0x53 (Vendor ID) |
3 | 0x4D (Vendor ID) |
Byte | Description | Range |
---|---|---|
4 | Message type | 0x00 (Program Change) |
5 | Trigger | 0x00 for preset entry, 0x01 for switch short press, 0x02 for switch long press |
6 | Switch number (if trigger is 0x01 or 0x02) | [0, 3] |
7 | Switch type (if trigger is 0x01 or 0x02) | 0x0 for momentary, 0x1 for toggle |
8 | Preset to modify | [0, 127] |
9 | MIDI channel | [0, 15] |
10 | Program number | [0, 127] |
Control change messages are called when bit 9 of the bookkeeping byte is set to 0x01.
Byte | Description | Range |
---|---|---|
4 | Message type | 0x01 (Control Change) |
5 | Trigger | 0x00 for preset entry, 0x01 for switch short press, 0x02 for switch long press |
6 | Switch number (if trigger is 0x01 or 0x02) | [0, 3] |
7 | Switch type (if trigger is 0x01 or 0x02) | 0x0 for momentary, 0x1 for toggle |
8 | Preset to modify | [0, 127] |
9 | MIDI channel | [0, 15] |
10 | Control number | [0, 127] |
11 | Control value | [0, 127] |
This message is used to get the current information for a preset. This is useful for updating the interface with the current state of the controller.
Byte | Description | Range |
---|---|---|
4 | Message type | 0x02 (Program Get) |
5 | Preset to get | [0, 127] |
The data returned will be in the following format:
This message is used to set a variable in the controller. This is useful for setting things like the LED brightness or the MIDI channel. By convention, for boolean variables, a value of 0 is false and a value of 127 is true. This is done because the MIDI protocol for CC and PC messages only allows for values between 0 and 127.
Byte | Description | Range |
---|---|---|
4 | Message type | 0x03 (Variable Set) / 0x04 (Variable Get) |
5 | Variable name | [0, ] |
6 | Value | [0, 127] |
Table of variable names and value ranges
Variable # | Variable Name | Value Range |
---|---|---|
0x00 | LED Brightness | [0, 127] |
0x01 | MIDI Channel | [0, 15] |
0x02 | MIDI Thru | [0, 127] |
[DEPRECATED]
This is currently built on a Teensy 4.0. It should also work with any ATMega32U4 board, such as the Arduino Micro, HOWEVER, the USB name on the Micro will show up as just "Arduino Micro". The firmware is written in C++ and uses the Arduino framework. Make sure you have the arduino IDE installed, and the Teensyduino add-on. See the Teensyduino page for more information. The following libraries are required:
- Arduino MIDI Library (@v5.0.2)
- Arduino USBMIDI (@v1.1.2)
- EasyButton (@v2.0.3)
You'll need to change the USB type to "Serial + MIDI" in the Arduino IDE. This is done by going to Tools > USB Type
and selecting "Serial + MIDI".