Midi, linux and Reaper

setup : board : Arduino UNO, OS : linux POP Os, Daw : Reaper

Hi People,

I am a little confuse with some midi library and arduino.

I try some libraries and some example, the one that seems made for my setup is "UHS2-MIDI", i tried some example code, in reaper, I see "midi through" as midi device but my arduino board receive nothing from the daw and the daw receive nothing from the arduino board.

If i try with my casio midi keyboard (connected to the pc via usb) I can send and receive notes to the daw without any issues. And if i look in the QjackCtl graph, "midi-through" is connected to reaper the same way my casio keyboard is connected.

the code that i use :

#include <UHS2-MIDI.h>

// Simple tutorial on how to receive and send MIDI messages.
// Here, when receiving any message on channel 4, the Arduino
// will blink a led and play back a note for 1 second.

USB Usb;
UHS2MIDI_CREATE_DEFAULT_INSTANCE(&Usb);
int a = 0;
String test = "";

void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  MIDI.begin(4);                      // Launch MIDI and listen to channel 4

  if (Usb.Init() == -1) {
    while (1); //halt
  }//if (Usb.Init() == -1...
  delay( 200 );
  Serial.begin(115200);
  Serial.println(Usb.getUsbTaskState());
  
}

void loop()
{
  Usb.Task();
  //digitalWrite(LED_BUILTIN, HIGH);
    MIDI.sendNoteOn(42, 127, 1);    // Send a Note (pitch 42, velo 127 on channel 1)
    delay(100);                // Wait for a second
    MIDI.sendNoteOff(42, 0, 1);     // Stop the note
    //digitalWrite(LED_BUILTIN, LOW);
    delay(100);  
  
  //Serial.println(MIDI.read());
  if (MIDI.read())                    // If we have received a message
  {
    Serial.println("midiread");
    digitalWrite(LED_BUILTIN, HIGH);
    MIDI.sendNoteOn(42, 127, 1);    // Send a Note (pitch 42, velo 127 on channel 1)
    delay(100);                // Wait for a second
    MIDI.sendNoteOff(42, 0, 1);     // Stop the note
    digitalWrite(LED_BUILTIN, LOW);
  }
}

I have to install something more to make it run ? I use the wrong library, It is not possible to use arduino as a midi device?

My goal is to pilot some modular synth with my daw and i want to use the arduino as interface between my daw and the modular synth.

Thanks a lot.

No, that's not the right library (it's meant for a USB Host shield, you need the Arduino to act as a USB Device). The Arduino Uno does not support MIDI over USB natively, see Control Surface: MIDI over USB for details and alternatives.

"midi-through" is a virtual MIDI port of your operating system, it is not the Arduino.

Ok, so I don't need to buy an another arduino board, that's great. I will try to update the firmware of one of my board. I hope it will work. Thanks for the link and the help :slight_smile:

Do keep in mind that this is a very cumbersome process, because once you upload the MIDI firmware, you can no longer upload new sketches to the Arduino unless you restore the original firmware.

If it's within your budget, getting a board with native MIDI over USB support will be much more convenient.

Ok ok.... I saw that on the doc you gave me. What board do i need for that? If I look on this link : MIDIUSB - Arduino Reference I see that the library is compatible with the uno but It's not working so how can I find the correct board for that?

thanks

The compatibility list on that page is meaningless, it is automatically generated without taking into account the actual hardware capabilities of those boards:

Note: while the library is supposed to compile correctly on these architectures, it might require specific hardware features that may be available only on some boards.

You can use any of the boards in the table of the MIDI over USB page I linked to. Which one you pick depends on the specifics of your project.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.