[net.music.synth] MIDI and RS232

ach@pucc-h (Stephen Uitti) (02/19/85)

	9600 Baud is indeed 9600 Bits/sec.  Usually, its something like
8 data, 1 start & 1 stop bits.  10 bit times per useful byte.  Thus
9600 baud is 960 cps (Characters per second).  Thus, MIDI is a lot
faster than 19200 baud.  However, a note sent via MIDI takes 3 (8 bit)
bytes (a byte still has the 2 bit overhead, I think).
	MIDI data only gets sent when something happens.  Since you
don't play 6 millisecond trills, the MIDI line tends to be quiet most
of the time.  The main problem with translation to a half speed media
is that timing is a concern.  One byte at 19K baud takes (roughly) half
a millisecond.  MIDI uses three bytes for each note action.  This
translates to 1.5 milliseconds for 19K baud serial.  In chords and
other "simultaineous" events, the inter-note timeing becomes more
important.  The human ear tends to be able to detect differences of
something like 6 milliseconds (if memory serves).
	The three bytes specify velocity and pitch.  When the note is
released, you also specify velocity and pitch.  If you are not
interested in velocity information, then the data that must be sent can
be done with fewer bytes, and thus quicker.  With this sort of
sacrifice (for some instraments, velocity would be ignored anyway), one
can do equally well as MIDI with just a 19K baud serial port.
	A straight translation can be done to 38K baud serial.  There
are UARTS that will let you do this kind of speed.  In fact, normal
UARTS are used for MIDI.  There is then additional hardware to do
opto-isolation.
	Sequential Circuits will sell you a MIDI spec, for $10.00.
It's not a high quality book, but it talks about MIDI in a technical
black-and-white manner.  Unfortunately, I don't have the address
handy.
	Perhaps when I write a review of my Prophet-T8, I'll give the
Sequential address as well.
	Stephen Uitti, UNIX support staff, Purdue Univ. Comp. Center
ps:
	Various buzzwords are copyright/trademarks of various organizations.

david@daisy.UUCP (David Schachter) (02/25/85)

9600 Baud is not necessarily 9600 bits per second (bps).  Baud measures the
number of signal changes per second.  For example, a Vadic 1200 Baud modem
is actually a 1200 bps modem.  The Baud rate is 600 and Vadic puts two bits
(called a dibit) into each signal change (Baud).  9600 Baud modems are
actually 9600 bps modems, transmitting at a much lower baud rate.  (Typically,
they pack three or four bits into each signal change.)

Also, contrary to a previous writer, 9600 bps doesn't necessarily translate
into 960 bytes per second (Bps).  The formula Bps = bps/10 is correct if you
are transmitting 8 bit bytes on an asynchronous link with one start bit and
one stop bit.  On synchronous links, you don't need start and stop bits so
you can send more bytes down the line faster, ignoring certain overhead bits
(which can be noticable if you screw things up.)  Or you can use more stop
bits, thus slowing down the byte rate.  Or you can use statistical data
compression thus sending more useful bytes down the line.  So on and so forth.

In summary, "9600" is usually a bit rate, not baud rate.  The formula Bps =
bps/10 is frequently correct but not always.  It is the special cases caused
by the above words "usually" and "frequently" that cause data communications
to be considered a black art.  (You can make good money at it and you can get
to travel a lot.  To Fremont and Milpitas and Newark and Cleveland and....)
Please be careful in posting data communications related stuff unless you 
really know what you are talking about.  People can waste enormous amounts of
time really easily.  

[The above do not necessarily reflect the views or policy of Daisy Systems,
its employees, or its subsidiaries.  The contents of this posting are the
responsibility of the author who is generally capable of walking and chewing
gum in near-real time.] {Cry of anguish heard at the Programming Clinic an
hour before the project deadline: "But I only changed one card!"}

wjr@x.UUCP (Bill Richard) (03/13/85)

{}

I don't know if this it really the right newsgroup for technical
discussions about Baud rate vs bit rate but the following quote is so
confused that I couldn't resist.

In <65@daisy.UUCP> daisy!david says:
> 9600 Baud is not necessarily 9600 bits per second (bps).  Baud measures the
> number of signal changes per second.

So far so good. but,

> For example, a Vadic 1200 Baud modem
> is actually a 1200 bps modem.  The Baud rate is 600 and Vadic puts two bits
> (called a dibit) into each signal change (Baud).  9600 Baud modems are
> actually 9600 bps modems, transmitting at a much lower baud rate.  (Typically,
> they pack three or four bits into each signal change.)

