0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« on: February 10, 2011, 03:10:17 am » |
G'day, Is it possible to use NewSoftSerial so that another pin(port) for the MIDI signal in the MIDI library is used. Tks
|
|
|
|
|
Logged
|
|
|
|
|
Rockford,IL
Offline
Newbie
Karma: 1
Posts: 27
|
 |
« Reply #1 on: February 10, 2011, 06:23:03 am » |
Is it possible to use NewSoftSerial so that another pin(port) for the MIDI signal in the MIDI library is used.
Is there a MIDI library? And don't you only use port 1 (TX) port for outputting MIDI? What port would you rather use?
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9393
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #2 on: February 10, 2011, 06:46:43 am » |
Looking at the NewSoftSerial.cpp file it has an entry for 31250 baud in its tables which is IIRC the MIDI speed. Start/stop/parity bits unkown.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #3 on: February 10, 2011, 11:55:42 am » |
Not sure if I explained my problem correctly. The MIDI library uses digital pins 0 & 1 and I want to use pins 8 & 9. The command MIDI.begin() does not give you the option of altering the serial port, and am hoping that NewSoftSerial library can be used to achieve this. Can this be done.
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9393
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #4 on: February 10, 2011, 12:03:28 pm » |
Do you have an URL to the MIDI library to peek into the code?
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25494
Solder is electric glue
|
 |
« Reply #5 on: February 10, 2011, 12:50:09 pm » |
The MIDI library uses digital pins 0 & 1 Yes that is because it uses the hardware serial connections. To make the library use the softwa serial routines you will have to hack it so that all the references to the serial port now refer to the software serial commands.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #6 on: February 10, 2011, 04:21:34 pm » |
Rob, Am using theV2.5 MIDI library from the playground http://www.arduino.cc/playground/Main/MIDILibrary. Will now start to look at how to hack it.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #7 on: February 10, 2011, 09:18:10 pm » |
Is it possible to use pin 1 (TX) to communicate with the USB and Pin 0 (Rx) to accept MIDI inputs. That way I can use to use the existing MIDI library. I need to use the USB port to send the MIDI date so that I can read it on the PC.
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25494
Solder is electric glue
|
 |
« Reply #8 on: February 11, 2011, 05:03:10 am » |
Is it possible to use pin 1 (TX) to communicate with the USB and Pin 0 (Rx) to accept MIDI inputs. That way I can use to use the existing MIDI library. No you can't run the hardware at different baud rates.
|
|
|
|
|
Logged
|
|
|
|
|
Netherlands
Offline
Tesla Member
Karma: 90
Posts: 9393
In theory there is no difference between theory and practice, however in practice there are many...
|
 |
« Reply #9 on: February 12, 2011, 06:38:52 am » |
@OzGrant Had a quick view in the midilib and somewhere in the top of the CPP file there is #define UART Serial which is used through the code as Serial port.
Quick hack: - include the NSS library, - declare an instance of NSS e.g. MidiSerial - do a global search/replace of UART with MidiSerial
Better: - accept param TX and RX in the constructor (default 0 & 1 to be BW compatible) - if 0 and 1 => use hardware serial - if other pinnr's => use NSS
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #10 on: February 12, 2011, 02:51:58 pm » |
Rob, Yup found that declare, so will give it a shot. Haven't done this level of program altering in a library, so it should be interesting. Thanks for the pointer.
|
|
|
|
|
Logged
|
|
|
|
|
Southern Ontario
Offline
Sr. Member
Karma: 2
Posts: 279
Arduino rocks
|
 |
« Reply #11 on: February 12, 2011, 03:36:25 pm » |
I haven't really dug into the code, but I am using the Midi library (notice that it is not all-caps) from here: http://timothytwillman.com/itp_blog/?page_id=240You initialize the class using: Midi midi(Serial); So it should be as simple as passing in your nss object to the midi constructor... (i also find this midi library much more versatile for midi-input)..
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #12 on: February 12, 2011, 05:56:04 pm » |
Timothy, Looks like your MIDI Lib is what I'm after. Down loaded it (the tgz extension ended up as a .tar) but my winzip ver 14.5 gave me the msg "Error reading header after processing 0 entries" Does this mean WinZip does not do tar files or is something else required. Grant
|
|
|
|
|
Logged
|
|
|
|
|
Southern Ontario
Offline
Sr. Member
Karma: 2
Posts: 279
Arduino rocks
|
 |
« Reply #13 on: February 13, 2011, 03:28:14 am » |
I used izarc without issues... it's free and imo better than winzip
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 64
Arduino rocks
|
 |
« Reply #14 on: February 13, 2011, 06:08:39 am » |
Tks Nick (got the name correct this time) Downloaded the Lib Ok and unzipped with IzArc. So will now see if I can use the other port.
|
|
|
|
|
Logged
|
|
|
|
|
|