qmk_firmware/docs/feature_stenography.md
Jacob Jerrell eeba0cec17
Pull in Upstream (#1)
* Various tweaks for some Input:Club build processes

* change KEYMAP to LAYOUT for all new keyboards made using this script

* Add support for rev3 of the Atom47 (#2672)

* Added support for rev3 of the Atom47

* Updated Atom47 readme's

* Fix redefine error on rev2 and add maartenwut's keymap

* Fix redefine error on LEdiodes keymap

* Add Nyquist keymap (#2692)

* nyquist

* danielhklein nyquist setup

* shift left controls

* remove readme

* cleanup before pr

* ready for pr

* Adds Phantom TKL support (#2696)

* Add an info.json to phantom keyboard

* Add layouts

 - KEYMAP_WINKEYLESS
 - KEYMAP_7BIT
 - KEYMAP_ISO
 - KEYMAP_ISO_WINKEYLESS

* Add key_counts

* Add 2 missing F-Row keys

* Add TKC1800 info.json

Created an info.json for the tkc1800.

* Clueboard 60 info.json

 - adds
   - LAYOUT_60_ansi
   - LAYOUT_60_iso
   - KEYMAP_AEK
   - KEYMAP
   - LAYOUT_60_ansi_split_bs_rshift

* Add the Speedo keyboard

* Fix KC60 info.json file (#2707)

* change KEYMAP to LAYOUT in all the KC60 files

* Redo the info.json file

* Small fixes to TKC1800

 - adjust F-row to use 0.25 spacing
 - split left shift
 - add key_count

* Fix some Configurator Warnings regarding LAYOUT vs KEYMAP (#2708)

* change diverge 3 KC_KEYMAP to LAYOUT

* Change KEYMAP to LAYOUT for handwired arrow pad

* change M10A to LAYOUT for m10-a

* Change KC_KEYMAP to LAYOUT_kc and KEYMAP to LAYOUT for mf68

* change KC_KEYMAP to LAYOUT for nano

* Refactor to LAYOUT

* refactor to LAYOUT-ansi and LAYOUT_iso for s65

* LAYOUT conversions for lfkkeyboards

* missed a few renames

* mini1800 for lfkeyobards support of LAYOUT

* Improve state/chord handling and clean up namespace

Some values that can never, ever, change were held in local
variables, rather than in PROGMEM. Fixed.

Change "pressed" to a signed int so the test for < 0 makes
sense, and to avoid possible weird failure modes in the
case where a key release comes in when pressed is already
zero. (Shouldn't happen, sure, but computers are weird.)

A lot of things in process_steno had external linkage for no
particular reason. They've been marked static. Stuff still
builds.

Distinguish between currently-held keys and keys that have
been held, and expose these values through a nicely-named API
so other code could, say, check on the current set of steno
chording in order to make displays. Also in passing fix up the
"state" value having external linkage so it could clash with
other people's variable declarations.

The API also provides hooks for key processing and steno chord
events, so you can monitor those events without having to
run in matrix_scan_user and recheck the values directly. Also
document these.

There is no path through processing a key that doesn't
end with a return false, so the nested return foo() are
gone and we just return false.

* Pull information from config.h and rules.mk (#2711)

* Pull information from config.h and rules.mk

* Readd the kbd75 maintainer

* Remove obsolete info.json entries (#2712)

* Clean up some long-standing errors when populating the API (#2715)

* More Configurator Warning Fixes (#2716)

* mf68_ble did not have the correct .c and .h files

* Fix JC65 KEYMAP to LAYOUT

* Change KEYMAP to LAYOUT for s60_x

* Convert KEYMAP to LAYOUT for lets_split boards

* Convert KEYMAP to LAYOUT

* more fixes to keymap for iris

* convert KEYMAP to LAYOUT for levinson keyboard

* change losinggeneration's KEYMAP to LAYOUT

* convert KEYMAP to LAYOUT

* convert KEYMAP to LAYOUT for nyquist

* convert KEYMAP to LAYOUT

* convert KEYMAP to LAYOUT for viterbi

* convert KEYMAP to LAYOUT

* convert KEYMAP and its subsidiries to the LAYOUT standard

* convert KEYMAP and its subsidiries to the new LAYOUT standard

* Normacos keymap for let's split keyboard (#2691)

* Cheers let's split keymap

* fixed typo on norman layer of cheers keymap for let's split

* fixed right handed mappings for home row

* cheers keymap for let's split redefinition

* updated Cheers keymap for let's split

* cheers keymap for let's split updated with some terminal macros

* renamed cheers let's split keymap to a more appropriate normacos

* updated normacos keymap doc / removed non functional keys

* reset let's split rules to default values

* added more spotlight search macros

* normalized keymap comments

* Moved numpad on lower layer

* hhkb jp personal keymap (#2698)

* Add JJ40 Cockpit personal keymap (#2713)

* Add JJ40 Cockpit keymap

* Fix lower layer symbols

* Add readme for "major" keyboards to eliminate more QMK Configurator errors (#2718)

* add readme to ktype keyboard

* add readme to m10a

* add readme to mini1800

* add readme to parent directory
2018-04-10 20:21:40 -05:00

7.4 KiB

Stenography in QMK

Stenography is a method of writing most often used by court reports, closed-captioning, and real-time transcription for the deaf. In stenography words are chorded syllable by syllable with a mixture of spelling, phonetic, and shortcut (briefs) strokes. Professional stenographers can reach 200-300 WPM without any of the strain usually found in standard typing and with far fewer errors (>99.9% accuracy).

The Open Steno Project has built an open-source program called Plover that provides real-time translation of steno strokes into words and commands. It has an established dictionary and supports

Plover with QWERTY Keyboard

Plover can work with any standard QWERTY keyboard, although it is more efficient if the keyboard supports NKRO (n-key rollover) to allow Plover to see all the pressed keys at once. An example keymap for Plover can be found in planck/keymaps/default. Switching to the PLOVER layer adjusts the position of the keyboard to support the number bar.

To use Plover with QMK just enable NKRO and optionally adjust your layout if you have anything other than a standard layout. You may also want to purchase some steno-friendly keycaps to make it easier to hit multiple keys.

Plover with Steno Protocol

Plover also understands the language of several steno machines. QMK can speak a couple of these languages, TX Bolt and GeminiPR. An example layout can be found in planck/keymaps/steno.

When QMK speaks to Plover over a steno protocol Plover will not use the keyboard as input. This means that you can switch back and forth between a standard keyboard and your steno keyboard, or even switch layers from Plover to standard and back without needing to activate/deactivate Plover.

In this mode Plover expects to speak with a steno machine over a serial port so QMK will present itself to the operating system as a virtual serial port in addition to a keyboard. By default QMK will speak the TX Bolt protocol but can be switched to GeminiPR; the last protocol used is stored in non-volatile memory so QMK will use the same protocol on restart.

Note: Due to hardware limitations you may not be able to run both a virtual serial port and mouse emulation at the same time.

TX Bolt

TX Bolt communicates the status of 24 keys over a very simple protocol in variable-sized (1-5 byte) packets.

GeminiPR

GeminiPR encodes 42 keys into a 6-byte packet. While TX Bolt contains everything that is necessary for standard stenography, GeminiPR opens up many more options, including supporting non-English theories.

Configuring QMK for Steno

Firstly, enable steno in your keymap's Makefile. You may also need disable mousekeys, extra keys, or another USB endpoint to prevent conflicts. The builtin USB stack for some processors only supports a certain number of USB endpoints and the virtual serial port needed for steno fills 3 of them.

STENO_ENABLE = yes
MOUSEKEY_ENABLE = no

In your keymap create a new layer for Plover. You will need to include keymap_steno.h. See planck/keymaps/steno/keymap.c for an example. Remember to create a key to switch to the layer as well as a key for exiting the layer. If you would like to switch modes on the fly you can use the keycodes QK_STENO_BOLT and QK_STENO_GEMINI. If you only want to use one of the protocols you may set it up in your initialization function:

void matrix_init_user() {
  steno_set_mode(STENO_MODE_GEMINI); // or STENO_MODE_BOLT
}

Once you have your keyboard flashed launch Plover. Click the 'Configure...' button. In the 'Machine' tab select the Stenotype Machine that corresponds to your desired protocol. Click the 'Configure...' button on this tab and enter the serial port or click 'Scan'. Baud rate is fine at 9600 (although you should be able to set as high as 115200 with no issues). Use the default settings for everything else (Data Bits: 8, Stop Bits: 1, Parity: N, no flow control).

On the display tab click 'Open stroke display'. With Plover disabled you should be able to hit keys on your keyboard and see them show up in the stroke display window. Use this to make sure you have set up your keymap correctly. You are now ready to steno!

Learning Stenography

Interfacing with the code

The steno code has three interceptible hooks. If you define these functions, they will be called at certain points in processing; if they return true, processing continues, otherwise it's assumed you handled things.

bool send_steno_chord_user(steno_mode_t mode, uint8_t chord[6]);

This function is called when a chord is about to be sent. Mode will be one of STENO_MODE_BOLT or STENO_MODE_GEMINI. This represents the actual chord that would be sent via whichever protocol. You can modify the chord provided to alter what gets sent. Remember to return true if you want the regular sending process to happen.

bool process_steno_user(uint16_t keycode, keyrecord_t *record) { return true; }

This function is called when a keypress has come in, before it is processed. The keycode should be one of QK_STENO_BOLT, QK_STENO_GEMINI, or one of the STN_* key values.

bool postprocess_steno_user(uint16_t keycode, keyrecord_t *record, steno_mode_t mode, uint8_t chord[6], int8_t pressed);

This function is called after a key has been processed, but before any decision about whether or not to send a chord. If IS_PRESSED(record->event) is false, and pressed is 0 or 1, the chord will be sent shortly, but has not yet been sent. This is where to put hooks for things like, say, live displays of steno chords or keys.

Keycode Reference

As defined in keymap_steno.h.

Note: TX Bolt does not support the full set of keys. The TX Bolt implementation in QMK will map the GeminiPR keys to the nearest TX Bolt key so that one key map will work for both.

GeminiPR TX Bolt Steno Key
STN_N1 STN_NUM Number bar #1
STN_N2 STN_NUM Number bar #2
STN_N3 STN_NUM Number bar #3
STN_N4 STN_NUM Number bar #4
STN_N5 STN_NUM Number bar #5
STN_N6 STN_NUM Number bar #6
STN_N7 STN_NUM Number bar #7
STN_N8 STN_NUM Number bar #8
STN_N9 STN_NUM Number bar #9
STN_NA STN_NUM Number bar #A
STN_NB STN_NUM Number bar #B
STN_NC STN_NUM Number bar #C
STN_S1 STN_SL S- upper
STN_S2 STN_SL S- lower
STN_TL STN_TL T-
STN_KL STN_KL K-
STN_PL STN_PL P-
STN_WL STN_WL W-
STN_HL STN_HL H-
STN_RL STN_RL R-
STN_A STN_A A vowel
STN_O STN_O O vowel
STN_ST1 STN_STR * upper-left
STN_ST2 STN_STR * lower-left
STN_ST3 STN_STR * upper-right
STN_ST4 STN_STR * lower-right
STN_E STN_E E vowel
STN_U STN_U U vowel
STN_FR STN_FR -F
STN_PR STN_PR -P
STN_RR STN_RR -R
STN_BR STN_BR -B
STN_LR STN_LR -L
STN_GR STN_GR -G
STN_TR STN_TR -T
STN_SR STN_SR -S
STN_DR STN_DR -D
STN_ZR STN_ZR -Z
STN_FN (GeminiPR only)
STN_RES1 (GeminiPR only)
STN_RES2 (GeminiPR only)
STN_PWR (GeminiPR only)