Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

Thread: Arduino MIDI Library 4.2 - 2 x 2 Midi Interface thru / merge

Threaded View

  1. #1
    Senior Member adrian's Avatar
    Join Date
    Oct 2015
    Wellington, NZ

    Arduino MIDI Library 4.2 - 2 x 2 Midi Interface thru / merge


    I was wondering how to use the Midi Library with 2 separate serial interfaces on teensy 3.2, and it turns out that the Arduino MIDI Library 4.2 is all set up for that! So I downloaded it and put it in the teensy AVR library folder, and tried out one of the examples:
    #include <MIDI.h>
    // This example shows how to create two instances of the library to create a merger.
    // There are two MIDI couples of IO, A and B, each using thru and merging with the
    // input from the other node. The result is the following:
    // A out = A in + B in
    // B out = B in + A in
    MIDI_CREATE_INSTANCE(HardwareSerial, Serial1,     midiA);
    MIDI_CREATE_INSTANCE(HardwareSerial, Serial2,     midiB);
    void setup()
      // Initiate MIDI communications, listen to all channels
    void loop()
      if (
        // Thru on A has already pushed the input message to out A.
        // Forward the message to out B as well.
      if (
        // Thru on B has already pushed the input message to out B.
        // Forward the message to out A as well.
    It compiled!

    Unfortunately, I don't have my teensy midi hardware setup running right at the moment (there are not enough hours in the day), but I'm putting it back together for a project, so I'm not going to futz around with other serial solutions ... So, untested, but interesting !

    The 4.2 library is different from the 3.2 library I have been using in that under 4.2 you have to use a macro to institute an instance, and it would appear that midi mirroring / thru is turned on by default (what appears at the RX is mirrored out of the TX.... ) but I am yet to confirm that for real.

    Apologies if this is all old news.
    Last edited by adrian; 01-13-2016 at 01:32 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts