Sunday, December 12, 2010

[mvioxnux] Chords

A chording keyboard can achieve an incredible number of combinations, especially if we allow ordering to matter, allow some keys to be released while others are held, and allow timing to matter.  Here is a computer program which enumerates.  Some assumptions:

The thumb controls multiple buttons, but pushes one at a time.  The other fingers are one button each.

The possible actions are Key Up, Key Down, and Beat (holding the current state for a moment).  "Beat" was inspired by "iambic" Morse code keyers, which, while holding down one or both paddles, with audio feedback, can use timing to specify different things.

The program brute force enumerates all possible sequences of actions of a given length, and then applies filters. This was not the most efficient method, but good enough to start.

Essential filters:
Key Up and Down must alternate.  This hard coded; not implemented as a filter.
Must end with all keys up.
At least one key must be down at all times.  "All up" is a separator.
Thumb may press down only one key at a time
There must be at least a beat between the thumb shifting keys.
No two beats in a row.

With a four-button keyboard, the thumb controlling two buttons, and the index and middle fingers pushing the other two, here are the number of possibilities, by maximum length of sequence.   This was a computationally expensive calculation, taking hours.

One hand

Length of action sequence Chords
1 0
2 4
3 4
4 20
5 60
6 220
7 836
8 2824
9 10400
10 36752
11 131400
12 471096
13 1680024
14 6015832
15 21500784

Two hands

Length of action sequence Chords
1 0
2 8
3 8
4 104
5 312
6 3160
7 14440
8 125856
9 722944
10 5702432
11 37196768

Other possible filters:
No beats
Permit multiple beats in a row, like iambic Morse.
Chords on one hand can involve at most two fingers, one of which is the thumb.
Chords on two hands can involve at most three fingers.
All the downs precede all the ups.
The order of the ups does not matter.
The order of the downs does not matter.
Arpeggiations between two hands cannot start at one hand, go to the other, and go back to the first hand.

source code

No comments :