All Projects → tttapa → Control Surface

tttapa / Control Surface

Licence: gpl-3.0
Arduino library for creating MIDI controllers and other MIDI devices.

Projects that are alternatives of or similar to Control Surface

Arduino Applemidi Library
Send and receive MIDI messages over Ethernet (rtpMIDI or AppleMIDI)
Stars: ✭ 177 (-53.05%)
Mutual labels:  arduino, esp32, arduino-library, teensy, midi
Esp32 Hub75 Driver
A small, simple, passive driver for HUB75 based LED panels
Stars: ✭ 37 (-90.19%)
Mutual labels:  display, arduino, esp32, led
Guislice
GUIslice drag & drop embedded GUI in C for touchscreen TFT on Arduino, Raspberry Pi, ARM, ESP8266 / ESP32 / M5stack using Adafruit-GFX / TFT_eSPI / UTFT / SDL
Stars: ✭ 534 (+41.64%)
Mutual labels:  arduino, esp32, arduino-library, teensy
Teensystep
Fast Stepper Motor Library for Teensy boards
Stars: ✭ 191 (-49.34%)
Mutual labels:  arduino, arduino-library, teensy
Midi controller
This is a library for creating a MIDI controller using an Arduino or Teensy board.
Stars: ✭ 287 (-23.87%)
Mutual labels:  arduino, teensy, midi
Md max72xx
LED Matrix Library
Stars: ✭ 186 (-50.66%)
Mutual labels:  arduino, led, arduino-library
M5stack Sd Updater
💾 Customizable menu system for M5Stack and ESP32-Chimera-Core - loads apps from the Micro SD card. Easily add you own apps
Stars: ✭ 175 (-53.58%)
Mutual labels:  arduino, esp32, arduino-library
Ssd1306
Driver for SSD1306, SSD1331, SSD1351, IL9163, ILI9341, ST7735, PCD8544, Nokia 5110 displays running on Arduino/ESP32/Linux (Rasperry) platforms
Stars: ✭ 303 (-19.63%)
Mutual labels:  arduino, esp32, arduino-library
Jled
Non-blocking LED controlling library for Arduino and friends.
Stars: ✭ 197 (-47.75%)
Mutual labels:  arduino, esp32, led
M5ez
Complete interface builder for the M5Stack, an ESP32 based mini tinker-computer
Stars: ✭ 260 (-31.03%)
Mutual labels:  display, arduino, esp32
Arduinowebsockets
A library for writing modern websockets applications with Arduino (ESP8266 and ESP32)
Stars: ✭ 213 (-43.5%)
Mutual labels:  arduino, esp32, arduino-library
Arduino-USBMIDI
Allows a microcontroller, with native USB capabilities, to appear as a MIDI device over USB to a connected computer
Stars: ✭ 98 (-74.01%)
Mutual labels:  teensy, midi, arduino-library
Md parola
Library for modular scrolling LED matrix text displays
Stars: ✭ 282 (-25.2%)
Mutual labels:  arduino, led, arduino-library
Esp32 Ble Mouse
Bluetooth LE Mouse library for the ESP32 (Arduino IDE compatible)
Stars: ✭ 180 (-52.25%)
Mutual labels:  arduino, esp32, arduino-library
Easybutton
Arduino library for debouncing momentary contact switches, detect press, release, long press and sequences with event definitions and callbacks.
Stars: ✭ 187 (-50.4%)
Mutual labels:  arduino, esp32, arduino-library
Dsckeybusinterface
An Arduino/esp8266/esp32 library to directly interface with DSC security systems.
Stars: ✭ 202 (-46.42%)
Mutual labels:  arduino, esp32, arduino-library
TM1637TinyDisplay
Arduino library to display numbers and text on a 4 and 6 digit 7-segment TM1637 display modules.
Stars: ✭ 23 (-93.9%)
Mutual labels:  display, arduino-library, led
Pzem004t
Arduino communication library for Peacefair PZEM-004T Energy monitor
Stars: ✭ 165 (-56.23%)
Mutual labels:  arduino, esp32, arduino-library
Espmqttclient
Wifi and MQTT handling for ESP8266 and ESP32
Stars: ✭ 169 (-55.17%)
Mutual labels:  arduino, esp32, arduino-library
Lpd8806
Arduino library for LED strips and pixels using LPD8806 (and probably LPD8803/LPD8809)
Stars: ✭ 207 (-45.09%)
Mutual labels:  arduino, led, arduino-library

Build Status Test Coverage Build Status GitHub

Control Surface

An Arduino library for MIDI control surfaces (input and output).
It includes a general-purpose MIDI abstraction layer as well, which can be useful for any MIDI-related project.

Overview

This library turns your Arduino-compatible board into a MIDI control surface.

Just connect up some push buttons, potentiometers, LEDs ... and declare them in your code.

Multiple different MIDI interfaces are supported: MIDI over USB, Serial MIDI (e.g. 5-pin DIN MIDI), Debug MIDI (prints out the messages in a readable format, and allows you to input text based messages), AppleMIDI over WiFi or Ethernet, MIDI over Bluetooth LE (experimental).

For MIDI output, you can use push buttons, toggle switches, potentiometers, faders, rotary encoders, etc.

All digital inputs are debounced, and all analog inputs are filtered using digital filters and hysteresis. This results in high accuracy without noise, without introducing latency.

These can be used to send MIDI notes, Control Changes, Pitch Bends, Program/Patch changes, etc.

For MIDI input, you can use LEDs to display the state of different settings, to display the audio level of each channel (VU meters), the positions of knobs (V-Pot LED rings), etc.
You can also add an OLED display (e.g. SSD1306) to display a nice overview of which channels are set to mute or solo, display the time cursor, VU meters, etc. Bitmaps with play, mute, solo, record buttons, and others are included.

A large portion of the Mackie Control Universal protocol is implemented.

All controls can be arranged in banks: e.g. if you have only 4 physical volume faders, you can add them to a bank, and then you can control 8 channels (or more) by changing the bank setting.

Apart from banks and bank selectors, you can also add transposers to change the key of your notes, for example.

In order to save some IO pins, the library natively supports Shift Registers (e.g. 74HC595) and multiplexers (e.g. 74HC4051 or 74HC4067).

If you are using a Teensy 3.x, you can use it as a USB audio interface. Just add an I²S DAC (e.g. PCM5102) and 5 lines of code, and you can start playing audio through your Teensy.
You can also add volume controls and VU meters for these audio connections.

Thanks to the structure of the library, you can easily add your own MIDI or display elements, using some minimal, high level code. All low level stuff is completely reusable (e.g. all MIDI operations, debouncing switches, filtering analog inputs, and so on).

Example usage

A complete sketch for a MIDI controller with a potentiometer that sends out MIDI Control Change message can be written in just five lines of code:

#include <Control_Surface.h>

USBMIDI_Interface midi;
CCPotentiometer pot = { A0, MIDI_CC::General_Purpose_Controller_1 };

void setup() { Control_Surface.begin(); }
void loop() { Control_Surface.loop(); }

Larger MIDI controllers can implemented very easily as well, with clean and easy to modify code.
The following sketch is for 8 potentiometers (connected using an analog multiplexer) that send out MIDI Control Change messages over USB.

#include <Control_Surface.h>  // Include the library
 
USBMIDI_Interface midi;  // Instantiate a MIDI Interface to use
 
// Instantiate an analog multiplexer
CD74HC4051 mux = {
  A0,       // Analog input pin
  {3, 4, 5} // Address pins S0, S1, S2
};
 
// Create an array of potentiometers that send out MIDI Control Change messages 
// when you turn the potentiometers connected to the 8 input pins of the mux.
CCPotentiometer volumePotentiometers[] = {
  { mux.pin(0), { MIDI_CC::Channel_Volume, CHANNEL_1 } },
  { mux.pin(1), { MIDI_CC::Channel_Volume, CHANNEL_2 } },
  { mux.pin(2), { MIDI_CC::Channel_Volume, CHANNEL_3 } },
  { mux.pin(3), { MIDI_CC::Channel_Volume, CHANNEL_4 } },
  { mux.pin(4), { MIDI_CC::Channel_Volume, CHANNEL_5 } },
  { mux.pin(5), { MIDI_CC::Channel_Volume, CHANNEL_6 } },
  { mux.pin(6), { MIDI_CC::Channel_Volume, CHANNEL_7 } },
  { mux.pin(7), { MIDI_CC::Channel_Volume, CHANNEL_8 } },
};
 
void setup() {
  Control_Surface.begin();  // Initialize the Control Surface
}

void loop() {
  Control_Surface.loop();  // Update the Control Surface
}

Control Surface supports many types of MIDI inputs. For example, an LED that turns on when a MIDI Note On message for middle C is received:

#include <Control_Surface.h>

USBMIDI_Interface midi;
using namespace MIDI_Notes;
NoteValueLED led = { LED_BUILTIN, note(C, 4) };

void setup() { Control_Surface.begin(); }
void loop() { Control_Surface.loop(); }

Getting Started

See the Getting Started page to get started using the library.

Documentation

The automatically generated Doxygen documentation for this library can be found here:
Documentation
Test coverage information can be found here:
Code Coverage
Arduino examples can be found here:
Examples

