Thursday, December 26, 2013

MIDI pedalboard

So the Christmas rush is over, and on your New Year's resolution list is a project to finish your Hauptwerk setup by building a MIDI-pedalboard to go with those MIDI keyboards you have, plan to build, or plan to buy.

Basically you have two major options: Money or time? If you have too much money, and not enough time, your problems are over. Just head over to Classic MIDI Works and for only (!) $1725 you can have a brand new pedalboard that produces excellent MIDI signals for your Hauptwerk, GrandOrgue, MIDItzer, or jOrgan setup.
http://www.MIDIworks.ca/index.php/products/details/145/2/pedalboards/classic-ago-MIDI-pedalboard

Or if you have tons of time and amazing craftsmanship skills, you could build your pedalboard like this:
http://www.flickr.com/photos/53505621@N07/sets/72157624882970350/

But if you are somewhere in between, like me you will probably find it easier to start with an AGO pedalboard from an old analog or pipe organ and convert it to MIDI. That's what this blog post is about.

In theory, it's simple: A pedalboard is basically 32 switches which are activated by pressing the pedals. You convert those switch open and closings to MIDI signals which are then fed to your computer for use with virtual pipe organ software. Some systems go one step further and send the MIDI signals on to the computer via a USB connection. Historically, however, you would use a sound card or other type of adapter to accept the MIDI signals using a 5 pin DIN MIDI cable. I will assume for this discussion that you want to output via a generic MIDI connector rather than a USB cable. MIDI output from the pedals will allow you to connect to a MIDI merge device (with the keyboards and pistons) and from there to the sound card MIDI input or perhaps a MIDI-2-USB converter. When you do so, just remember to watch for latency (lag). Each conversion can introduce just enough lag that it might become difficult to play. This is because MIDI itself is not a very fast protocol and merging and converting it can be slower than we might like, especially for continuous output signals from the swell expression pedal if they are too verbose. One way to minimize this lag when converting multiple keyboards from analog to MIDI is to use the same manufacturer's conversion system for all manuals and pedalboards. Doing so usually allows all the merging and mixing to happen BEFORE conversion to MIDI, and you only get one final MIDI output signal which has minimal lag.

If you are an electronics engineer, you could even build all this circuitry from scratch. If you are really ambitious and have time on your hands, you might even like to check out the Highly Liquid forum:
http://forum.highlyliquid.com/

I am not an electronics engineer. Wish I were, but not even close. Fortunately there are several commercial circuit board kits available that have worked out all the details for me. Almost all of them directly output MIDI on/off signals. But because there are minor differences between the conversion kits, you do have to make a few choices however.

The first choice you must make is how to connect the pedalboard switches to the circuit boards. You'd think it would be simple: Just connect wire 1 from note 1 on the pedalboard to input 1 on the MIDI converter. Well, yes it is, but only for SCANROW style systems. There are two major categories of connections: SCANROW vs. MATRIX input. You don't need to understand these fully, but here's the bottom line: SCANROW simply connects one pedal switch to one input on the converter in a one-to-one ratio. It is the simplest system to visualize. MATRIX input is a bit more complicated, because it uses a kind of indexing to reduce the number of wires needed. Rather than 32 wires connecting to the MIDI converter as with a SCANROW system, you might have only 8-16 MATRIXed wires. The MATRIX is cleverly designed so that you have one wire for each note in a short sequence, say 8 notes, and another index wire for each sequence. Each played note (closed pedal switch) activates two wires, which combine together (MATRIXed) give your MIDI converter all the information it needs to know which note was pressed. MATRIX wiring is basically dividing the pedalboard up into several sections, each a sequence of notes. You are telling the converter something to the effect "The organist is pressing the 3rd note of the 2nd sequence of notes". These might be 8 note sequences (for digital computer reasons, not musical reasons), but a musician might wish to think of the MATRIX system as analogous to the way keyboards are full of sequences of notes that we call 'octaves' and each octave (of 12 notes) is designated differently. There would be one wire for each note in an octave (C,C#,D, etc.) and one wire for each octave (CCC, CC, C, etc.). Each time the organist plays a note, one wire from each group is activated, and the MIDI converter is smart enough to figure out what note it should play by combining the note wire and octave wire together. Same logic with MATRIX keying, except shorter (8 note) intervals are usually used to keep down the number of wires. Here's a nice little graphical illustration:
http://forum.highlyliquid.com/showthread.php?t=1115

The advantage is we can get by with using fewer wires. Perhaps a ribbon cable with only 8-16 wires in it to connect the pedalboard switches to the circuit board. MATRIX has a downside that you have to use diodes, one for each note, to make sure currents always flow one direction and don't allow the sequence wire to activate wrong notes by allowing current to flow backwards. Fortunately, diodes are cheap (less than a dollar) but have to be soldered one by one.

For me, SCANROW is just plain simpler. No diodes to solder, just 32 wires to connect. That narrows the list slightly, but we still have quite a few circuit board kits to consider. Since we do have 32 wires though, it probably will be best to mount the circuit board close to the pedals, even inside the switch end of the pedalboard. This will keep the wire rats nest to a minimum.

Now we need to decide if we want the circuit board to be capable of handling toe studs (mushroom presets) and swell expression pedals. Most of us do, so we will have to look at the capabilities of the MIDI circuit board kits carefully. Basically swell expression pedals are connected to variable resisters (potentiometers) and that variable resistance is converted to a MIDI signal number of 1-128. In other words, swell expression input is analog, not digital on-off like the pedal note switches. So we look at how many analog inputs the circuit board has. Lastly, we look for whether the circuit board can handle toe stud inputs. Toe stud piston inputs are very similar to pedal not switches, except they must be programmed slightly different -- when we press a toe stud, we expect it to latch, not momentarily turn on, then off, as it would if it were a keyboard note. It is my understanding (I may be wrong) that the switch itself is usually not different, only the way the circuit board handles the signal, so we have to inquire or check into how many such notes it can handle.

Lastly, and perhaps least important, is the type of switches in the pedalboard. Most reasonably modern analog organs use a system of reed switches activated by magnets on the tips of the pedals. This is a nice system because the reed switches are enclosed in glass like a light bulb and are less vulnerable to arcing oxidation and 'bouncing' that can happen when a circuit is closed. There are other ways to make or break a circuit. Some, like the home made pedalboard linked to above, use photo cells to optically open and close the circuit. This is probably the most elegant and trouble free, but it might cost a little more to use. It's completely up to you however, all we need for the input to the MIDI circuit board is some kind of switch. Most circuit boards have a 'debounce' circuit to minimize the number of MIDI on-off signals sent with a single not depression, but again optical might be the gold standard in clean switching.

Assuming you want to MIDIfy a standard AGO pedalboard using SCANROW wiring, I've done the hard work for you and posted a summary spread sheet of various vendors and their relevant products as of December 2013. You may still have further questions after studying it, but it is at least a good start to your project.

By the way, if you don't have Excel, I recommend Libre Office (Calc) or perhaps Gnumeric. Both are open source and free spread sheet viewing tools. You will need to unzip the file first using your operating system or a tool like 7-zip. Compare and contrast!
www.anim8.com/organ/blog/MIDI_Pedalboard.zip