VoiceGem

Dictating a closing curly brace and the line that follows it

Say “close brace”, “right brace” or “close curly” to produce }. The closing brace keeps a space on both sides, so “close brace else open brace” assembles as } else { — the exact spacing an else clause needs, produced without any knowledge of what language you are writing.

A seven-word else clause is about 8.1 seconds of typing against about 2.6 seconds of speech. (sources: Dhakal, Feit, Kristensson & Oulasvirta, “Observations on Typing from 136 Million Keystrokes”, CHI 2018, 168,000 participants, 136 million keystrokes; Yuan, Liberman & Cieri, “Towards an Integrated Understanding of Speaking Rate in Conversation”, Interspeech 2006, 2,438 American English telephone conversations (Switchboard corpus). The speech figure is conversational rate, not a measured dictation rate — no such measurement exists.)

What lands in your editor
} else {
	return false

This tool runs entirely in your browser. Nothing you type is sent anywhere, stored, or logged.

Step by step

  1. 1

    Close the body

    Say “close brace” when the block ends. Spacing is preserved on both sides, so the brace does not glue itself to the last statement or to whatever comes next.

  2. 2

    Chain the next clause in the same breath

    Say “else open brace” straight after. VoiceGem returns } else { with single spaces, which is what every common formatter for a brace language produces.

  3. 3

    Break the line when the construct is finished

    Say “new line” to end the statement, or “new paragraph” for a blank line between declarations. Both are whitespace commands rather than punctuation, and both are in the same table.

  4. 4

    Without dictation

    Press Shift-] or let auto-pairing close the block for you. Most editors also re-indent the closing brace when you type it, which dictation does not do — the Deterministic Pass emits characters and leaves indentation to your editor.

VoiceGem produces } else { without knowing which language you are in

Language detection is the usual way a code formatter decides how to space a construct, and it is a source of run-to-run variation because detection can change with context. VoiceGem does none of it. The closing brace, the word else and the opening brace are three independent table lookups, and the spacing falls out of three flags rather than out of a decision about your file.

The result is that the same phrase works identically in JavaScript, Java, Rust, Go, Swift, C and CSS. A page cannot honestly promise that about a model-based formatter, because a model's output depends on what else is in its context window.

Where the manual way breaks

Editors handle the closing brace well when you type it: most re-indent the line automatically the moment the character lands. Dictation does not do that, and this is a real gap rather than a rounding error — VoiceGem emits the character and your editor's own auto-indent may or may not fire on inserted text.

The case that still favours speaking is the long tail of a nested function: three or four closers, a catch clause, and a trailing comma, all of which are separate hand positions and all of which are one continuous sentence out loud. Dictate the structure, then let your editor's format-on-save fix the indentation in one pass.

Doing this somewhere else? the speech-to-code converter, what changes for the closing square bracket, the same thing for the closing parenthesis, or how the opening curly brace works.

Common questions

Sometimes. Auto-indent usually fires on typed characters rather than inserted text, so the honest answer is to dictate the structure and run format-on-save afterwards.

Say “close brace else open brace”. VoiceGem looks up three tokens independently and the spacing flags do the rest, with no language detection involved.

Say “new paragraph”, which emits two line breaks. “New line” emits one. Both are whitespace commands in the same lookup table as the symbols.

Close a nested block out loud and compare it to what you would have typed.

Open the tool