This doen't make any sense. The simplest scheme I know of for encoding
bits into signal changes (NRZ encoding, used by most RS-232 devices)
assigns one signal state to mean 1 and the other to mean 0, giving one
signal change per bit so that bit rate == Baud rate. All other schemes
I know of (FM, MFM, etc.) use more than one signal change to encode
each bit so the bit rate for these encodings is always less that the
Baud rate. I belive that it is theoreticaly impossible to encode more
than one bit into one signal change.

> Please be careful in posting data communications related stuff unless you 
> really know what you are talking about.  People can waste enormous amounts of
> time really easily.  

Agree totally, just look at the time I spent composing this reply. :-)

> The contents of this posting are the
> responsibility of the author who is generally capable of walking and chewing
> gum in near-real time.] 

Have you checked recently? :-)
-- 
----
William J. Richard @ Charles River Data Systems
983 Concord St. Framingham, MA 01701
Tel: (617) 626-1112
uucp: ...!decvax!frog!wjr

rpw3@redwood.UUCP (Rob Warnock) (03/14/85)

+------edited for brevity---------
| <frog!wjr>: ...the following quote is so confused that I couldn't resist.
| > is actually a 1200 bps modem.  The Baud rate is 600 and Vadic puts two bits
| > (called a dibit) into each signal change (Baud).  9600 Baud modems...
| > ...typically,  they pack three or four bits into each signal change.
| This doen't make any sense. ...[NRZ/RS-232/bit=baud]... All other schemes
| I know of (FM, MFM, etc.) use more than one signal change to encode
| each bit...  I belive that it is theoreticaly impossible to encode more
| than one bit into one signal change.
| William J. Richard @ Charles River Data Systems | uucp: ...!decvax!frog!wjr
+---------------

I'm sorry Mr. Richard, but <daisy!david> WAS correct. The ONLY way to
get 9600 through dial-up lines is to have more than one bit per baud,
since dialup lines are bandlimited at about 3 kilohertz.

There are many methods for encoding several bits/baud, but all of the
ones you mentioned -- RS-232, NRZ, FM, MFM, etc. -- use BINARY signalling
(I assume you are speaking of the FM and MFM of disk storage) and of course
binary signalling cannot exceed one bit/baud.

But there are other methods than binary. As an extreme example (but still
feasible and quite practical over "clean" wires), you can use AM or PAM
(Pulse Amplitude Modulation), using 256 voltage levels from 0 to 25.5 volts,
with each of the 1/10 volt values representing a different 8-bit number.
(If this implies to you that I am "transmitting" with a D/A and "receiving"
with an A/D, you are quite correct.) Using raised-cosine filtering, over a
low-noise bandlimited channel, with good equalization at the receiver, one
can send very nearly two baud per Hertz of bandwidth. (Loosely speaking,
you get an "up" symbol and a "down" symbol per cycle, hence two baud/Hertz.)
Each baud (symbols or transmit states per second) conveys 8 bits of information,
so the system is capable of nearly 16 bits/sec per Hertz of bandwidth.

Over a noise-free channel of infinite bandwidth, there is no theoretical
limit to the number of bits per symbol, since you can pack as many bits
into a symbol (physical state) as you can measure.

Practical systems have noise, and AM is not ideal under those conditions.
A popular modulation scheme is QPSK (Quadrature Phase-shift Keying), in which
one of 4 phases of a carrier signal is sent during each symbol interval
(normally evenly spaced at 0, 90 180, and 270 degrees, hence "quadrature).
Since there are 4 possible states for each signalling interval, there are
log2(4) = 2 bits/sec per baud. (This is the "di-bit" <daisy!david> mentioned.)

   [Aside: Remember that "baud" is symbols per second, and "bits"
    has no time dimension, so we should compare "bits/sec" with "baud".
    Though normally it does no harm to get a little sloppy and talk
    about "bits/baud", to be precise one should say "bits/symbol"
    (no time implied) or "bits/sec per baud".]

Anyway, as I recall, the Vadic and Bell 212 modems both use QPSK,
and thus are 600 baud ON THE ANALOG OR TELEPHONE SIDE OF THE MODEM.
(They are of course 1200 baud on the digital or RS-232 side, where
binary signalling is being used.)

The next higher-density popular coding scheme is QAM, or Quadrature
Amplitude Modulation, which is a mixture of both AM and QPSK. Each
symbol can be any on of the 4 phases (0/90/180/270) AND can be any
one of several amplitudes, say (for 4-level) +3/+1/-1/-3 volts.
This produces 16 possible states for each symbol, so you can send
log2(16) = 4 bits/symbol, or 4 bits/sec per baud.

In practice, in order to separate the symbol states so as to maximize
noise immunity and signal detection ability, the same set of phases
is not used at each amplitude, but the symbol states are spaced out
in amplitude/phase space. So for 16 state coding, you might have the
4 phases 0/90/180/270 degrees used at the lowest amplitude, the 4
phases 45/135/225/315 degrees at the middle amplitude, and the 8 phases
22.5/67.5/112.5/.../337.5 at the highest amplitude. (I may be off a few
degrees, but you can see the pattern very clearly on an oscilloscope
displaying what is called an "eye" diagram.)

In any case, there are 16 discrete states, so you still get 4 bits/sec
per baud. (Most installed 9600 b/s modems use QAM, and thus run at 2400
baud ON THE ANALOG SIDE -- the telephone line. That SHOULD only need 1200
Hertz bandwidth, but the phone line is noisy, and has amplitude and phase
errors with time and frequency -- so it's rough squeezing it into 3000 Hertz.)

I hope this settles the controversy -- if you are using BINARY signalling,
you can only get 1 bit/sec per baud (or less if some of you symbols are
used for clock). With ternary, quaternary, or higher modulations, you
can get many bits/sec per baud.


Rob Warnock
Systems Architecture Consultant

UUCP:	{ihnp4,ucbvax!dual}!fortune!redwood!rpw3
DDD:	(415)572-2607
USPS:	510 Trinidad Lane, Foster City, CA  94404

cmoore@amdimage.UUCP (chris moore) (03/14/85)

> This doen't make any sense. The simplest scheme I know of for encoding
> bits into signal changes (NRZ encoding, used by most RS-232 devices)
> assigns one signal state to mean 1 and the other to mean 0, giving one
> signal change per bit so that bit rate == Baud rate. All other schemes
> I know of (FM, MFM, etc.) use more than one signal change to encode
> each bit so the bit rate for these encodings is always less that the
> Baud rate. I belive that it is theoreticaly impossible to encode more
> than one bit into one signal change.

The Bell 212A modems use DQPSK (Differential Quadrature Phase Shift
Keying).  By shifting the PHASE of the signal (0, 90, 180,or 270 
degrees) you can encode four values (2 bits) in each change.

The V.22bis standard for 2400 bps uses QAM (Quadrature Amplitude
Modulation) which uses four different AMPLITUDES in addition to
the four different PHASES.  This gives you 16 values or 4 bits per
signal change.

Both of these modem standards run at 600 baud.

-- 

"My system is so slow we don't use 'who' anymore - it's faster to
 walk around the building and count the users."

 Chris Moore (408) 749-4692
 UUCP: {ucbvax,decwrl,ihnp4,allegra}!amdcad!amdimage!cmoore

dave@rocksvax.UUCP (03/15/85)

/***** rocksvax:net.music.synth / x!wjr /  1:34 am  Mar 14, 1985*/

> (called a dibit) into each signal change (Baud).  9600 Baud modems are

The dibit thing is the key.  1200 baud modems work by using a PSK (Phase
shift Keying) modulator.  This modulator takes 2 serial NRZ bits and
assigns a phase shift based on the 4 combinations you get of the 2 bits.  The
tone is then shifted some number of degrees, say 360/4 degrees.  When the
receiver gets this signal it looks at the phase shift it saw and spits out
2 bits based on the shift it saw.  This is slightly more simplified than what
really goes on but fundamentally what happens.  Each baud is one of these
phase shift times, each phase shift represents 2 bits.  The higher bit
rate modems still use the fundemental 600 baud signalling rate, only they
divide the shift up into smaller units, say 360/16 or 360/32 to encode
4 or 5 bits respectively for each baud.

The fundemental thing to remember is that each baud can be encoded to
represent multiple bits and that bauds != bits.  Because the receiver has
to recreate the senders clock which is running at 0 degrees phase shift,
the 1200 baud standard scrambles the bits to assure that you won't have
long stretches of data where the phase shift stays at one position.  This
randomization allows a PLL (Phase locked loop) to average out the transitions
and recreate the sender's clock.  Also on the 212 modems, a circuit buffers
the asynchronous data and synchronizes them to the modems synchronous
data and the reverse process occurs at the receiving end.

Hopefully that will answer some questions and rest this bits and bauds
discussion!!

Dave

arpa: Sewhuk.HENR@Xerox.ARPA
uucp: {allegra,rochester,amd,sunybcs}!rocksvax!dave