PDA

View Full Version : How hard can this be!!! MIDI CC to Hardware



xox07
12-19-2015, 08:34 PM
I want to send midi cc parameter control data to control hardware parameters. All I need to do is asign specific midi cc numbers and values to pots or map cc to pots that will allow me to control hardware using a midi cable

There are plenty of amazing people in this community please point me (code wise) in the right direction because I have looked everywhere for a month but all I can find is people making controllers for software?

Am I really that old?

Anyway I can make functional software midi controllers all day long but for the life of me I can not communicate with hardware.

Please!!calling all teensy and Avr geniuses help me before I go completely bald. If not for me for the kids haha!

PaulStoffregen
12-19-2015, 08:37 PM
Maybe this?

http://www.pjrc.com/teensy/td_libs_MIDI.html

If you only want to transmit, you can leave off the MINI IN jack, and PC900 and other parts associated with it.

If you use a newer 3.3V Teensy, pay close attention to the comment about resistor values. They need to decrease to 47 ohms if you have only 3.3V.

el_supremo
12-19-2015, 09:06 PM
Didn't I answer this here: http://forum.arduino.cc/index.php?topic=366550.0?

Pete

xox07
12-20-2015, 07:36 AM
I apologize here is the schematic and solidworks mock up58605861

xox07
12-20-2015, 07:40 AM
Didn't I answer this here: http://forum.arduino.cc/index.php?topic=366550.0?

Pete

Pete I tried the loop but i don't believe my variables are correct?



#include <MIDI.h>


// Variables:
int cc = 1;
int AnalogValue[2] = {0,0}; // define variables for the controller data
int lastAnalogValue[2] = {0,0}; // define the "lastValue" variables

void setup() {
// launch MIDI
MIDI.begin();

}

void loop() {

AnalogValue0 = analogRead(0); //knob 1 cutoff
// convert to a range from 0 to 127:
cc = AnalogValue0 / 8;
// check if analog input has changed
if (abs(lastAnalogValue0 - cc) > 1) {
MIDI.sendControlChange(21, cc, 1);
// update lastAnalogValue zero variable
lastAnalogValue0 = cc;
}
AnalogValue1 = analogRead(1); //knob 2 resonance
// convert to a range from 0 to 63:
cc = AnalogValue1 / 8;
// check if analog input has changed
if (abs(lastAnalogValue1 - cc) > 1) {
MIDI.sendControlChange(22, cc, 1);
// update lastAnalogValue one variable
lastAnalogValue1 = cc;
}

}

monkeybiscuits
12-20-2015, 09:08 AM
I think you're just missing some square brackets and, if you need a value from 0 to 63, divide by 16 instead of 8.


#include <MIDI.h>


// Variables:
int cc = 1;
int AnalogValue[2] = {0,0}; // define variables for the controller data
int lastAnalogValue[2] = {0,0}; // define the "lastValue" variables

void setup() {
// launch MIDI
MIDI.begin();

}

void loop() {

AnalogValue[0] = analogRead(0); //knob 1 cutoff
// convert to a range from 0 to 127:
cc = AnalogValue[0] / 8;
// check if analog input has changed
if (abs(lastAnalogValue[0] - cc) > 1) {
MIDI.sendControlChange(21, cc, 1);
// update lastAnalogValue zero variable
lastAnalogValue[0] = cc;
}
AnalogValue[1] = analogRead(1); //knob 2 resonance
// convert to a range from 0 to 63:
cc = AnalogValue[1] / 16;
// check if analog input has changed
if (abs(lastAnalogValue[1] - cc) > 1) {
MIDI.sendControlChange(22, cc, 1);
// update lastAnalogValue one variable
lastAnalogValue[1] = cc;
}

}

PaulStoffregen
12-21-2015, 01:34 PM
This is a perfect time to start using the Arduino Serial Monitor.

For example:



AnalogValue[0] = analogRead(0); //knob 1 cutoff
// convert to a range from 0 to 127:
cc = AnalogValue[0] / 8;
Serial.print("cc = ");
Serial.println(cc);


or like this:



// check if analog input has changed
if (abs(lastAnalogValue[0] - cc) > 1) {
MIDI.sendControlChange(21, cc, 1);
Serial.print("sending cc21 = ");
Serial.println(cc);


By simply adding these, you can observe with the Arduino Serial Monitor what your program is really computing and transmitting (and whether it's actually transmitting).

loveaurell
01-07-2016, 05:21 PM
Did you get it to work, xox07? Just curious, how are you planning to build that case/panel? I'm also working on a MIDI controller but haven't found any good solution for the panel printing and drilling. Do you know any good online services for designing/ordering panels and cases?