MIDI plus USB serial

G'day, I want to send a MIDI command via the USB and then send it out as a MIDI signal. The MIDI lib used pin 0 and 1, as does the USB port. Is there a way around this? Even a hardware solution would be welcomed.

There's a MIDI driver that takes MIDI Data from any Serial port. Since the Arduino sends Serial info via USB too, you could just use that driver and all is done. Just need to google for it, as I don't recall the name, sorry.

Wk

Have three different MIDI lib's all use tx/rx pins. Have another guy blending in NewSoftwareSerial Lib, but he has not finished yet. So now want to try a Hardware solution, use a FET to switch between the usb chip and the MIDI signal. Was hoping someone had done this already.

Getting MIDI into a PC or Mac through the USB port
http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html

Grumpy_Mike: Getting MIDI into a PC or Mac through the USB port http://www.spikenzielabs.com/SpikenzieLabs/Serial_MIDI.html

I have not tried that way because I saw this about it:

Lag times may be too long for some uses approximately 26ms (see below).

26 ms is just was to long for me.

I have not tried that way because I saw this about it

So you believed this without any further details?

The latency will depend on the computer that implements it, so it is a bit rash to make a blanket condemnation of the whole system without further details. See if it works for your setup.

26 ms is just was to long for me.

Is this a real requirement or specmanship?

The latency will depend on the computer that implements it, so it is a bit rash to make a blanket condemnation of the whole system without further details. See if it works for your setup.

Grumpy_Mike:

I have not tried that way because I saw this about it

So you believed this without any further details?

The latency will depend on the computer that implements it, so it is a bit rash to make a blanket condemnation of the whole system without further details. See if it works for your setup.

26 ms is just was to long for me.

Is this a real requirement or specmanship?

Well, I wasn’t saying that nobody should try it. I will give it a try this week just to see.
Yes, <26ms is a requirement in my MIDI controller application. But for others it may not be that big of a deal.

Low latency audio via usb serial can be achieved with a realtime kernel.

http://www.linuxjournal.com/video/hyper-low-latency-audio-real-time-kernel

Hope it helps.

Have fun.

I recently added USB MIDI to Teensyduino. It requires a AVR chip with native USB, like the one on Teensy. Regular Arduino doesn't have this, unless you try using the 8u2 chip on Uno (which probably doesn't have enough memory, but if you compile for Teensy 1.0 and get a .HEX file under 4k, it might work). If you have a compatible board, you should get latency of 1ms or less, and lots of bandwidth, since it's direct 12 Mbit/sec USB. There's a send_now() function which forces any buffered data USB packet to be immediately made available to the USB host controller. If you don't call send_now() after sending MIDI messages, the packet gets sent within the next 1ms USB frame.

This USB MIDI code is pretty new. A few people have used it with success, and I sent and received a bunch of messages to/from Puredata. If you give it a try, please let me know how it works for you.

The 26 ms is mostly from the Garage Band ->audio drivers->audio hardware part of the signal chain. I would actually consider that good for a stock audio interface, trying to control a virtual instrument in real time.

I am building a MIDI encoder out of an Uno, and I could use a direct USB connection to a computer. I may have to test this out, I really don't like how slow standard MIDI is :P

I really don't like how slow standard MIDI is

The use OSC - MIDI has been around for more years than I care to remember and it was obsolete 15 years ago. Problem is it is so simple and so ubiquitous.

Grumpy_Mike:

I really don't like how slow standard MIDI is

The use OSC - MIDI has been around for more years than I care to remember and it was obsolete 15 years ago. Problem is it is so simple and so ubiquitous.

Yes, I have been using MIDI professionally since 1985. It is amazing that the hardware manufacturers agreed to any standard at all. There have been many attempts to 'update' it (MIDI II, etc...) and the manufacturers are reluctant. It is what it is. :)

if it a serious trouble for use about using Serial AND Midi, you just have to upgrade to Arduino Mega ! It will allow you to use until 4 serial devices. So from with one Midi I/O and with one Serial, you will get two serial left. Arduino Mega isn't so expensive !

Best regards

Grag38

You could also use Teensy, at $16, which uses native USB for very fast Serial.print(), and completely separate serial port you can use for MIDI.

It also has USB MIDI, and can do Serial.print() to the serial montitor window while sending MIDI at USB speed (in that mode it acts as a USB multifunction device for 2 communication channels on a single USB), and those are both separate from the serial port, so you can simultaneously send/receive MIDI there there too. But there is only 1 serial port capable of 31250 baud MIDI, so if you want 2 actual serial ports, Arduino Mega and Sanguino are the only choices.

For full disclosure, I am involved with PJRC and Teensy.

I was playing around with a code another user contributed, and created a VST plugin that reads the Serial data from our Beat707 unit and outputs Midi Notes. It works perfectly. Now I can also do a .exe app that does the same. Right now I'm doing it oriented to Beat707, but the idea is to make it open-source and based on Juce, so anyone can use it for their arduino midi projects without the need of a midi interface.

Wk

WilliamK: I was playing around with a code another user contributed, and created a VST plugin that reads the Serial data from our Beat707 unit and outputs Midi Notes. It works perfectly. Now I can also do a .exe app that does the same. Right now I'm doing it oriented to Beat707, but the idea is to make it open-source and based on Juce, so anyone can use it for their arduino midi projects without the need of a midi interface.

Wk

That would be VERY useful WilliamK. :)

Here's a quick video of energyXT loading the VST file that connects to Beat707 via the USB cable. No MIDI devices were used for this example, but Beat707 is sending regular MIDI data via the Virtual Serial connected thanks to the FDI chip. Resuming: no hardware or software changes. (at least no big software changes)

http://www.youtube.com/watch?v=l0JL9lz6kvI

During the Beat707 startup, it starts at 57600bps, sends 4 bytes of a code to the serial output, waits 1 second, and if nothing is received, it re-starts the serial port at 31250bps and enables the midi connection.

The VST file checks all Serial ports, for each port, it waits 2 seconds, so the Arduino has time to reboot and send that 4 bytes of code above, and if the code the VST reads is ok, it sends an OK message back so the Arduino goes to USB mode. After that, they "talk" to each other. ;-)

Wk

That looks great!!!! Please announce it in this forum when you release the VST. I would love to give it a try!!! :)

The code is pretty much done, I just posted in a new thread.

http://arduino.cc/forum/index.php/topic,58334.0.html

Now I need to figure out the Stand-Alone version. ;-)

Wk