voxa

[Archived] Voice typing on Linux with Google's leading-edge AI

by wrycode (z6MkuCL8…x3Mu)

rad:zPaD5CAmxGBYrb73TqV6Gvr5fGF5 branch main HEAD 025e46c3 updated 1y ago
https git clone https://code.wrycode.com/rad:zPaD5CAmxGBYrb73TqV6Gvr5fGF5.git voxa
radicle rad clone rad:zPaD5CAmxGBYrb73TqV6Gvr5fGF5 voxa

Voxa: Voice typing on Linux with Google's leading-edge AI

Voxa allows you to type on Linux by speaking to your computer.

Basically, the goal was to bring the
Gboard
voice transcription feature to Linux by using the same AI. The following features
are implemented or planned:

  • Works on any Linux (X11, Wayland, etc.)
  • Spoken Emojis ("woman police officer emoji" = 👮‍♀️)
  • Automatic Punctuation (Google AI will infer commas, periods, etc.)
  • Spoken Punctuation ("comma", "new paragraph", etc.)
  • Endless Transcription
  • Automatic Language Detection
  • Notification sound when starting and stopping transcription
  • Automatic stop after 1 minute not speaking
  • User configuration these above features ↑

The following features are being considered but not yet planned:

  • Speech detection; start/stop transcription stream based on audio
    level or local speech detection (to save money)
  • User manual translations
  • support Gboard "clear" and "delete" commands
  • Linux distribution packaging

Pricing

Voxa is free and open source software, but the AI costs
money. Transcription costs $0.016/minute, but you get $300 of free
Google cloud credit with new accounts, so transcription is essentially
free for 90 days.

Installation

TODO: packaging

For now, you must build from source using the instructions below

Google Cloud setup

TODO: add instructions to set up Google Cloud and set an API key.

Usage

./build/voxa

Runs Voxa in streaming keyboard emulation mode. Voxa will act as a keyboard and type the transcription as you speak. Make sure you switch to the window where you want to collect the text before speaking. Remember that Voxa is actively typing as an emulated keyboard, so you can't click around while it transcribes!

Voxa will play a start sound when it is connected and streaming audio to the Google API and a stop sound when the stream is disconnected. You can disable these sounds with VOXA_SILENT=true. Note that the API does not support continuous streaming for more than 5 minutes, so every 5 minutes Voxa will automatically reconnect.

Languages

Supported languages are listed here. By default, the primary language is en-US. Change the primary language by setting the VOXA_PRIMARY_LANGUAGE environment variable. Add up to three alternative languages by setting the VOXA_ALT_LANGUAGES environment variable.

For instance:

VOXA_PRIMARY_LANGUAGE="da-DK" VOXA_ALT_LANGUAGES="cmn-Hans-CN,ja-JP,es-MX" ./build/voxa

This will run Voxa with the primary language set to Danish, but you can speak Mandarin Chinese, Japanese, or Spanish.

Build instructions

  1. git clone --recurse-submodules --shallow-submodules https://github.com/wrycode/vtt.git

  2. Install development and runtime dependencies for the main code: CMake, GCC, Catch2, ICU, just, Gstreamer, probably a few more I've forgotten

  3. Install dependencies for the Cloud Speech-to-Text API C++ Client Library: https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packaging.md#required-libraries

On Arch Linux, all the dependencies can be installed with:

  • sudo pacman -S cmake abseil-cpp grpc curl nlohmann-json just icu catch2
  • manually install google-crc32c from the AUR
  1. Run just to build and compile

TODO debugging

  • GST_DEBUG=true
  • TODO set up logging

Enabling virtual keyboard

Keys are typed using the uinput kernel interface, exposed in /dev/uinput. The program needs to have permissions to write to /dev/uinput. The easiest way is to chmod /dev/uinput, but there is probably a smarter way with udev.

Unicode characters

For languages other than English, you must have IBus. It may be enabled/installed already. You can test if it is installed by typing Ctrl+Shift+U (then release), then 2+7+0+5. You should see: ✅

Branches

Recent commits

Latest 30 commits on main.

025e46c3 Merge pull request 'Add start and stop sound' (#2) from start/stop_sound into main
Reviewed-on: https://codeberg.org/wrycode/voxa/pulls/2
wrycode 1y ago
c31e2be8 Add start and stop sound wrycode 1y ago
69a5342c Add alternative languages and primary language configuration wrycode 1y ago
d1fce67a Merge pull request 'endless-transcription' (#1) from endless-transcription into main
Reviewed-on: https://codeberg.org/wrycode/voxa/pulls/1
wrycode 1y ago
6cb2f873 Update readme wrycode 1y ago
45a846d4 Add endless transcription wrycode 1y ago
7ce48d72 Add exit signal handling, profiler flag, and fix thread bug wrycode 2y ago
4acef42e Reuse icu::BreatIterator instead of creating one for each segment wrycode 2y ago
71a88cae Add license wrycode 2y ago
a984c3f5 Replace "vtt" with "voxa" everywhere wrycode 2y ago
d6b84921 Update readme wrycode 2y ago
78eec318 Remove unused dep wrycode 2y ago
bbf70671 Clean up wrycode 2y ago
cedd9b7c Working vtt.cpp! wrycode 2y ago
407d9e68 Update unit tests for Keyboard and TranscriptionSegment wrycode 2y ago
fd0fd4d0 Fix a number of bugs in TranscriptionSegment wrycode 2y ago
bdb6d51e Add "e2e" keyboard tests that verify actual typed text wrycode 2y ago
9be047ff Add basic keyboard mocking for tests wrycode 2y ago
dfdbfff4 Add Keyboard class wrycode 2y ago
7547faab Implement type_unicode() and ndeletes() wrycode 2y ago
8bf6cc13 Implement movePoint (minus typing commands) wrycode 2y ago
a72fe764 Finish process_operations, move_forward, applyChange, and applyFinalChange wrycode 2y ago
df270168 Start building TranscriptionSegment class wrycode 2y ago
78edd75b Finish UnicodeString implementation and tests wrycode 2y ago
8fce5a4c Add basic tests for UnicodeString wrycode 2y ago
bf5d694e Start implementing full program structure wrycode 2y ago
c375fdef Some cleanup wrycode 2y ago
434a445b Fix WriteAudio! wrycode 2y ago
053218b8 Update stream.cpp, readme, and CMakeLists.txt wrycode 2y ago
c148a2f0 Simplify everything wrycode 2y ago