[comp.sys.ibm.pc.hardware] MIDI

cs161fhn@sdcc10.ucsd.edu (Dennis Lou) (11/12/90)

On my room mate's Amiga, he plugs a little box into his serial port
and voila! he's got MIDI in, out, and thru.  Looking at the
schematic, the box consists of a hex inverter and an optoisolator.
On the RS-232 end, it only uses pins 2,3,7 and a +5V line (which is
routed through 19 or 21).

Why can't you do this on an IBM?  What does the Roland MPU-401 
have that a modified serial interface doesn't?  What does the 
Amiga serial interface have that the IBM's doesn't?  Can you 
roll your own sequencer/notation package using the serial port adapter?

(please, let's not start a processor/architecture war here :-)

-- 
Dennis Lou               | "But Yossarian, what if everyone thought that way?"
dlou@ucsd.edu            | "Then I'd be crazy to think any other way!"
[backbone]!ucsd!dlou     +----------------------------------------------------
dlou@ucsd.BITNET cs161fhn@sdcc10.ucsd.edu        | Woz went to my high school.

dgold@basso.actrix.co.nz (Dale Gold) (11/13/90)

Quoted from - cs161fhn@sdcc10.ucsd.edu (Dennis Lou):
> On my room mate's Amiga, he plugs a little box into his serial port
> and voila! he's got MIDI in, out, and thru.
> [...]
> Why can't you do this on an IBM?  What does the Roland MPU-401 
> have that a modified serial interface doesn't?  

A friend of mine has built an IBM interface based roughly on my homemade
Amiga box. The problem is that all (?most?) of the good IBM software
is designed for the MPU-401, which has a lot of built-in features. Don't
ask me what they are! :-) My friend is going to write his own s/ware, so
for him, it's not a problem.

> What does the Amiga serial interface have that the IBM's doesn't? 

Basically, nothing. My old A1000 has a source of power through the serial 
port - I think this was eliminated in the 500-3000 range. Otherwise, 
there's nothing unusual in the Amiga port.

> (please, let's not start a processor/architecture war here :-)
> 
No way, mate!

Cheers, Dale 
--
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  |                              |    Critics can't even make     |
  |  dgold@basso.actrix.co.nz    |  music by rubbing their back   |
  |                              |  legs together. - Mel Brooks   |
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

herbie@bruce.cs.monash.OZ.AU (Andrew Herbert) (11/14/90)

In <4840.tnews@basso.actrix.co.nz> dgold@basso.actrix.co.nz (Dale Gold) writes:

[talking about rs-232 to midi interfaces]
>A friend of mine has built an IBM interface based roughly on my homemade
>Amiga box. The problem is that all (?most?) of the good IBM software
>is designed for the MPU-401, which has a lot of built-in features. Don't
>ask me what they are! :-) My friend is going to write his own s/ware, so
>for him, it's not a problem.
>[...]

Isn't there a problem getting an ibm serial port to spit out 31.25kbps
as required by midi?

Andrew

hd7x@vax5.cit.cornell.edu (11/14/90)

In article <3341@bruce.cs.monash.OZ.AU>,
herbie@bruce.cs.monash.OZ.AU (Andrew Herbert) writes:
> Isn't there a problem getting an ibm serial port to spit out 31.25kbps
> as required by midi?

No... serial ports on most IBM compatibles can communicate at up to 115.2kbps,
despite IBM's claims to the contrary.  Certain IBM PS/2's have buggy UART
chips, limiting them to 57.6kbps.  In either case, they would be able to handle
the 31.25kbps.
-Sanjay Aiyagari(hd7x@vax5.cit.cornell.edu)

rzi@philpav.tds.philips.se (Roman Zielinski) (11/14/90)

In article <4840.tnews@basso.actrix.co.nz>, dgold@basso.actrix.co.nz (Dale Gold) writes:
> Quoted from - cs161fhn@sdcc10.ucsd.edu (Dennis Lou):
> > [...]
> > Why can't you do this on an IBM?  What does the Roland MPU-401 
> > have that a modified serial interface doesn't?  
> > [...]

A simplest MIDI-interface can be built as an UART plus opto-isolator
working in 31kb/s speed.
Normal UARTs in PCs can work up to 19.2kb/s (You can force them to higher 
speeds, but.... what happens if your CPU will be too busy to handle all
interrupts from UART?)

MPU401 is a Motorola 6800-based system (not just an UART shifting out/in data
to/from the line). It is very clever card performing all timing work. It also
keeps track on measures, tempos, metronome bit, etc

MPU and application use a handshaking protocol so you can transfer
data and events in both directions simultanously.

For example, from application you send events tagged with time-to-next event,
like:
	time-to-next-event <event> <event-data>

	05	ch=1 tone-on tone velocity
	25	ch=2 tone-on tone velocity
	36	ch=5 program-change prog
	55	ch=1 tone-off tone
		measure
		measure
	01	ch=2 tone-off tone

Due the timing facilities the application can work quite asyncronously to
the hardware, and it cannot be done with a pure UART system.

Roland has a techn spec for $5-10, it is about 70-80 pages...

+-------------------------------------------+           _--~--_
| Roman M. Zielinski                        |   ----   /       \   ----
| Philips Tele & Data System AB             |  ----   (  |^^^|  )   ----
| S-115 84 Stockholm, Sweden                |   ----   \  \ /  /   ---
| tel +46 8 782 1373                        |           |=====|
+-------------------------------------------+           |=====|
| NET ADDR:  rzi@pav.tds.philips.se         |           |=====|
+-------------------------------------------+            ~~U~~

helin@vehka.uta.fi (Mikko Helin) (11/14/90)

In article <505@philpav.tds.philips.se> rzi@philpav.tds.philips.se (Roman Zielinski) writes:

>
>MPU401 is a Motorola 6800-based system (not just an UART shifting out/in data
>to/from the line). It is very clever card performing all timing work. It also
>keeps track on measures, tempos, metronome bit, etc
>

MPU401 can't handle Song Position Pointers (SPPs), so the only way is to
use MPU in UART mode. All sequencer software that is claimed to understand
SPPs does this. In my opinion, Voyetras VAPI is better standard than MPU401
in IBM compatibles (I mean software drivers). 

By the way, has anybody there  written VAPI driver for modified 
RS-232 card or knows something about it? Plese tell us others!

>
>Due the timing facilities the application can work quite asyncronously to
>the hardware, and it cannot be done with a pure UART system.
>

It has been done anyway.

--------------------------------------------------------------
MIKKO HELIN
FINLAND

INET: helin@vehka.uta.fi
--------------------------------------------------------------

jones@sdd.hp.com (Christopher Jones) (11/15/90)

In article <4840.tnews@basso.actrix.co.nz> dgold@basso.actrix.co.nz (Dale Gold) writes:
>Quoted from - cs161fhn@sdcc10.ucsd.edu (Dennis Lou):
>> On my room mate's Amiga, he plugs a little box into his serial port
>> and voila! he's got MIDI in, out, and thru.
>> [...]
>> Why can't you do this on an IBM?  What does the Roland MPU-401 
>> have that a modified serial interface doesn't?  
>
>A friend of mine has built an IBM interface based roughly on my homemade
>Amiga box. The problem is that all (?most?) of the good IBM software
>is designed for the MPU-401, which has a lot of built-in features. Don't
>ask me what they are! :-) My friend is going to write his own s/ware, so
>for him, it's not a problem.
>
>
>Cheers, Dale 


I've also designed and built an IBM-Midi interface which 
"uses" the serial port to operate.  Uses in quotes, because
I'm not using the IBM serial port's hardware, but rather
its COM2 port address and protocol.  The interface card
connects directly to the XT bus, and employs a 12MHz 
8051 microcontroller to UART and timestamp MIDI data.  

I realize that this isn't exactly what Dennis was talking 
about, but in order to accomplish that (as someone has mentioned),
you'd have to change the oscillator on the IBM serial port's
hardware, or build an intelligent serial<--->serial converter,
perhaps with the MCS-51 chip.



/ctj

bmarsh@cod.NOSC.MIL (William C. Marsh) (11/15/90)

In article <1990Nov14.052315.988@vax5.cit.cornell.edu> hd7x@vax5.cit.cornell.edu writes:
>In article <3341@bruce.cs.monash.OZ.AU>,
>herbie@bruce.cs.monash.OZ.AU (Andrew Herbert) writes:
>> Isn't there a problem getting an ibm serial port to spit out 31.25kbps
>> as required by midi?
>
>No... serial ports on most IBM compatibles can communicate at up to 115.2kbps,
>despite IBM's claims to the contrary.  Certain IBM PS/2's have buggy UART
>chips, limiting them to 57.6kbps.  In either case, they would be able to handle
>the 31.25kbps.

However, the 8250's (and their offspring) have a built in baud rate generator,
which, unfortunatly, can not generate 31.25K 'baud'.  So, No, there isn't a
problem with the UARTS working faster (at least on faster machines) than
19.2K baud, but Yes, there is a problem generating 31.25K baud for MIDI.

Also, a different timer chip is really required to accuratly time musical
events.

Bill
-- 
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If you are not part of the solution, you're part of the problem..."

pete@wlbr.IMSD.CONTEL.COM (Pete Lyall) (11/15/90)

Actually, I use Sequencer Plus MKIII with an OP-4001 and it syncs very
nicely to Song Position Pointers. I understand that it cannot digest
MTC (Midi Time Code.. an addition to the MIDI SPEC that MIDI-fies
SMPTE frame data)...

Pete

-- 
Pete Lyall                                                   Contel Corporation
Compuserve: 76703,4230              OS9_Net: (805) 375-1401 (24hr 300/1200/2400)
Internet: pete@wlbr.imsd.contel.com     UUCP: {hacgate,jplgodo,voder}!wlbr!pete 

dickw@cnps.PHILIPS.nl (Dick Wiersma) (11/15/90)

> In article <3341@bruce.cs.monash.OZ.AU>,
> herbie@bruce.cs.monash.OZ.AU (Andrew Herbert) writes:
> > Isn't there a problem getting an ibm serial port to spit out 31.25kbps
> > as required by midi?

> No... serial ports on most IBM compatibles can communicate at up to 115.2kbps,
> despite IBM's claims to the contrary.  Certain IBM PS/2's have buggy UART
> chips, limiting them to 57.6kbps.  In either case, they would be able to handle
> the 31.25kbps.
> -Sanjay Aiyagari(hd7x@vax5.cit.cornell.edu)

I can't remember how the IBM serial port gets its UART clock frequency but I
do remember that most UART have some built-in divider to obtain its internal
clock frequency from a crystal frequency. This divider (in most cases) is an
ordinary 2^x divider.
By choosing an appropriate crystal frequency they are able to let the UART
"talk" the standard Baud rates like 300, 600, 1200, 2400, 4800, 9600, 19200
and 38400.
When this is also the case in the IBM PC you can forget speeking 31250 which
would be needed for MIDI.

Any suggestions however are welcome.
Did any one try the "serus" serial driver for this? It appeared a week or so
ago in the binaries newsgroup.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Dick Wiersma         | Ned. Philips Bedrijven B.V.    | dickw@cnps.philips.nl
Philips C&P services | Postbus 218                    |    Tel.: (040-7)32354
VA-23                | 5600 MD  Eindhoven             |    Fax.: (040-7)35940

kris@beep.UUCP (Port'naybl) (11/17/90)

In article <2464@cod.NOSC.MIL>, bmarsh@cod.NOSC.MIL (William C. Marsh) writes:

 >However, the 8250's (and their offspring) have a built in baud rate generator,
 >which, unfortunatly, can not generate 31.25K 'baud'.  So, No, there isn't a
 >problem with the UARTS working faster (at least on faster machines) than
 >19.2K baud, but Yes, there is a problem generating 31.25K baud for MIDI.

     If I remember correctly, the 8250 baud rate generator is just a 16-bit
counter/divider.  I you feed 3MHz square wave into it, a divisor of exactly
96 will get you 31.25Kbits/sec.  Of course this is assuming your SIO clock
is 3MHz, otherwise the divisor would have to modified to fit.

     My apologies if I've stepped on any toes, but I wanted to mention this.
There is a UART, a 2681 I believe, that has its data rates limited to the
"standard" ones and won't do 31.25Kbits/sec.

-- 
						Port'naybl

key!beep!kris
woodowl!beep!kris

"Look what they've done to my program, look what they've done to my code;
 They stuck it all on this floppy disk, and I think they got it wrong, ma..."

david@csource.oz.au (david nugent) (11/18/90)

In <1502@cnps.PHILIPS.nl> dickw@cnps.PHILIPS.nl (Dick Wiersma) writes:

> I can't remember how the IBM serial port gets its UART clock 
> frequency but I do remember that most UART have some built-in 
> divider to obtain its internal clock frequency from a crystal 
> frequency. This divider (in most cases) is an ordinary 2^x divider.

The PC's baud rate divisor is - "strangely enough" - 115200.


> By choosing an appropriate crystal frequency they are able to let 
> the UART "talk" the standard Baud rates like 300, 600, 1200, 2400,
> 4800, 9600, 19200 and 38400.

There are two other possible baud rates between 19200 and 38400. These
are 23040 and 28800; and their corresponding divisors are 0005H and 0004H
respectively.

-- 

        Fidonet: 3:632/348   SIGnet: 28:4100/1  Imex: 90:833/387
              Data:  +61-3-885-7864   Voice: +61-3-826-6711
 Internet/ACSnet: david@csource.oz.au    Uucp: ..!uunet!munnari!csource!david

dgold@basso.actrix.gen.nz (Dale Gold) (11/21/90)

Quoted from - herbie@bruce.cs.monash.OZ.AU (Andrew Herbert):
> In <4840.tnews@basso.actrix.co.nz> dgold@basso.actrix.co.nz (Dale Gold) writes:
> 
> [talking about rs-232 to midi interfaces]
> >A friend of mine has built an IBM interface based roughly on my homemade
> >Amiga box. 
> >[...]
> 
> Isn't there a problem getting an ibm serial port to spit out 31.25kbps
> as required by midi?
> 
I believe so. I know he had to do some fiddling with the clock speed or
something. I'll ask him and post anything useful he might have discovered.

--
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  |                              |    Critics can't even make     |
  |  dgold@basso.actrix.gen.nz   |  music by rubbing their back   |
  |                              |  legs together. - Mel Brooks   |
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

shri@ncst.ernet.in (H.Shrikumar) (11/26/90)

In the discussion on rs232-to-midi interfaces ...
    dgold@basso.actrix.gen.nz (Dale Gold) and
    herbie@bruce.cs.monash.OZ.AU (Andrew Herbert) contribute:

dgold> A friend of mine has built an IBM interface based roughly on my homemade
dgold> Amiga box. 
dgold> [...]

herbie> Isn't there a problem getting an ibm serial port to spit out 31.25kbps
herbie> as required by midi?

dgold> I believe so. I know he had to do some fiddling with the clock speed or
dgold> something. I'll ask him and post anything useful he might have discovered


   I have been thru this stage, so I thought I'd answer this FAQ...

 The standard 8051 (?) Serial interface in the IBM PC, using a 1.84 MHz
Xtal can generate 19.2Kbps or 38.4Kbps. But to get it to generate
the MIDI baud rate, what needs to be done is a "simple" (if you
are adept with a soldering iron) change of the crystal on the serial
interface board to a 1MHz or 2 MHz unit. This will enable the software
to set it to 31250 bps by doing what you'd normally do to set it at
38.4Kbps or 19.2Kbps respectively.

  If the serial clock is generated from the system clock on the
mother board (if serial interface is on mother board) ... then it is
more difficult.

 Having done this, you get a +-12V, 31250 baud serial stream, set to
8bits, no parity. An external box (like the ones with an Amiga) will
convert the +-12Volt to a 5mA current loop for output, and an opto
for the input. Done. This method works, only needs careful soldering.

  Now I have a question ... could some one describe to me what the
Roland MPU-101 looks like ... is it a card you plug into the PC, or
is it a box you connect to a normal RS232 port ?

  If the latter, I am sure you can connect a MPU101 to a SUN or
pretty much any computer, as long as you write the software for it.
Anybody used a MPU101 with anything but an IBM-PC ?

 TIA.

-- shrikumar ( shri@ncst.in )

dvlsan@apollon.cs.umu.se (Stefan Andersson) (11/28/90)

There have been some talk about RS232 <-> MIDI interfacing lately.  To
summarize things so far, the only way to go seems to be replacing the serial
board crystal, in order to get the correct baudrate (31.25 Kbps).  There has
been some indications that it might be possible to do black magic programming
on some serial boards to do this without hardware changes, but, no offense,
I'll have to see that in action to belive it.  However, an idea that strikes
me is: has anybody considered hooking up a MIDI interface to the printer port?
If memory serves, there are enough control lines to get four bit input,
and output is simple enough.  With a bit of luck, the right clock and
some TTL circuits to go serial at a suitable speed, it just might work. 
How does it sound ?

/Stefan

DISCLAIMER: 
	1/	I don't know if an average Centronics is fast enough to handle 
		this without choking.  I have no hard facts to support my idea 
		at the moment.
	2/	English is not my native language, I can imagine it shows :-)