From ed@stauff (Edward L. Stauff) Sun Aug 25 18:40:46 1991
From: ed@stauff.UUCP (Edward L. Stauff)
Newsgroups: rec.music.synth
Subject: MIDI Pedalboard -- how I built one
Message-ID: <NkX671w164w@stauff.UUCP>
Date: 24 Aug 91 02:46:46 GMT
Organization: Minstrelsy & Lutherie
Lines: 153

In response to several recent inquiries, I hereby submit this posting.  Please
send replies to rec.music.synth, comp.music, or the address in my .signature.


            * * *    An Organ-Pedal MIDI Controller    * * *

               -- How I done it, and how U can do it 2. --


    In 1990, after years of idle doodling, designing, and procrastinating, I
built a MIDI pedal controller that features (almost) full AGO compass and
velocity.  This article describes the what, how, where, why, and how much.

Why build one?
--------------
    Why, indeed.  As recent articles have indicated, there is (to my knowledge)
no commercially available add-on MIDI pedalboard that even remotely conforms
to AGO (American Guild of Organists) specifications.  In practical terms, AGO
specifications means 32 pedals (C-G), though 30 or even 27 notes may be enough;
and full-length (around 30") pedals, not the stubby spinet-style things.  The
pedalboard should also be concave and radiating.
    I have seen at least one spinet-style MIDI pedalboard of around 18 short
pedals: totally useless for playing organ literature, or anything other than
the most rudimentary bass line.  (Okay, the last phrase is an opinion.)  Full
MIDI pedalboards are available on top-of-the-line electronic organs, but you
have to pay several or many thousands of dollars for such a thing.
    So, the purpose of the project was to obtain, at a reasonable cost, a MIDI
pedalboard on which "the literature" could be performed.

The necessary components:
-------------------------
    In order to construct a MIDI pedalboard, one needs the following
components:

    1.  a pedalboard
    2.  a computer (almost any microprocessor will do)
    3.  an interface between the pedalboard and the computer
    4.  some sort of interface to generate MIDI (a programmable UART will do)

    While it is possible to generate MIDI output without the use of a computer
of some sort, I wouldn't want to try it.  Even on a dare.  As it happened, I
had an IBM PC clone at my disposal, and an MPU-401 clone: so much for (2) and
(4).

Where to get a pedalboard:
--------------------------
    I also had an old 3rd or 4th-hand pedalboard on hand which I acquired some
years ago by being in the right place at the right time.  If you want a
pedalboard and don't know where to look, I highly recommend contacting one or
more of the following in your area:

    1.  Pipe-organ builders, tuners, and technicians.
    2.  If you can't find (1) in the phone book, find a church that has a
        pipe organ.  Somebody has to tune the thing and fix it when it breaks.
    3.  Theatre-organ clubs.

    New pedalboards can be obtained from pipe-organ supply companies, such as
Organ Supply Industries and Reisner/Kimber-Allen.  Expect to pay in excess of
$700 for one.  Expect also to get what you pay for: quality.  By comparison,
you can expect to pay anywhere from $0 to $200 for a used pedalboard.  Here's
one address:

        Organ Supply Industries
        Box 1165
        Erie, PA 16512
        (814) 864-3011

    Those of you with woodworking shops could try building one, though it's
probably less work to find a used one.  If you're bent on (or forced into)
building one, a good reference is "The Contemporary American Organ" by Barnes.
It includes the official AGO specifications.

The Hardware Interface
----------------------
    Okay, so you've got your computer, your MIDI interface, and your pedalboard,
all of which are potentially off-the-shelf parts.  Now you need to attach a set
of switches to the pedalboard, if it didn't come with them.  If you want
velocity (like I did), you'll need two switches on each pedal: one near the top
of the key-travel, and another near the bottom.  The software will measure the
time delay between the two switches and translate it into velocity.
    What kind of switches?  Oh.  Well, I ended up rolling my own switches out
of silver wire.  I don't recommend it; they're messy to adjust and I had to
build a box to cover and protect them.  Reed switches or micro switches would
probably be better.  But I had to go the cheap route.  Organ Supply Industries
sells silver wire; don't try to use copper or steel, they'll oxidize.
    Had I known then what I think I know now, I would have interfaced to my
PC's parallel port, which (so I am told) does in fact work bi-directionally.
However, what I did was to build a card that plugs into the PC's bus, and
another card that sits on the pedalboard.  The two cards contain some SSI and
MSI TTL IC's that, though the use of multiplexers and latches, map the 64
switches (2 per key, remember) into eight 8-bit i/o ports.  I split up the
circuitry into two cards so that the cable between the PC and pedalboard could
be 13 wires (8 data, 3 address, power & ground) instead of 65.  I won't attempt
to reproduce the schematic, 'cause it's too much trouble, and also because it
doesn't quite work completely.  The board interferes with my floppy drive; I
ended up mounting a switch to disable it so I can use the floppy.  I suspect
timing problems having to do with DMA, but I digress.

The Software Interface
----------------------
    If you're going to do this the way I did it, I'd be happy to send you
source code.  For now, I'll just summarize.  If you want velocity, then you
need a decently fast timer interrupt: around 1 Khz.  The standard PC timer
interrupt is fast enough for scanning without velocity, but not with velocity.
However, if you don't have velocity, then you need to perform debouncing in
software.  It turns out that with velocity, debouncing isn't a problem.
Consider each key to have four states: up, down, going-up, and going-down.
You can't really tell going-up from going-down, but you can infer it from the
previous state.  Use the 1 Khz timer interrupt to increment a counter, and
remember the last time (counter value) when each key was up or down.  When a
key makes a transition from going-down to down, generate a MIDI Note On
message.  When a key makes a transition from going-up to up, generate a Note
Off message.
    Oh, one more thing: you'll almost certainly want your software to echo
the MIDI interface's MIDI IN to MIDI OUT at the same time -- which means
merging the incoming MIDI data with the MIDI data you're generating from
scanning the pedalboard.  I won't go into detail on this; I'll send (or post)
source code on request.

The Result
----------
    Having been an organist for over 20 years, and having been into MIDI
stuff for around 4, all I can say is: oh, wow!  Most MIDI keyboardists can't
appreciate how much more you can do (in live performance) with a pedalboard
added to your rig -- until they try it.  Most organists can't appreciate the
possibilities that MIDI opens up -- new timbres, keyboard split points (on
pedals, too!), velocity, etc., etc. -- until they try it.  And for my money,
there's nothing quite as exciting as playing Bach's Jig Fugue on a "pedal
synthesizer": it's a whole-body sensual experience.  Now, if I could just
learn to play that Widor Finale...

So What's Next?
---------------
    A product, of course.  If I were, say, Yamaha, I could easily develop
and market an add-on MIDI pedalboard controller for under $1000.  Now, whether
I can do such a thing with my own meager resources remains to be seen.  If I
do, you'll see it advertised here.

Postscript: Toe Studs
---------------------
    I did say my pedalboard was *almost* full compass, didn't I?  It turns out
that what I remembered as being a 32-note pedalboard actually had 30 notes.  I
didn't discover this until I had the hardware mostly built.  So, rather than
waste 4 bits of input, I wired the spare bits to four toe studs which I mounted
on the pedalboard.  (Toe studs are big pushbuttons operated with the feet,
found on organ consoles.)  My software will send patch changes (or anything
else I want) when a toe stud is pressed -- or released.  The toe studs have
turned out to be much more useful than the extra two notes would have been.

        + - - - - - - - - - - - + - - - - - - - - - - - - - - - - - +
        | Edward L. Stauff      | "Specialization is for insects."  |
        | gozer.uucp!stauff!ed  |         -- Lazarus Long           |
        + - - - - - - - - - - - + - - - - - - - - - - - - - - - - - +