Have a look at the modules for an overview of the features of the library, it's the best entry point for the documentation.

The Control Surface library vs. The MIDI Controller library

You might already have found my other Arduino MIDI library, MIDI Controller, and are wondering which one you should use for your project.

First, some background:
I first started working on the MIDI Controller library way back in 2015, and it evolved a lot early on. The library seemed to be pretty popular, and it worked pretty well, so I couldn't just push breaking changes every couple of months.
Many people requested support for MIDI input, and I liked experimenting with it as well. The main problem was that the overall architecture of the library needed a complete overhaul in order to add MIDI input support. Since I didn't know if the MIDI input was going to work out, and I didn't want to break compatibility with older versions of the library, I decided to fork it: Control Surface was born.
At the moment, I consider the MIDI Controller library "complete". I won't be adding any groundbreaking new features, but I will still be fixing bugs and providing support.
Control Surface, on the other hand, is where the active development takes place.

The main difference between the two libraries is that Control Surface has much more features. MIDI Controller has everything you need for a working MIDI controller with potentiometers, push buttons, rotary encoders, etc., while Control Surface supports all of that, plus MIDI input, LEDs, VU meters, OLED displays, MIDI over Bluetooth, Audio over USB, etc.
Another major difference is the documentation and tests. Control Surface tries to provide better documentation using Doxygen, and it has many unit tests to make sure I don't introduce any bugs.

For a new project, I would recommend Control Surface, because I think it has some great features compared to MIDI Controller.
The only caveat is that this library is still under development. Master should always be relatively stable, but I might change the API of some parts of the library for future releases if necessary.
Another thing is that not everything is implemented yet, and many features are not yet fully documented. If you have a specific feature request that is not yet fully implemented, feel free to open an issue, so I know where to focus on first.

Work in progress

  • Adding support for motorized faders
  • Cleaning up the display code
  • Cleaning up the MIDI over Bluetooth LE code
  • Adding more tests (currently at over 440 unit tests)
  • Adding more examples and adding comments to existing examples
  • Finishing the documentation

Supported boards

For each commit, the continuous integration tests compile the examples for the following boards:

  • Arduino UNO
  • Arduino Leonardo
  • Teensy 3.2
  • Arduino Due
  • Arduino Nano 33 IoT
  • ESP8266
  • ESP32

This covers a very large part of the Arduino platform, and similar boards will also work (e.g. Arduino Nano, Arduino Mega, etc.).

If you have a board that's not supported, please open an issue and let me know!

Note that MIDI over USB and MIDI over Bluetooth are not supported on all boards.
For MIDI over USB support, check out the MIDI over USB documentation page. As a general rule of thumb, if your board is supported by the MIDIUSB library or if it's a Teensy, MIDI over USB should be supported.
MIDI over BLE is currently only supported on ESP32.

Information for developers

Information for people that would like to help improve the Control Surface library can be found here: https://tttapa.github.io/Pages/Arduino/Control-Surface/Developers/index.html
It covers installation instructions for developers, instructions for running the tests and generating documentation, a style guide, etc.

Recent Breaking Changes

  • 8a3b1b314cf5b4aedf3ad60cbbc492fbcbb25c73
    Before, Control_Surface.MIDI() was used to get the MIDI interface used by Control Surface. This method was removed, because you can now connect multiple interfaces to Control Surface, using the MIDI Pipe routing system. To send MIDI using Control Surface, you can now use Control_Surface.sendCC(...) and the other similar methods directly.
  • 8a3b1b314cf5b4aedf3ad60cbbc492fbcbb25c73
    For the same reason as the bullet above, the MultiMIDI_Interface was removed, and has been replaced by the MIDI Pipe routing system.
  • bca6e11b2b3e02df5f600f65c81676708a81155b
    The color mapper for NoteRangeFastLED and the like now takes a second parameter that represents the index of the LED within the LED strip.
  • 3c01c7d5eb60e59720540d5a77095468e6984a58
    The maximum supported ADC resolution is now used by default (e.g. 13 bits on Teensy 3.x, 12 bits on ESP32).
    This increases the accuracy of analog inputs and controls for the Control Surface library, but could cause problems if your code uses other libraries that expect the resolution to be 10 bits.
    You can change the default resolution to 10 bits in src/AH/Settings/Settings.hpp if you have to.
  • 31edaa6b76477fdf152c19fd34f7e4e8506561e6
    The mapping function is now applied before applying hysteresis.
    This means that the input and output values of the function should be 16 - ANALOG_FILTER_SHIFT_FACTOR bits wide instead of 7. By default this is 14 bits.
    The signature of the mapping function is now analog_t f(analog_t raw), where the return value and raw are both numbers in [0, 16383].
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].