Organ MIDI Project Summary
Outline of the Project
I have a mid-60’s vintage Rodgers “Trilogy,” model 325: three manual, 32-note semi-AGO (slightly less concave than AGO spec) pedalboard, solid-state discrete component, intended for church use. Like any Rodgers, it was built to last; the analog organ is entirely functional and has needed only a few minor repairs. The guts are getting slightly noisy due to aging capacitors, but otherwise it still sounds good. After obtaining it in 1995, I added a great-to-pedal reversible toe piston (using a flip-flop and SIP relay) and an LM386 headphone amplifier (the console contains only a preamp). Subsequently, a dual 25W amp was added to drive speakers (two very nice Panasonic 3-ways that I got at a thrift store for $19/pair.)
Several years ago, I added eight ranks of pipes, with MIDI control, from a disused organ to the toaster at the church where I subbed. The 1976 Allen, a first-generation digital organ, was already deteriorating. I suggested the then-popular “Ranks in a Box” to bring it up to date, but that project never happened. That’s where I got the ideas for this project.
Last summer, I pulled this project off the back burner and decided to approach it in two phases: MIDIfying the console, and adding the computer. Due to tight funds, I decided – after much vacillating – to keep the analog organ fully functional while adding the MIDI goodies. This resulted in some challenges that could have been avoided had I simply gutted the console, but it also made for a great project. I have a Yamaha DGX300 keyboard which, fortunately, has MIDI support for multitimbral (i.e. each channel can be set independently with patch, bank, volume, effects, etc) input. The initial, and so far only, plan was to use it for set up and testing. It has turned out to be a delight for adding voices to the Rodgers. The long-range plan, on hold for budgetary reasons, is to add Hauptwerk, or more likely MyOrgan, support.
Getting it off the Ground
I looked at three commercially made keying systems before checking with the members of . One of the members (don’t want to mention your name without your consent, but thanks, Ed) strongly recommended that I look at Pete Stark’s “MD1” design. I’ve been a radio amateur since 1970 and was a programmer in a prior lifetime, but the prospect of gathering up parts from various sources and ordering custom-made PCB’s looked a bit daunting. In a moment of temporary insanity (I’m a high school math teacher, so those happen fairly often), I decided to go for it. The cost appeared to be about half that of the most likely commercial system, plus I could customize the programming to fit my project.
The PCB’s
I’ve built a zillion HeathKits over the years, but have never made my own PCB’s. Using Pete’s “Gerber” files and almost no idea of what I was doing, I ordered them from BareBonesPCBs, fully expecting to receive five pricey but very sturdy bookmarks. Surprise – they were perfect and of very good quality.
Per Pete’s recommendation, most of the parts were ordered from Jameco and BGMicro – good service from both, but some came from my old favorite, Mouser. The pots and shaft hardware came from RadioDaze – also good service. I usually use “chisel” tips in my trusty 23W Weller Marksman, but I found that I needed conical tips for the tiny traces on the PCB’s – and .031 solder instead of my more usual .062. I think I went through five tips over the project. Fortunately, R&L Electronics, the world’s best amateur radio store, is located about 15 minutes from where I live, so tips were readily available.
Keying
The Rodgers keys with -12V. Yes, negative 12V. Fortunately, the diode keyers are reverse biased with the +5V of the TTL logic, so they cooperated nicely. Adding a 2.4k resistor to the 1k pull-up on the shift register gates forms a voltage divider that keep the gate at +5V key-up and very close to 0V key-down. A minor program change was needed for the reversed polarity.
I tried drawing the +5V (+2V for the 3TR’s) from the Rodgers power supply. No luck. Drawing from the +12V oscillator supply, playing a chord caused the regulator in the Rodgers power supply to temporarily sag so much that it sounded like an under-winded pipe organ. Drawing from the +28V accessory supply resulted in some toasty – but within limits – 10W resistors and wide voltage swings due to keys and stop tabs being pressed. An 8V, 1.6A transformer from BGMicro ($2.95) did the job with a full-wave bridge of 1N4001’s. Of course, it has two 4700 uF filters from my junk box decoupled by a 5-ohm resistor to keep hum down, but it works like a champ. Typical voltage to the 3TR’s is 8.75-9.5V.
Wiring
I used 10-conductor ribbon cable since it was easier to route through the organ than the wide stuff. (The Trilogy has three swing-out PCB frames that fill the cabinet almost entirely.) The connections are made to the key side of the keyers rather than to the keyboards; much easier to wire. The MD1 boards are mounted on the back of the outermost frame, which – fortuitously, has the keyers on it. (The inner two boards hold the 158, 85 + 73, variable-inductance oscillators, trems. chiff, etc.)
For testing, I built a “smash” consisting of five opto-isolators and a five-input NOR gate that simply jams the MIDI signals together. As expected, the contention was too great and I eventually broke down and bought a MidiSolutions quadra-merge. The smash still functions to combine the pedal and stop/expression outputs. I refused to pay $200 for an octa-merge, considering that the channel traffic for the pedal and stops are both small. A minor problem occurred here, but it’s described below.
Keyboard Program
I started out with Pete’s original code, but having been an assembler programmer (IBM 360/370) for about 14 years, I couldn’t resist the urge to modify it. He has it set up to allow the bottom 16 key on the keyboards to be used to set the patch, and the top 16 to set the channel. In the original design, the high C was used to switch the code to “patch/channel” mode. I mounted a separate pushbutton on the console to take the place of the high C, called “note 62,” which affects all five boards in various ways. I also programmed the next 16 keys to set the LSB of the “bank” (MSB set to zero) and the remaining 13 keys to set the note-on velocity. Also, selecting channel 16 results in muting the output from that division.
“Special key” code:
NOTEON LDAA NOTE
* CMPA #96 TOP C?
CMPA #97 NOTE '62' ?
BNE NTON1 NO
STAA CPFLAG YES, SET FLAG
CLR PATCH CLEAR PATCH MEMORY
CLR BANK CLEAR BANK MEMORY
BRA ALLOFF ALL NOTES OFF & EXIT
NTON1 TST CPFLAG CHECK THE FLAG
BEQ NOTEOK NORMAL NOTE ON IF CLEAR
* SUBA #80 CHECK IF CHANNEL CHANGE
* BHS SWCHAN >=80 WAS YES
SUBA #81 CHECK IF CHANNEL CHANGE
BHS SWCHAN >=81 WAS YES
LDAA NOTE ** ORIGINAL LINE 250
SUBA #LOWNOT
CMPA #$F PATCH CHANGE?
BLS CHGPAT
CMPA #32 VELOCITY CHANGE?
BHS CHGVEL
CHGBNK SUBA #16 ZERO-BASE THE BANK NUMBER DIGIT
LDAB BANK
LSLB
LSLB
LSLB MOVE INTO LEFT NIBBLE
LSLB
ANDB #$70 ONLY 7 BITS
ABA COMBINE W PREV DIGIT
STAA BANK
LDAA #$B0 CONTROLLER CHANGE CODE
ADDA CHANNL
BSR OUTEEE
CLRA CONTROLLER 0 (MSB)
BSR OUTEEE
CLRA VALUE = 0
BSR OUTEEE
LDAA #$B0 CONTROLLER CHANGE CODE
ADDA CHANNL
BSR OUTEEE
LDAA #32 CONTROLLER 32 (LSB)
BSR OUTEEE
LDAA BANK BANK NUMBER
BRA OUTEEE
CHGVEL SUBA #29 CREATE VELOCITY CODE FROM NOTE (32-44)
LSLA MULTIPLY BY 8
LSLA
LSLA
STAA VELOCT NEW VELOCITY RANGES FROM 24 T0 120
RTS
SWCHAN STAA CHANNL CHANGE CHANNEL
RTS AND QUIT
CHGPAT LDAB PATCH
LSLB
LSLB
LSLB MOVE INTO LEFT NIBBLE
LSLB
ANDB #$70 ONLY 7 BITS
ABA COMBINE W PREV DIGIT
STAA PATCH
LDAA #$C0
ADDA CHANNL
BSR OUTEEE PROG CHGE CODE
LDAA PATCH
BRA OUTEEE AND PATCH NUMBER
NOTEOK LDAA #$90 NOTEON CODE
ADDA CHANNL
BSR OUTEEE NOTEON + CHANNEL
LDAA NOTE
BSR OUTEEE NOTE NUMBER
LDAA VELOCT
BRA OUTEEE VELOCITY
Muting Code:
*OUTEEE LDAB SCSR READ STATUS
OUTEEE LDAB CHANNL CHECK FOR CHANNEL 16
CMPB #$0F IF SO, SKIP OUTPUT
BEQ OUTSKP
OUTLUP LDAB SCSR READ STATUS
BITB #$80
* BEQ OUTEEE LOOP UNTIL TDRE=1
BEQ OUTLUP LOOP UNTIL TDRE=1
STAA SCDAT SEND CHARACTER
OUTSKP RTS
Pedalboard Program
Almost identical to the keyboard program except that, since there are only 32 pedals, only the patch and channel change functions are implemented; bank and velocity are not.
A problem arose with the smash. As noted below, it outputs a string of stuff with swell pedal changes. This sometimes resulted in pedal note-off’s being lost. To avoid this, an additional array was added that causes additional note-off’s to be sent both four and eight keyboard loops after the original note-off. I’ve had no problem with it since. [In case of a problem, I could always push the “note 62” button, which causes “all notes off” commands being sent.]
Redundant note-off code:
DATCLR RMB 64 DELAYED NOTE-OFF ARRAY - MUST FOLLOW 'DATA'
LDAB #64 ERASE THE DATA ARRAY
LDX #DATA
LOOP1 CLR 0,X ZERO THE DATA ARRAY
CLR 64,X ZERO THE DELAYED NOTEOFF ARRAY
SILEUP LDAA 0,X GET THE BYTE
LSLA SHIFTIT LEFT
ANDA #$7F CLEAR BIT 7
STAA 0,X
BNE SHIFTIT THERE ARE BITS STILL ON
** REPEATED/DELAYED NOTEOFF ROUTINE
LDAA 64,X PICK UP NOTEOFF ARRAY BYTE
BEQ SHIFTIT IT'S ALL ZEROES
BITA #$80 IS LEFT BIT ON?
BEQ CLRSKP NO
BSR NOTEOFF TURN NOTE OFF AGAIN
LDAA 64,X RELOAD BYTE
CLRSKP LSLA SHIFT ONE LEFT
STAA 64,X STORE IN ARRAY
BRA SHIFTIT SHIFT REGISTER AND REPEAT
SHUTOFF STAA 0,X STORE IT
LDAA #%00010001 NOTEOFF ON 4TH AND 8TH PASSES
STAA 64,X STORE IT
BSR NOTEOFF
NOTEOK CLR 64,X CLEAR THE NOTEOFF BYTE
LDAA #$90 NOTEON CODE
Expression/stop tab program
This program started out from the MD1 keyboard program and has been heavily modified. First, the code for patch and channel changes with removed. The stop tabs pull the stop to ground from heaven-knows-what negative voltages. So, instead of the 2.4k voltage divider resistor, each shift register input has a 1N914 diode to ground in case the contact bar on the stop tab hits the negative line before touching the ground. [The shift register IC’s do have a clamp on the inputs, but this is just a safety.]
“Note 62” both sends an “all notes off” command and clears the DATA array.
Each stop tab generates note-on and note-off commands to channel 12. The velocity is set to 001 so it makes no sound on the Yamaha, and is also not recognized as a note-off (velocity zero). Most of the stop tabs are also recognized to set a patch and bank on their respective channel.
Patch/bank code and part of the table:
********
* LOOKUP AND OUTPUT BANK AND PATCH
********
BANDP LDAB NOTE
SUBB #LOWNOT
BLO BPEXIT SHOULDN'T HAPPEN
CMPB #47 IS NOTE IN TABLE?
BHS BPEXIT NOPE - TOO HIGH
CLRA CLEAR HIGH BYTE OF REG D
LSLB MULTIPLY BY TWO
ADDD #NOTE01 ADD ADRESS OF TABLE
XGDY PUT OFFSET INTO INDEX REGISTER
LDD 0,Y PICK UP ENTRY FOR THIS KEY
BEQ BPEXIT SKIP IF ENTRY ZERO
LSRB
LSRB SHIFT CH TO RIGHT NIB OF B
LSRB
LSRB
LDAA #$B0 CONTROLLER CODE
ABA ADD CHANNEL
BSR OUTEEE
CLRA CONTROLLER 0 (MSB)
BSR OUTEEE
CLRA MSB = 0
BSR OUTEEE
LDAA #$B0 CONTROLLER CODE
ABA ADD CHANNEL
BSR OUTEEE
LDAA #32 CONTROLLER 32 (LSB)
BSR OUTEEE
LDAA 1,Y GET CHANNEL/BANK
ANDA #$0F CLEAR CHANNEL
BEQ BNKZRO IF BANK = 0, DON'T ADD
ADDA #110 ADD OFFSET
BNKZRO BSR OUTEEE
LDAA #$C0 PATCH CHANGE
ABA ADD CHANNEL
BSR OUTEEE
LDAA 0,Y PICK UP PATCH #
BSR OUTEEE
BPEXIT RTS
* HI BYTE = PATCH; LOW BYTE: HN = CHANNEL, LN = BANK(-110)
NOTE01 FDB $1830 CH PICC 2 (NYL GUIT 230)
NOTE02 FDB $0000 GT FULL CHR
NOTE03 FDB $0C32 CH NAZ 2-2/3 (MARIMBA 106)
NOTE04 FDB $0000 GT SW-TO-GT
NOTE05 FDB $5933 CH FLUTE 4 (DARK MOON 104)
NOTE06 FDB $0A12 GT MIX II (MUSIC BOX 112)
NOTE07 FDB $1933 CH DULC 8 (12 STRING 033)
NOTE08 FDB $0312 GT SUPER 2 (HONKY TONK 004)
NOTE09 FDB $1333 CH GED 8 (CHPL ORGN 025)
NOTE10 FDB $3413 GT FLUTE 4 (VOCAL ENSMBL 062)
NOTE11 FDB $3E12 GT OCT 4 (SYNTH BRASS 084)
NOTE12 FDB $0000 SW TREM
NOTE13 FDB $1014 GT BRDN 8 (THTR ORGN 023)
NOTE14 FDB $4422 SW OBOE 8 (OBOE 071)
.
.
.
(through note 45)
Also implemented is expression control using the analog-to-digital converter on the 68HC11 (port E). An additional 10k pot was added to the swell pedal shaft, which only turns through 90 degrees, through a 1k resistor to PE1. This generates controller 1 commands on channel 12 for HW & MyOrgan, as well as controller 7 commands on channels 1-4. The 8-bit DIP switch is used to set the minimum velocity.
Expression code:
ADCCTL EQU $1030 ADC CONTROL REGISTER
ADCAD2 EQU $1032 ADC INPUT REGISTER 2
ADCOPT EQU $1039 ADC OPTION REGISTER
LDAA #%10000000 USE E-CLOCK FOR ADC
* LDAA #%11000000 USE R/C CLOCK FOR ADC
STAA ADCOPT POWER UP ADC
LDAA PORTC MIN VEL IS SET BY 8-DIP SWITCH
STAA VELMIN HOLD AS VELOCITY ADJUSTMENT
STAA VELOCT HOLD AS STARTING VELOCITY