There's probably a list out there -- but I haven't found it -- that shows which Arduinos can emit MIDI commands out through their USB port. One site said that Arduino boards with a particular chip (16U2 ?) can do that.
I've got an ATmega2560 R3. It can send out MIDI commands via a serial pin. My keyboard has a 5-pin DIN and it plays the notes sent to it by the Mega (I had to cut one end off the Din-to-Din cable to plug into Arduino Mega's pin 1(TX), GND, and 5V to do that, no problem). Now, I want to send those notes to a software program on my Windows 10 computer.
How do I get the MIDI signals output by the Mega into the computer's USB port?
Yes you can. Check out my MIDI Controller library. The ReadMe has installation instructions for the Mega, to flash custom firmware to the ATmega16U2.
There's also a page on the Wiki (or in the 'doc' folder) that explains how MIDI over USB works on different Arduino boards.
How do I get the MIDI signals output by the Mega into the computer's USB port?
Just send it as a high speed serial signal and have a helper application on the computer called Hairless that creates a virtual MIDI port from the serial data.
Or have a USB / MIDI cable and wire that to the digital serial serial output through a driver.
Grumpy_Mike:
Just send it as a high speed serial signal and have a helper application on the computer called Hairless that creates a virtual MIDI port from the serial data.
Or have a USB / MIDI cable and wire that to the digital serial serial output through a driver.
For a permanent, finished project, HIDuino is much more convenient, IMHO. You can just plug it in and it shows up as a MIDI device, you don't have to launch an extra application, and you don't need to spend another $30 on a USB MIDI interface.
and you don't need to spend another $30 on a USB MIDI interface.
Sure they used to be that ten years ago but now they are just $5.
But the OP asked about a Mega.
If all processors are up for grabs than the Arduino Leonardo, or Micro can do the same thing with an official Arduino.
Agreed, using a Leonardo, Micro or Due would be a better idea, because of the USB support in the main MCU.
But of all choices you have on a Mega, I think that HIDuino is the least cumbersome.
There's a lot of "brainy" stuff here, thanks. I am confined to using a Mega, so I took the "easy" route and ordered a MIDI-to-USB interface for $7 USD. If that fails to work, I'll learn the other routes. Thanks to all, a special thanks to Grumpy_Mike (that's twice you've save the day for me)!
ronart:
There's a lot of "brainy" stuff here, thanks. I am confined to using a Mega, so I took the "easy" route and ordered a MIDI-to-USB interface for $7 USD. If that fails to work, I'll learn the other routes. Thanks to all, a special thanks to Grumpy_Mike (that's twice you've save the day for me)!
7 USD interface is very bad (i have try one and when i use bender or Sysex messages fail and whe get random notes)...you need spend around 30 USD for get a decent midi interface.
I have made a midi interface with 6N138 opto-coupler and i use Midi library + hiduino on a arduino One and i get all messages/notes/bender correctly on PC side, and is recognised how a native Midi interface from PC with Win 7 64 bit (so plug and play).
Problem now is get notes/messages back from PC to midi keyboard (a old Roland D10)...i try various configuration with MIDI_CREATE_CUSTOM_INSTANCE(HardwareSerial, Serial, MIDI, MySettings); but for now i dont get none back to midi keyboard...is not so important for me because i just need send notes/velocity/ eventually pot or key from arduino to PC and all is processed from Cubase+vst plugins, but my goal is try made a complete 2 way midi interface, so i am fighting with bad hepl of midi library and the 1 only serial of arduino One.
I see RX led flash on arduino when i send note/message back from PC, but none reach my Roland D10.
If i play notes from arduino to Roland all work, so is no a connection/midi interface problem...is a problem of midi library that receive message but not sent to midi keyboard.
If any get same problem and found a solution is allowed.
Ty
Grumpy_Mike:
Rubbish, you don't. You can get decent ones for £5.00.
You have try send patch dump of all midi keyboard memory?
You see comments on Amazon store or others stores about 7 USD interfaces?...yes is ok if you play just notes, but if you try use also pitch bender you get a lots of fail messages...no words about sysex messages...
Need a fast opto-coupler if you dont want lost data or get latency...and this entry-level midi interface dont use em.
You say: "This is not a problem with the MIDI library, you must have something else wrong."
I reply: i have solved problem 1 hour ago when i see this library:
and now my Arduino Uno work in all 2 way PC-arduino-midi interface-midi keyboard and back...problem is that Midi Library receive data from PC (RX led flash) but not send none to midi interface/midi keyboard.
Probably with MIDI_CREATE_CUSTOM_INSTANCE can configure your hardware to work in all 2 direction?
But documentation about commands is very poor...i have try email to programmer but no reply...so bye bye
..and sorry for bad english
i buy this : https://www.ebay.it/itm/162010979814?ViewItem=&item=162010979814
and when i move pitch bender i get lots of random notes...and same with sysex memory dump...so a useless midi interface.
I see same problem on lots of people that buy similar interface, just see comments on any market.
Lost data yes, latency no. You don’t seem to understand hardware.
If data is transmitted with low speed (because opto-coupler is slow) you get also latency because serial buffer is full when keyboard try send more data
Gabryx:
If data is transmitted with low speed (because opto-coupler is slow) you get also latency because serial buffer is full when keyboard try send more data
That's bullshit. The MIDI data rate is fixed at 31250 baud. If your optocoupler is too slow, you get bit errors, but the latency does not change. It has nothing to do with buffer sizes.
when i move pitch bender i get lots of random notes...and same with sysex memory dump...so a useless midi interface.
NO you have useless software, if the interface is good for note on and off it is good for all commands. You clearly don’t understand hardware and so when something goes wrong you blame it on the thing you don’t understand. The interfaces I use look like that one and they work. The fact that others make the same stupid comments mean that they don’t understand what is going on either.
Converting SysEx MIDI messages to USB MIDI messages is not as straightforward, so you might run into some problems if the firmware is really, really bad (but I doubt that's the case).
As Mike said, if it can handle Note On/Off events, it should handle Pitch Bend events as well.
Grumpy_Mike:
NO you have useless software, if the interface is good for note on and off it is good for all commands. You clearly don’t understand hardware and so when something goes wrong you blame it on the thing you don’t understand. The interfaces I use look like that one and they work. The fact that others make the same stupid comments mean that they don’t understand what is going on either.
Clap clap !!
i use same softare from years with various midi interfaces...i have also a pseudo sound blaster with driver unsigned (so i need start win 7 64 in compatibilty mode for use em, and is for this that i have buy this bad midi interface...i have try...but not work correctly) and all signals go ok in 2 way with pseudo sound blaster, but is annoyng start windows in mode for drivers unsigned, so i have try with arduino...now all work ok with USBMidiKliK bootloader and same software, so problem of low cost midi interface is just poor hardware.
You say " if the interface is good for note on and off it is good for all commands" i reply NO...because a note is just some bytes to transmit, but when you move bender is lots of data in little time that need reach target and if hardware is slow, you cannot get all data...and same when you try backup banks of keyboards with sysex..so is a useless interface...
i reply NO...because a note is just some bytes to transmit, but when you move bender is lots of data in little time that need reach target and if hardware is slow, you cannot get all data...
As I have said before you simply do not understand hardware. The conclusion you make from the symptoms you see are simply not valid.
As your mind appeared closed either learn how hardware works or learn a lot more about your software.
You can't say that when Note on /off work , SYSEX and all others messages (e.g. NRPN) will work !
Cheap interfaces are pure SH..... like this one :
It understands note on / note off only, generates random notes when heavy traffic, do not understand NRPN, MTC, or SYSEX at all, and are dangerous for your device, because many don't implement the opto MIDI IN part. Read that :
You can use USBMidiKlik USB midi converter with your ATmega2560 R3 if it's USB is managed by an ATMEGA8U2 (and not the CH340G).
Like this one :
USBMidiKlik is a dual serial CDC /midi boot loader, allowing updates of the Arduino sketch without reloading each time the Arduino standard bootloader. When you connect the specific pin to ground, the Arduino boots in serial mode.