MIDI to USB converter

Hello, I have searched, but either don't find the solution I'm looking for, or find overly complex projects.
Possible what I want isn't as easy as I hope?

I would like to use a Arduino Leanardo to accept data from a MIDI music keyboard, and send to a PC via the USB port. Just that.

Sounds simple, but is that not the case?

Many thanks in advance,
Paul

You can use this example from the Control Surface library: MIDI_Pipes-Routing.ino

You can leave out the line that loops back the USB MIDI interface to itself.

Pieter

would like to use a Arduino Leanardo to accept data from a MIDI music keyboard, and send to a PC via the USB port. Just that.

What sort of interface does the MIDI keyboard present?
If it is USB then no you can’t do it with a Leonardo. If it is a 5pin DIN plug ten you can.

Assuming the MIDI keyboard has DIN connectors, search amazon or ebay for "midi to usb adapter". No Arduino required.

Try a really simple solution first. Assuming the keyboard has DIN connector, hook it up like this but connect midi pin 5 to arduino pin 2 instead.

In the Arduino IDE, select Tools -> USB Type -> MIDI (not sure it is available for Leonardo).

Use this simple code. It simply pipes received serial midi on pin 2 to standard serial on the USB:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
  Serial.begin(31250);
  mySerial.begin(31250);
}

void loop() 
{
  if (mySerial.available())
    Serial.write(mySerial.read());
}