Control Surface  1.2.0
MIDI Control Surface library for Arduino
MIDI-Output.ino

MIDI-Output

This is an example on how to send MIDI messages.

Boards:
AVR, AVR USB, Nano Every, Due, Nano 33, Teensy 3.x, ESP32

For a full list of available MIDI send functions, see MIDI_Sender.

Connections

None.

Behavior

Mapping

None.

Written by PieterP, 2020-06-11
https://github.com/tttapa/Control-Surface

#include <Control_Surface.h> // Include the Control Surface library
// The MIDI over USB interface to use
void setup() {
midi.begin(); // Initialize the MIDI interface
}
using namespace MIDI_Notes;
// MIDI note number, channel, and velocity to use
const MIDIAddress address = {note(C, 4), CHANNEL_1};
const uint8_t velocity = 0x7F;
void loop() {
midi.sendNoteOn(address, velocity);
delay(500);
midi.sendNoteOff(address, velocity);
delay(500);
midi.update(); // Handle or discard MIDI input
}
USBMIDI_Interface
A class for MIDI interfaces sending MIDI messages over a USB MIDI connection.
Definition: USBMIDI_Interface.hpp:41
MIDIAddress
A type-safe utility class for saving a MIDI address consisting of a 7-bit address,...
Definition: MIDIAddress.hpp:91
MIDI_Sender::sendNoteOn
void sendNoteOn(MIDIAddress address, uint8_t velocity)
Send a MIDI Note On event.
Definition: MIDI_Interface.ipp:49
Control_Surface.h
The main header file that includes all Control-Surface header files.
Parsing_MIDI_Interface::update
void update() override
Read the MIDI interface and call the callback if a message is received.
Definition: MIDI_Interface.cpp:34
MIDI_Notes::note
constexpr int8_t note(int8_t note, int8_t numOctave)
Get the MIDI note in the given octave.
Definition: Notes.hpp:35
MIDI_Interface::begin
void begin() override
Initialize the MIDI Interface.
Definition: MIDI_Interface.hpp:152
MIDI_Sender::sendNoteOff
void sendNoteOff(MIDIAddress address, uint8_t velocity)
Send a MIDI Note Off event.
Definition: MIDI_Interface.ipp:55
MIDI_Notes
MIDI note names.
Definition: Notes.hpp:16
CHANNEL_1
constexpr Channel CHANNEL_1
Definition: Channel.hpp:111
MIDI_Notes::C
constexpr int8_t C
Definition: Notes.hpp:18