Version 2

Version 1 was unreliable, it required that the base instrument was modified and parts of it were 10 years old and somewhat out of date. 

The new version was initiated when I received a complete working instrument minus the reed blocks, which for this instrument weren't necessary. Its a model Hohner Club IIB Victoria with 30 melody keys in three rows and eight bass buttons.

The new design would also be cordless, communicating over Bluetooth, and consist of a keyboard element and a receiver/controller unit containing a midi sound chip but also capable of outputting the midi messages to another unit.

How does the melodeon keyboard work.


The original instrument plays by pushing or pulling the bellows to change the pressure inside

the instrument. By pressing a key, an air pathway is opened to allow air to pass through one or

more free reeds inside the instrument, aligned with pallets activated by the keys. The combination of

air pressure difference and key presses causes different notes to be played. The force with which the

bellows are moved and the speed of the keypress can alter the expression of the instrument. 

In a real instrument, the reeds do not generate sound unless there is sufficient air flowing through 

them, when the will begin to vibrate, but will continue to vibrate when the volume of air drops below

the initial value so there is a hysteresis in the instrument response. This varies in manufacture.

There is a maximum volume of air that the instrument can maintain through a single reed above which 

a reed will slow its vibrations and play 'flat'. This is not not emulated, but a volume limit is 

implemented in the bellows expression.

One key on the instrument, the air button or valve, does not have any reeds associated with it

and immediately reduces the pressure difference on the bellows to zero so that they can be moved

silently, either to fill the bellows with more air for playing, or to reposition them to a more comfortable 

playing position, or for storage. 


In the setup, pressure readings are taken from inside the bellows and an average

is calculated to be the reference pressure.


The keyboard is scanned and reference key closed readings are taken and recorded. Trigger values

are calculated based on these, for a value when the note is to start playing when a key is pressed, 

and a value for when the key is judged to have been released.


The main loop


The pressure is measured and compared to the reference pressure. If the pressure difference is 

above the threshold value, then the calculated expression value is transmitted to the controller 

together with the bellows direction. A positive pressure difference is taken to be a PUSH operation 

and a negative difference is taken to be a PULL operation. 

If the pressure difference falls below a separate thresold value (hysteresis), then the bellows are

taken to be static, slow moving or the air valve is open, when an 0 expression value is transmitted 

to the controller and the status of all keys is set to off. 

If the expression value is not changing, expression values are not transmitted.

If there is a change in bellows direction between readings, all keys on the instrument are turned off

and messages transmitted to indicate this.

In the prototypes, expression changes are limited to effectively ON or OFF.



The keys are read and when a key status is off, and its reading is below the trigger value, a key is judged 

to be pressed and a message is sent to the controller and the key status is updated to indicate it has been pressed.

When a key is read and a keypress is registered against it, the read value is checked against the 

lower margin for the key and if lower, the key status is updated to be off and a message is sent

to the controller to indicate this.  


The Controller

This receives the information from the keyboard as 5 byte messages, the three messages, expression, keypress 

and keyrelease forming the bulk of the playing messages.


The expression message consists of two parts, volume and direction. 

Expression volume is passed directly to the midi channel as the channel volume.

Direction is used together with key messages to determine which notes should be turned on/off

An expression value of zero turns all sounding notes off and midi messages are issued to achieve this.

A change in direction also turns all sounding notes off.


A keypress message is translated into a note or chord. If the expression value is non-zero, a 

midi note on message is sent and the midi on count for that note is incremented. 


A keyrelease message is translated into a note or chord, the midi on count for that note is 

decremented, and if zero, a midi off note is sent.


Key changes involving chords are translated into the respective notes and then handled as

individual notes. Where multiple keys may be causing the same note to be sounded, the 

midi off message for the note is not sent until all keys associated with that note have been released.


The controller mutes all sounds when the bluetooth connection is lost or it receives a power off message.