Go Down

Topic: Mix or merge MIDI IN signals with internal MIDI messages / midi library (Read 1 time) previous topic - next topic

tmk_009

I'm using the midi library 3.2 for a midi controller and it is working very well. It is for changing CC values of a synth, but i want to play it on a keyboard, too. So I'm curious about mixing the Keyboard signals with the arduino MIDI messages somehow...
Well, I could go and buy an hardware merger, or maybe there is a way to listen to the incoming MIDI messages and send them inside my loop along with the internal MIDI messages?

This simplified part is working, I couldn't find any proper "AllTheIncomingMidiMessage" function in the library:

Code: [Select]

void loop() {
  // Work with the input
  sensorValue = analogRead(sensorPin) / 8;
 
  // Send MIDI cc74 example on channel 1
  if(sensorValue != sensorValue_old) {                   // only if value has changed
    MIDI.send(ControlChange,74,sensorValue,1);
    sensorValue_old = sensorValue;                        // compare and change if not the same
  }
 
  //Read and send all incoming MIDI messages
  //MIDI.send(AllTheIncomingMidiMessageSomehow,1);


It would be great to get a hint!
* alright, what happened *

gaith

Hi,
Yes, it's possible.
Just add the MIDI listener in your loop :

  if (MIDI.read()) { ...}

Then you get the MIDI messages types : MIDI.getType()
and the values (depending on the types) : MIDI.getData1() and MIDI.getData2()

So you can choose what you will send. For exemple, if the MIDI type is "NoteOn", MIDI.getData1() will be the value of the note, and MIDI.getData2() the volume.

GaƩtan
Build a groove box with Arduino Due :
http://groovuino.blogspot.com/

gaith

And if you want to send everything, just add :

Code: [Select]
if (MIDI.read()) MIDI.send(MIDI.getType(), MIDI.getData1(), MIDI.getData2(), MIDI.getChannel());

Build a groove box with Arduino Due :
http://groovuino.blogspot.com/

tmk_009

* alright, what happened *

tmk_009

We'll, almost after a year I decided to move away from the arduino in this case.
The overall timing was too bad, and I think the best way would be to write the code from scratch.
Merging two large libraries wasn't the best idea :D

For my case ( shruthi-1 control ) I found a solution that was dedicated for the shruthi with its own pcb.

* alright, what happened *

Go Up