Monday, March 27, 2017

Teensy 3.6 Basics: Sending MIDI Continuous Control

Overview
The Teensy can send MIDI data over USB. This include sending MIDI note on and note off events. Built-in functions make sending MIDI data simple. A summary of Teensy MIDI message types that can be sent over USB can be found here.

Teensy 4.1 Note: You may need to set analogReadResolution() to 8 bits and then divide the analogRead() value by 2 in order for this code to work correctly. 




Hardware Setup
A potentiometer is connected to 3.3V, ground and analog input 0.









Software Setup
The analogRead() function is used to measure a voltage at an analog input. The analogReadResolution() function is used to set the range of the reading value to 0 - 127. The usbMIDI.sendControlChange() function is used to send a MIDI continuous control message via USB.

The order of arguments for the usbMIDI.sendControlChange() are control number, control value, MIDI channel.

The DAW that receives the controller data must be set up to see the Teensy as a control input.







Example 1 - Sending the Value of One Potentiometer as a Continuous Control Message
In this example, the aim is to read the value of a potentiometer and, if the value has changed compared to the previous reading, send the new value as a MIDI control message.





Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_MIDI_Continuous_Control_Example_1/







Example 2 - Sending the Value of Two Potentiometers as Continuous Control Messages
In this example, the aim is to read the value of two potentiometers and, if a value has changed compared to the previous reading, send the new value as a MIDI control message. The two potentiometers are completely separate.







Download here: http://milkcrate.com.au/_other/downloads/arduino/teensy_3_6_basics/Sending_MIDI_Continuous_Control_Example_2/





Summary
The Teensy can easily send continuous controller messages using the USB MIDI functions.

0 comments: