Hard to find - Midi in to anlog out controling music devices

I'm an old musician, but have also been working as a sound and tech engineer. Have done some Arduino stuff before for building and controlling SIM-rig tactiles, mostly for fun, but now I would like to build an interface for my guitar rig that receives midi inputs and translates that to analog on/off switches (both latching and momentary) for loop switchers and amp channel switching. Can't find any suitable info in this regard as most applications for Arduino and midi seem to be for analog IN to midi out made for controllers.

If anyone have any info or could point me to a source or knowledge base regarding this matter, I would be very happy for your input.
Thanks!

which arduino board do you have? did you made a schematic ?

I have some UNO, MICRO and LEONARDO boards. Will make a schematic when I have the info I need. Or you mean like a block diagram for the stuff I want to control?

Thanks for your response.

what kind of info you need?

Are these any MIDI inputs?
Where do they come from?
What is the MIDI format of these messages? - That is are they note on note off, or some other messages like CC or program (change voice)?

How are you proposing to send an Arduino output to these switches? A relay would be a good choice for its isolation properties. One relay for each switch.

It should be quite simple to do once you have sorted out these questions.

I'm looking for both at least a rudimentary ready available program (I suck at programming) and some description of the pins to use.

this it not clear.

very low chance someone written program for your needs. not even me can write it without clear understanding what you mean under "to switch an analog switch" and how much of them is planned.

Thanks for your very fast respons!
Will be most convenient for me to use PC commands, but I could also use CC if needed. No other command types will be used for this. Midi will be generated in my midi foot controllers (I have a couple of different kinds). Will use relays for switching the audio signal, yes.

Ok, sorry I wasn't very clear on this. I was thinking about using the analog outs of the board to switch relays of 5, 9 or 12V (powered from external source if possible). No audio in the Arduino.

analog out is not really analog. analogWrite() function set PWM with duty cycle resolution of 8bit, but relay module need digital pin. how to connect it you can look in internet.

Should work with PWM I suppose. What the relays need is just a mediator to transfer the voltage for them to act, and I believe PWM could make that as the relays are very slow?

Thanks for your input

i think you should forget about PWM, definitely you want not a relay switching 980 times in a second.

Ok, I understand.

say, when you speaking about "switches" do you mean SPST(SPDT) or "analog music effect foot switch" ?

I just need the board to accomplish a voltage send to the relay to then switch my audio signal in my "loop system". First and foremost I need this voltage to be latching (SPST, like a lamp sw on or off), but if I can I would also be helped if I could have it momentary sending voltage. I believe it could be quite a simple matter for an Arduino board to actually operate as a first "switch" opening or closing a relay later in the circuit. The thing is to get the Arduino to accept midi as input, then interpret that to a switching mode for output. I believe however I will need to feed it with external power for the relays to get the juice needed.

I honestly think someone else must have tried this before as it's not a novelty need for musicians (IE guitar players), I just can't seem to find any info about these specifics?

circuit:
grafik

sketch:

void setup() {
  pinMode(13, OUTPUT); // Eingebaute LED
  digitalWrite(13, LOW);
  Serial.begin(31250);
}

void loop() {
  static byte statusByte;
  static byte dataByte1;
  static byte dataByte2;

  if (Serial.available() > 2) {
    statusByte = Serial.read();
    dataByte1 = Serial.read();
    dataByte2 = Serial.read();

    if (statusByte >= 144 && statusByte <= 159) { // Entspricht NoteOn MIDI Kanal 1-16
      digitalWrite(13, HIGH);
      delay(10);  // Ohne Delay leuchtet die LED nicht, dadurch verpasst man aber einige Signale
      digitalWrite(13, LOW);
    }
  }
}

Thanks for your suggestion for a MIDI IN device. And excuse my ignorance, but why the need for an optocoupler to make the transition? I took almost for granted that there where some software library available to receive midi to an Arduino USB port? Maybe I'm just too optimistic here?

usb port? you should really take paper and pencil, and draw your project to visualise what you want. and show to us this picture.

It is a requirement of the MIDI standards that you use an opto-isolator.

https://midi.org/5-pin-din-electrical-specs
You need to be a member to download that document from the midi.org website, but here it is if you don't want to join:

Quote:

MIDI Circuit:
The MIDI circuit is a 5mA current loop; logical 0 is current ON. One output shall drive one and only one input. To avoid ground loops, and subsequent data errors, the transmitter circuitry and receiver circuitry are internally separated by an opto-isolator (a light emitting diode and a photo sensor which share a single, sealed package). Sharp PC-900V and HP 6N138 opto-isolators have been found acceptable. Other high-speed opto-isolators may be satisfactory. The receiver must require less than 5 mA to turn on. Rise and fall times should be less than 2 microseconds.

midi

You will see that when a MIDI output is connected to a MIDI input there are a total of 3 x 220Ω used to limit the opto isolator current to 5mA. This is to give some protection, and try and make the connections idiot proof.

Do not use PWM just a digital write will,do.

I don't understand what a PC command is. But CC will,work.

Yes it is great that you want to do this, but it is not very common. But it is so easy to do that is why there is nothing special about it.

Most external MIDI inputs require the complete interface shown above, so it will be isolated, but an Arduino UNO can generate MIDI signals by using a helper app in your computer, like the one called "hairless". It is very old and is a 32 bit application, modern Macs do not support it but some windows versions will. It will convert a fast serial output into a virtual MIDI recognised device.