Hey guys,
so yesterday i had a couple of questions about the teensy as a midi controller.
Today, i soldered the parts together and it went pretty well (no parts are touching and everything seems to be soldered correctly to the Teensy).
The Teensy does in fact send Midi CC Values, but here comes the problem: whenever the Teensy sends midi signals, those CC Values "jump" between 1-16 in a fraction of seconds, means it doesn't stick to one Value.
Since im really just a musician who wants to build a custom Midi Controller, i looked up the code that was recommended on the PJRC website.
I defined how many analog inputs i have (16) and left the rest as it is. I tried a few other codes, which did not have that "jumping" problem of the CC Values, but they didn't work for me either.
How can i solve this problem?
so yesterday i had a couple of questions about the teensy as a midi controller.
Today, i soldered the parts together and it went pretty well (no parts are touching and everything seems to be soldered correctly to the Teensy).
The Teensy does in fact send Midi CC Values, but here comes the problem: whenever the Teensy sends midi signals, those CC Values "jump" between 1-16 in a fraction of seconds, means it doesn't stick to one Value.
Since im really just a musician who wants to build a custom Midi Controller, i looked up the code that was recommended on the PJRC website.
I defined how many analog inputs i have (16) and left the rest as it is. I tried a few other codes, which did not have that "jumping" problem of the CC Values, but they didn't work for me either.
Code:
// define how many pots are active up to number of available analog inputs
#define analogInputs 16
// make arrays for input values and lagged input values
int inputAnalog[analogInputs];
int iAlag[analogInputs];
// make array of cc values
int ccValue[analogInputs];
// index variable for loop
int i;
void setup() {
// MIDI rate
Serial.begin(31250);
}
void loop() {
// loop trough active inputs
for (i=0;i<analogInputs;i++){
// read current value at i-th input
inputAnalog[i] = analogRead(i);
// if magnitude of difference is 8 or more...
if (abs(inputAnalog[i] - iAlag[i]) > 7){
// calc the CC value based on the raw value
ccValue[i] = inputAnalog[i]/8;
// send the MIDI
usbMIDI.sendControlChange(i, ccValue[i], 1);
// set raw reading to lagged array for next comparison
iAlag[i] = inputAnalog[i];
}
delay(5); // limits MIDI messages to reasonable number
}
}
How can i solve this problem?