MIDI control change

Hey, it’s my first time using MIDI and I can’t figure out how to send a control change using the MIDI.h library.

The goal is to switch de video input on my Roland HD video switcher V-1HD. I attatched my code and the controller manual. I tried switching the numbers but nothing seems to work.

Maybe soeone can help me?

MIDI_controller_zelfbouw.ino (1.76 KB)

V-1HD_RC_guide_e01_W.pdf (372 KB)

The documentation says:-

sendControlChange (DataByte inControlNumber, DataByte inControlValue, Channel inChannel);

So your call of:-

MIDI.sendControlChange (0,32,2);  //(NoteNumber, Velocity, Channel

Will send the value 32 to controller number 0, on channel 2.

It is a not advisable to attach comments that are wrong to code, it doesn't help.

Mike: I'm trying to do the same thing--control a Roland video switcher. Are you using MIDI through a midi cable or via USB? Were you able to get it working?

Tony

This is where I am at, but I dont really know what I’m doing!
I am currently using MIDI on a cable vs USB, but as I am cutting and pasting code from other sketches, I may be confusing USB commands with serial commands.

I need to associate pinmode 2 thru 5 with changing the sendcontrol change 00H thru 03H, ideally on both channel A and channel B.

#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();

int mem={0,0,0,0};

void setup() {
Serial.begin(31250);
MIDI.begin (MIDI_CHANNEL_OMNI);

pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);

}

void loop() {
int sensorVal={
!digitalRead(2),!digitalRead(3),!digitalRead(4),!digitalRead(5),
};

for (int j=0; j<4; j++) {
if (sensorVal [j] !=mem[j]) {
mem [j]=sensorVal[j];
//sendControlChange (DataByte inControlNumber, DataByte inControlValue, Channel inChannel);
if (mem[j]) {
MIDI.sendControlChange (j + 1,33,1);

Please edit your post and add [code][/code] tags around your code. Your code is incomplete, the if statements, for loop and loop function are never closed.

What is the problem you're facing? What works, what doesn't? What have you tried to troubleshoot the issue?

Pieter

Nothing is working as I dont really know what I'm doing--I've jumped into this without fully understanding arduino and MIDI.

I really only need a direct translation from arduino digital in pins 2-5 to midi commands in the form of //sendControlChange (DataByte inControlNumber, DataByte inControlValue, Channel inChannel);

i expect it to look like (1,32,1) for camera one, (1,33,1) for camera 2 and so on.

I can set up the physical interface from mic switcher to arduino to video switcher, but need help with the code.When mic one is active, camera 1 selected, mic 2 active camera 2 selected, etc.

Arduino Uno send basic commands to midi controlled video switcher (Roland V1HD) either using midi cable or usb.

Here is a link to the Roland MIDI manual: https://www.dvestore.com/content/Guides/Roland/V-1HD/V-1HD_RC_guide_e01_W.pdf

I've jumped into this without fully understanding arduino and MIDI.

Yes that will give you a big problem.
That code is a nonsense. It won’t even compile. Once it compiles it actually needs to what you want as well, which is not very clear. So suppose a pin is pressed, what control value do you need to send, what value if any needs sending when it is released? What about the other controls do they only change when their own pin is changed?

You need to decide what sort of interface you want to use, that code only uses a serial output, not a USB output.

I’m going to use serial/MIDI, not USB–I can only deal with one headache at a time.

Here is my updated code, which is still not doing what I want. I can see on that its receiving the input from the external mixer (and switching based on which mic goes active), but I do not have a way to view the MIDI commands as they (hopefully) execute.

#include <MIDI.h>
enum {BUS_A, BUS_B, BUS_AB};

MIDI_CREATE_DEFAULT_INSTANCE();

const int INPUT_NUM = 4;
int inputPins[INPUT_NUM] = {2, 3, 4, 5};

void setup() {
// put your setup code here, to run once:
Serial.begin(31250);
//Serial.begin(9600);
MIDI.begin(MIDI_CHANNEL_OMNI);

for(int i=0; i< INPUT_NUM; i++) {
pinMode(inputPins*, INPUT_PULLUP);*

  • }*
    }
    void controlBus(byte progNo, byte mm=0) {
  • // Select the control*
  • MIDI.sendControlChange(0, mm, 1);*
  • MIDI.sendControlChange(32, 0, 1);*
  • // Select the program*
  • MIDI.sendProgramChange(progNo, 1);*
    }
    void controlChannel(byte progNo, int bus=BUS_A) {
  • switch(bus) {*
  • case BUS_A:*
  • controlBus(progNo);*
  • break;*
  • case BUS_B:*
  • controlBus(progNo, 1);*
  • break;*
  • case BUS_AB:*
  • controlBus(progNo);*
  • controlBus(progNo, 1);*
  • break;*
  • default:*
  • break;*
  • }*
    }
    int lastIndex = -1;
    void loop() {
  • // put your main code here, to run repeatedly:*
  • for(int i=0; i < INPUT_NUM; i++) {*
    _ int state = digitalRead( inputPins );_
    * if(state && (lastIndex != i) ) {*
    * lastIndex = i;*
    * controlChannel(i, BUS_B);
    _
    //Serial.print("Mic: ");_
    _
    //Serial.println(i+1);_
    _
    }_
    _
    }_
    _
    }*_

Just as added context, I'm using an automatic mic mixer to output 4v to the digital pins on the uno. When mic 1 turns on, arduino pin 2 goes up, when mic 2 turns on, pin 3 and so on. Only 1 mic is active at a time, and the last mic holds until the next activates.

Not that you need it but here is a link to that mixer:
https://www.audio-technica.com/cms/resource_library/literature/7bb55cf7c7902ca0/at_mx341a__om.pdf

Page 5 shows where I'm pulling the control voltage. That part works!