MIDI Organ Interface Project

1/10/12 Update


The design goal is to produce a MIDI encoder/decoder for a theatre organ with the following characteristics:
  • 8 manuals of 61 keys each
    (Pedal, 4-manuals, 3-second touch manuals)
  • Keyboard inputs to be optically isolated with common negative return
  • Each keyboard to have optically isolated stop-key inputs (common positive) for
    32', 16', 10-2/3', 8', 5-1/3', 4', 3-1/5', 2-2/3', 2', 1-3/5', 1-1/3', 1'
    with the appropriate MIDI note output based on the stops drawn
  • Transpose (± 16 steps)
  • Sustain Input to produce the sustain control packets (for piano)
  • Re-iterate Stop Input to produce a stream of note-on and note-off messages at the programmed re-iterate rate
  • A separate program for Mixture keying with appropriate breaks (much later)

    The desire is to provide a MIDI package for each Rank.
    This is equivalent to a unified rank in a theatre organ with all keyboards sharing the pipes in the rank.

  • SYSTEM OVERVIEW


    I'm finally getting insights in implementing JOrgan and Haupterk and found that many of these modules are not needed but needed to add 1.
    See the JOrgan page for more details. So far I only see a need for the first two.


    Below are the two modules for the MIDI Organ system.
    Keyboard Scanner Stop Switch Scanner
    Description
    Description
    Keyboard Module I/O
  • 61 - Keyboard Inputs (61 bits)
  • 3 - Coupler Inputs (16',8'Off,4')
  • MIDI Channel Number (4 jumpers)
  • Transpose (5 bits = ±12)
  • MIDI Output
  • Stop Switch Module I/O
  • 64 - Stop Inputs (64 bits)
  • MIDI Channel Number (4 jumpers)
  • Analog Input for Expression
  • Expression Setting (4 jumpers)
  • MIDI Output


  • The High-Speed serial I/O is used to send note data to each of the modules without as much time lag as standard MIDI messages. Each message has only 1 9-bit word.
    High-Speed Serial Messages (9 bits each)
    Serial PortThe bit order is determined by the Serial Port Hardware. The standard PIC USART sends a start bit followed by the data bits starting with the LSB, ending with a Stop bit.
    The following messages are thus transmitted reversing the order of the bits to make the LSB first.
    Note ON 1(On) n(msb) n n n n n n(lsb)
    nnnnnnn is the note number starting at 1
    Note OFF 0(Off) n(msb) n n n n n n(lsb)
    nnnnnnn is the note number starting at 1
    All Note OFF 0(Off) 0(msb) 0 0 0 0 0 0(lsb)
    Since there is no note number 0, this message is used to produce all notes off.

    MIDI Connector Wiring

    MIDI Female Panel Connector-view from front
    Pin 4 is positive with respect to pin 5.
    Pin 2 is grounded for the MIDI Out, but apparently not for the MIDI In.
    Logic '1' is no current (Pin 4 and Pin 5 at same voltage), Logic '0' produces current (for 5V Systems, +5V is connected to pin 4 through a 220 ohm resistor, 0V is connected to pin 5 through another 220 ohm resistor.

    I only need a few MIDI message types to complete the project, even though there are many types available
    Midi Messages
    Logic Levels and Bit Order The message stream transmits at 31.25 kBaud, 32 microseconds per bit, or 320 microseconds per byte
    Logic '0' is current on
    Each message byte consists of a start bit (logic 0), 8 data bits (b0 first through b7), and a stop bit (logic 1)
    As you can see, the data bits are sent in reverse order (LSB first)
    Channel Numbers Channels 1 through 16 actually correspond to indexes 0 through 15
    (i.e. channel 1 are bits "0 0 0 0" and channel 15 are bits "1 1 1 1")
      Each message consists of a status byte followed by 1 or more data bytes
    B7 of the status byte is always logic '1'
    B7 of any other byte is always logic '0'
    Middle C parameter value is 60 (0x3C)
    Non-velocity device should use a velocity of 64 (0x40)
     Status Byte1st Data Byte2nd Data Byte
    Note ON Event 1 0 0 1 c(msb) c c c(lsb)
    cccc is the channel number
    0 n(msb) n n n n n n(lsb)
    nnnnnnn is the note number
    0 v(msb) v v v v v v(lsb)
    vvvvvvv is the velocity
    Note OFF Event 1 0 0 0 c(msb) c c c(lsb)
    cccc is the channel number
    0 n(msb) n n n n n n(lsb)
    nnnnnnn is the note number
    0 v(msb) v v v v v v(lsb)
    vvvvvvv is the velocity
    PANIC
    ALL Notes OFF
    1 0 1 1 c(msb) c c c(lsb)
    cccc is the channel number
    0 n(msb) n n n n n n(lsb)
    nnnnnnn is the value 123(decimal)
    0 0 0 0 0 0 0 0
    Sustain ON 1 0 1 1 c(msb) c c c(lsb)
    cccc is the channel number
    0 1 0 0 0 0 0 0
    64 decimal or 0x40 hex
    0 v(msb) v v v v v v(lsb)
    v is any value > 64
    Sustain OFF 1 0 1 1 c(msb) c c c(lsb)
    cccc is the channel number
    0 1 0 0 0 0 0 0
    64 decimal or 0x40 hex
    0 v(msb) v v v v v v(lsb)
    v is any value < 63
    Reminder The first byte of a Sustain OFF on Channel 2 (1 0 1 1 0 0 0 1) will appear as
    "0 (start) 1 0 0 0 1 1 0 1 1 (stop)"