The Autonomous Harpsichord

I built this Flemish style harpsichord in 1973. In a recent restoration, I significantly improved the sound quality and response. Realizing I would never reach a level of keyboard skill to use the instrument to its capacity, I created an auto-performance system. I had several design goals:
  • Small footprint.
  • Easy installation and removal.
  • No modification of the harpsichord.
  • No stresses on the instrument beyond those typical of a human performer.
  • Dexterity comparable to an accomplished performer to access the full harpsichord repertoire.
  • Use of standard MIDI files for input, giving access to an extensive collection of performance pieces.
This video illustrates the current status of the project.

I used an Arduino Mega 2560 board as the onboard processor to control the solenoids. I wrote M2A, a Windows program, to analyze MIDI files and to send appropriate signals to the Arduino board. In the figure above, the left-hand side is a general file manager for organizing and searching MIDI file collections. Files may be added to the play box on the right. Files may be arranged in the list and automatically played in sequence. The program can drive a MIDI device and the harpsichord simultaneously.

Hand-wiring the prototype drive circuit.

MIDI sequences showing the effect of the NoteSep command in AnalogCorrector.

Although many MIDI files could be used directly, I noticed some missing notes in others. Skips sometimes appeared in Baroque sections with rapid note sequences. I recognized that MIDI files created for an electronic instrument with instantaneous response may not be directly applicable to mechanical instruments. The top section of the figure above illustrates one of the issues. When playing a repeated group of identical notes on an electronic instrument, there is no need for a delay between the NoteOff signal of the preceeding note and the NoteOn signal of the following note. The synthesizer simply restarts the envelope function. On the other hand, there must be sufficient time for the jack to fall between notes on a harpsichord.

I wrote the Analog Corrector program for the automatic transformation of MIDI files to a form suitable for mechanical instruments. The program can work on individual files or apply a bulk transformation to all files in a directory. After conversion to Type 0, the Clean operation performs the following functions:
  • Remove all unnecessary information like text and SysEx commands.
  • Convert all NoteOn/zero-velocity messages to NoteOff messages.
  • Move all remaining channel-specific messages to Channel 0.
  • Remove any overlapping notes.
  • Optionally, modify the tempo.
  • Confirm the validity of the resulting file.
The NoteSep command enforces a specified minimum seperation between repeated notes. The result is shown in the above figure. The Staccato command ensures that all notes in the file exceed a minimum specified length to allow the full rise and fall of the harpsichord jacks.

AnalogCorrector program.

The next phase of the development was improved power management. The 52 push solenoids are the heart of the system. Considerations of cost and spacing dictated the use of small solenoids not intended for continuous operation. At 12 V, each solenoid drew 900 mA of current to produce 5 N of force, sufficient to initiate harpsichord notes. In the initial circuit, the Arduino board simply turned on solenoids for the length of the notes. Considerable power was wasted — a sustaining current of less than 300 mA would have been sufficient to keep a key depressed after the initial strike. Although the system performed adequately in Scarlatti works with many rapid notes, there was unacceptable solenoid heating in Byrd works with sustained notes. Furthermore, large chords pulled down the 5A power supply, resulting in missed notes.

Pulse width modulation to reduce solenoid power consumption.

An advanced drive circuit would have involved a prohibitive amount of work when multiplied by 52. I decided on a software solution based on the unused computing power of the Arduino board. The idea was to apply a fixed voltage to the solenoid for the first 50 ms, sufficient to strike the note. The drive then switched to a pulse-width-modulation mode with approximately 30% duty cycle for the remainder of the note. The challenge was to implement waveform control on 52 independent notes while remaining within the capability of the 16 MHz Aduino board. The key was an efficient algorithm that added only 16 lines of on-board code. The figure above shows the MOSFET control voltage generated by the Arduino board at the beginning of a note. The modification reduced power dissipation and supply current by over a factor of 3, allowing extended harpsichord recitals. I also added a 2 F capacitor in parallel with the power source for reliable initiation of big chords.

– Stan Humphries (February, 2021)