Pages: [1] 2   Go Down
Author Topic: MIDI Serial Port  (Read 4487 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,
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 Offline
Newbie
*
Karma: 1
Posts: 27
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14024
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14024
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do you have an URL to the MIDI library to peek into the code?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 Offline
Jr. Member
**
Karma: 1
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 1
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Brattain Member
*****
Karma: 639
Posts: 34725
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14024
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

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 Offline
Sr. Member
****
Karma: 2
Posts: 279
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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=240

You initialize the class using:
Code:
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 Offline
Jr. Member
**
Karma: 1
Posts: 64
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 2
Posts: 279
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I used izarc without issues... it's free and imo better than winzip
Logged

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

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

Pages: [1] 2   Go Up
Jump to: