Monday, March 27, 2017

Teensy 3.6 Basics: Sending Pitchbends

Overview
The Teensy can send many types of MIDI data of USB, including pitchbends. MIDI pitchbend data has a resolution of 14 bits, which covers the range of 0 - 16383. This is far higher than continuous controller data, which has a range of 0 - 127 with 7 bits.

As such, the pitchbend messages are useful when requiring a higher degree of control.





Hardware Setup
In this example, a potentiometer is connected to analog input 0. A push button is connected to digital pin 32.









Example 1 - Sending Pitchbend Data
In this example, the pitchbend value is sent based on the potentiometer and the push button sends note on / note off messages.

Note the use of analogReadResolution to set the range to 14 bits (0 - 16383), and analogReadAveraging to smooth out the data values by averaging 32 samples.

The pitchbend function, usbMIDI.sendPitchBend() takes the argument of value and channel, where value is an int in the range of 0 - 16383.






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









Summary
If a higher resolution of MIDI control is required, sending pitch bend data may be a suitable solution.

0 comments: