Pages: [1] 2   Go Down
Author Topic: MIDI plus USB serial  (Read 3743 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
 
 
Logged

Brazil
Offline Offline
God Member
*****
Karma: 3
Posts: 616
Wusik Dot Com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged


0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34252
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Quote
Lag times may be too long for some uses approximately 26ms (see below).

26 ms is just was to long for me.
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34252
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
26 ms is just was to long for me.
Is this a real requirement or specmanship?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.

Quote
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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 610
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Southeast Iowa, USA
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-razz
Logged

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 627
Posts: 34252
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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. 
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 17
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.  smiley
Logged

France
Offline Offline
Sr. Member
****
Karma: 2
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
God Member
*****
Karma: 26
Posts: 610
Always making something...
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1] 2   Go Up
Jump to: