Pages: [1]   Go Down
Author Topic: Mix or merge MIDI IN signals with internal MIDI messages / midi library  (Read 1186 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 16
Kling Klang
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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!
Logged

* alright, what happened *

France
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

France
Offline Offline
Newbie
*
Karma: 0
Posts: 46
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And if you want to send everything, just add :

Code:
if (MIDI.read()) MIDI.send(MIDI.getType(), MIDI.getData1(), MIDI.getData2(), MIDI.getChannel());
Logged

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

Offline Offline
Newbie
*
Karma: 0
Posts: 16
Kling Klang
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great! Can't wait to check this out  smiley-cool
Logged

* alright, what happened *

Offline Offline
Newbie
*
Karma: 0
Posts: 16
Kling Klang
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-grin

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

Logged

* alright, what happened *

Pages: [1]   Go Up
Jump to: