Hello, I am building a 3 pot MIDI controller for expression in Cubase, I would like CC 11, CC1, CC21, for Expression, Dynamics, and Vibrato. I understand I can change these in my DAW later on.
I jumped into this thinking I could program a Seeeduino XIAO, thinking the SAMD21 was MIDI over USB capable, but I am having problems getting anything to load into the XIAO board.
There is an example I really like, that suits my project specifically, but was designed for a Teeensy 3.1, which I see has a very simple USB MIDI in Arduino: Tools>USB>MIDI...then with this sketch BOOM probably easily use in the DAW. My Seeeduino XIAO is a bit different: Tools>USB>Ardiuno OR TinyUSB (I thought this SAMD21 was USB MIDI capable!)
I have tried including USBMIDI in the sketch, and have considered the TinyUSB route but can find no examples as nicely as this one for my project and am not sure where to go, am considering starting over with a Teensy board but have 2 of these xiaos and would REALLY like to make it work, as I am a MIDI production student and don't have 300$ for this desired controller I'm trying to make!
Anyone able to help me? I would REALLY appreciate some guidance!
Here is my ideal example I mistakenly thought would be easy for me to use!
#include <Bounce.h>
///////////////////////////////////////////////////////////////////////////
// define how many pots are active up to number of available analog inputs
#define analogInputs 3
//////////////////////////////////////////////////////////////////////////
// define arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// define array of cc values
int ccValue[analogInputs];
// include the ResponsiveAnalogRead library
#include <ResponsiveAnalogRead.h>
///////////////////////////////////////////////////////////////////////////
// define pins and cc codes
const int A_PINS = 3;
const int ANALOG_PINS[A_PINS] = {A0, A1, A2};
const int CCID[A_PINS] = {11, 1, 21};
///////////////////////////////////////////////////////////////////////////
// a data array and a lagged copy to tell when MIDI changes are required
byte data[A_PINS];
byte dataLag[A_PINS];
// ititialize the ReponsiveAnalogRead objects
ResponsiveAnalogRead analog[]{
///////////////////////////////////////////////////////////////////////////
{ANALOG_PINS[0],true},
{ANALOG_PINS[1],true},
{ANALOG_PINS[2],true},
///////////////////////////////////////////////////////////////////////////
};
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}
void loop(){
// update the ResponsiveAnalogRead object every loop
for (int i=0;i<A_PINS;i++){
analog[i].update();
// if the repsonsive value has change, print out 'changed'
if(analog[i].hasChanged()) {
data[i] = analog[i].getValue()>>3;
if (data[i] != dataLag[i]){
dataLag[i] = data[i];
usbMIDI.sendControlChange(CCID[i], data[i], 1);
}
}
}
}
Please and Thank you!!
Ken