Virtual Pipe Organ Project

Summary

Today there are several virtual pipe organ (VPO) Windows and Mac OS software applications that are sampled based pipe organ simulators. MIDI input data stream controls the VPO notes that accurately simulate the sounds of a real pipe organ. This type of simulation allows an organist to perform virtually on world famous classical and theatre organs that have been previously sampled.

The VPO MIDI input data stream is created by changes in a switch on/off status (e.g., manual key, thumb piston, stop, toe stud, etc.) or changes in potentiometer analog input (e.g., expression pedal position). These sensor states are read, updated, and translated into MIDI status messages such as note on/off and continuous controller (CC) that are used by the VPO software to create the mapped pipe organ sounds. The VPO software can also use MIDI output messages to control organ components such as motorized stops and LCD displays.

This project developed flexible hardware, firmware, and user interface to support full VPO features for different organ console configurations. The primary application is the conversion of existing organs that are in disrepair but supports the building of new organs without MIDI components.

Requirements

Working with a client we established the system requirements. The primary requirements were:

  • Interoperability with Hauptwerk VPO software
  • Organ component sensors are either on/off switches or potentiometers
  • MIDI to/from VPO
    • Switch status on/off to VPO (note on/off message)
    • Expression pedal analog value to VPO (CC# <value> message)
    • Motorized stop control from VPO (note on/off message)
  • Support full range of organ console components and their elements
    • Manuals maximum 5
    • Stop jambs maximum 2 with 64 stops/jamb
    • Coupler rail maximum 64 couplers
    • Pedal board maximum 32 keys
    • Toe bolster maximum 2 with 32 toe studs/bolster
    • Expression pedals maximum 8
  • Support multiple LED lighting strips
  • User interface 7″ touch display
    • Runtime status including pedal position and MIDI activity
    • Transpose control
    • System Status
    • Configuration
  • System easily configurable by only the installer
  • Minimize specialized tools and materials needed for installation
  • Support 8×12 and 12×8 key matrix arrangement up to full 96 switches
Organ Console from Pinterest A Young Person’s Guide to the Pipe Organ – American Guild of Organists

System Architecture

Based on the requirements and the ability for system flexibility, a distributed architecture approach was selected. Using this approach the client can add more components to support more manuals, stops, or other organ components with almost no practical limitation. To support the distributed architecture several intra-system interconnection methods where reviewed. These included a MIDI network, wireless ESPNow, and CAN bus. In reviewing the different interfaces it was determined that the MIDI network introduced additional latency and ESPNow testing showed overall poor message reliability (< 100%). CAN bus was selected for its flexibility, reliability, built-in ESP32 controller support, and available Arduino library.

Distributed System Architecture using CAN Bus Intra-System Connections

The VPO distributed system was partitioned into four separate hardware assemblies to support interfacing with different organ components. The assemblies all use a common system voltage set by the motorized stop voltage, have an ESP32 38-pin plug-on module, and CAN bus interconnect.

With the distributed system architecture there is the ability to add more unique hardware assemblies as needed to support different interfaces and functions. For example if a user wanted to minimize wiring using a switch matrix, a new assembly that supports 8×12 matrix with up to 80 switches could be developed and integrated into the existing system with minimal changes.

System Asesmblies

Four unique system building block assemblies were selected.

  • MID Assembly for VPO MIDI, user interface, and expression pedal inputs
  • Switch Interface Assembly for non-motorized normally open on/off switches
  • Stop Interface Assembly for motorized and lamp indicator stops
  • LED Interface Assembly to control multiple 24VDC LED lighting strips

All assemblies use common firmware and have several common hardware design elements.

  • Input reverse voltage protection
  • 12-24VDC to 5VDC buck converter
  • ESP32 38-pin plug-in module supporting multiple physical widths
  • CAN bus interface
  • Config button
  • Activity and Error LEDs
  • Screw terminal sensor wiring connections
  • Mounting

The system power supply voltage is set by the motorized stop control voltage, which can range between 12VDC to 24VDC. The LED lighting control is designed to support up to 4 independent strips at 24VDC up to 10ADC each.

MIDI Assembly

The MIDI assembly provides the VPO bi-direction MIDI system interface using standard 5-pin DIN connectors. The VPO connection is through a USB/MIDI interface. The MIDI assembly receives VPO MIDI messages and converts them to assembly CAN bus messages. It also receives assembly CAN bus messages and converts them to VPO MIDI messages.

The MIDI assembly also provides the user and expression pedal interfaces as well as providing four (4) additional aux switch inputs. The user interface is designed to use a Nextion Intelligent 7″ touch display that is used for system control, feedback, configuration, and LED/display lighting control. Expression pedal (analog) inputs have a single pole RC 25Hz LPF feeding a non-inverting buffer before being sampled by a quad I2C 14-bit ADC.

MIDI Assembly with ESP32 Module is the VPO system interface

Switch Interface Assembly

The switch interface assembly supports up to 96 switch inputs and provides up to 12 commons/grounds. Most VPO switch implementations use a switch matrix to reduce the number of wires. For example an 8×12 switch matrix supports 96 switches using only 20 wires. When using a switch matrix diodes are required to eliminate ghosting when more than one switch is pressed at a time.

For this application the client wanted an assembly that supported 96 switches. There are very few key matrix ICs that support that many switches. Most common switch matrix ICs supports between 64 and 80 switches for keyboard applications. Since IC support was lacking and custom design such as an FPGA increased cost, a non-matrix approach was used where six, 16:1 muxes were used to sample all 96 potential inputs.

Switch Interface Assembly supports non-matrixed 96 switch inputs

Stop Interface Assembly

The stop interface assembly supports up to 16 motorized stops with a maximum current of 600mA per solenoid. Solenoid control uses a L293D motor controller that has built-in flyback diodes helping to minimize board space and components. All 16 motorized stop interfaces support a switch and two solenoids.

The stop interface assembly also supports lighted draw stops. When the stop is on, the light is on. These draw stop lamps typically need less than 50mA to operate.

The number of active motorized stops (energized to change state/move) is limited 2.4ADC and protected by a resettable fuse. The number of active stops is a configuration parameter. If the motorized stop current is 400mA the maximum number of active stops is limited to a total of 6. Active motorized stops that exceed the maximum number are held in a queue. Once an energized stop changes state, the next motorized stop in the queue becomes active.

Motorized stop solenoid wiring supports polarized common + or common – connections with each coil signal available at the connector. To use a common coil connection either use two wires from the stop common or add a jumper at the assembly screw terminal connection.

Stop Interface Assembly supports up to 16 motorized stops (pictured with manufacturing rails still attached)

LED Interface Assembly

The LED interface assembly is used to control the brightness of four (4), independent 24VDC LED lighting strips. These LED strips provide appropriate lighting for the organist and dimmed based on user preference. The LED brightness is controlled using MOSFET switch and a 25kHz PWM signal. The user interface controls brightness.

CAN Bus Intra-System Interconnect

CAN bus 2.0 was used for intra-system communication with a custom application layer protocol to support MIDI, control, status, and configuration messages. Each assembly has two CAN bus pair connections that use unshielded twisted pair wiring with about 1 twist per inch. The last/end assemblies used CAN bus specified 120 ohm leaded termination resistors. The CAN bus bit rate was set at 1Mb/s and used only 29-bit extended IDs.

User Interface

A Nextion Intelligent 7″ touch display provides the user interface with connections to the MIDI assembly. The MIDI assembly provides the 5VDC power and serial interface using 3V3/5V MOSFET voltage translators. The UI screens and display code were developed using Nextion free HMI editor. The user interface supports:

  • Runtime system feedback and transpose control
  • Lighting control
  • Detailed system status
  • System setup

Runtime System Feedback

At startup and after a splash screen, the runtime system screen is displayed. This screen provides feedback on the current active pedal positions, MIDI activity, overall system status, and transpose control. On the right side are menu icons for LED/display lighting control (lightbulb), detailed system status (chip), configuration (gear), and current screen information/help (i).

To transpose all manuals and foot pedals, the organist sets the semitone and/or octave values using the arrows and then touches the transpose button. Touching the transpose button again disables note transposing.

Light Control

Light control has sliders to set an item brightness between 0% (off) and 100%. LED strips also have quick buttons to set an LED strip to off, 50%, or 100% brightness. The organist returns to the main runtime screen by touching the organ icon in the upper right. The screen also auto returns to the main runtime screen after a period of inactivity.

System Status

Touching the chip icon on the main screen shows detailed system status per assembly. For each assembly the configured ID and detailed status are shown. Using buttons the organist can clear assembly status, mute the output, or reset the assembly. Up to 10 assemblies per page are displayed.

System Setup

The VPO hardware and firmware are highly configurable to support a wide range of organ configurations. The system setup screen, which is password protected, is used to configure individual assemblies. An assembly enters configuration mode by pressing the assembly configure button. The installer can set each assembly’s ID as well as setup stop operating parameters for stop interface assemblies.

For switches the installer selects the switch type, MIDI channel, pitch, velocity, and switch debounce time. The installer can set individual or groups of switches. In a group the pitch and switch number of incremented. All configuration is stored locally in the ESP32 using the preferences library.

Firmware

A common firmware image was developed in the Arduino environment to support all assemblies. The firmware uses on-assembly straps to identify the assembly type. The firmware runs FreeRTOS for tasks, message queues, and mutexes support.

The firmware used libraires for the CAN bus interface and software switch debouncing. The CAN bus library needed modifications due to issues with extended ID filtering and bus rates across different ESP32 silicon revisions.

Assembly Schematic, Layout and Production

EasyEDA standard edition was used to generate assembly schematics and create the printed wiring board layouts. EasyEDA is a free, web based tools set, and is linked with a component distributor and assembly house. All the assemblies were manufactured using JLCPCB. All assembly designs were two sided. Only the stop and LED interface assemblies required 2oz copper to support anticipated currents.

Hauptwerk

A system was configured and demonstrated on Hauptwerk Version 9 using the St. Anne’s Moseley organ. Hauptwerk setup used built-in auto detection methods that work well with the system hardware and firmware. Although not tested, it is anticipated that this project’s assemblies are compatible with other available VPO applications.

Leave a Reply