Skip to main content

Local speech-to-text for desktop using faster-whisper

Project description

stt2desktop

tests codecov stt2desktop @ PyPi Python Versions License GPL-3.0-or-later

Local speech-to-text for desktop using faster-whisper.

Let's you dictate text into any application without sending audio to any cloud services. Everything runs locally on your machine — no internet connection required after the initial model was download.

Currently only tested under Linux with KDE ;)

How it works

  1. Run ./cli.py listen (Whisper model downloaded on first run, cached on disk)
  2. Hold Scroll Lock to record from your microphone
  3. Release Scroll Lock — the audio is transcribed locally by faster-whisper
  4. The text is typed into the focused window via wtype (Wayland) or xdotool (X11)

Install via pipx

Requirements: Python 3.12+, a working microphone, and either wtype (Wayland) or xdotool (X11):

sudo apt install wtype     # Wayland
sudo apt install xdotool   # X11

You can install "stt2desktop" with pipx:

sudo apt install pipx
pipx install stt2desktop

Then run:

stt2desktop listen

The default global hotkey is Scroll Lock (In german: "rollen"). You can change it via the --hotkey option (see below). Proposal for alternative key: ctrl_r, alt_r, cmd_r, shift_r ;)

CLI listen

usage: stt2desktop listen [-h] [LISTEN OPTIONS]

Start the STT listener. Hold the hotkey to record, release to transcribe and insert.

╭─ options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ -h, --help                show this help message and exit                                                            │
│ -v, --verbosity           Verbosity level; e.g.: -v, -vv, -vvv, etc. (repeatable)                                    │
│ --model {tiny_en,tiny,base_en,base,small_en,small,medium_en,medium,large_v1,large_v2,large_v3,large,distil_large_v2, │
│ distil_medium_en,distil_small_en,distil_large_v3,distil_large_v3_5,large_v3_turbo,turbo}                             │
│                           Whisper model to use for transcription. (default: small)                                   │
│ --hotkey {alt,alt_l,alt_r,alt_gr,backspace,caps_lock,cmd,cmd_l,cmd_r,ctrl,ctrl_l,ctrl_r,delete,down,end,enter,esc,   │
│ f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,home,left,page_down,page_up,right,shift,      │
│ shift_l,shift_r,space,tab,up,media_play_pause,media_volume_mute,media_volume_down,media_volume_up,media_previous,    │
│ media_next,insert,menu,num_lock,pause,print_screen,scroll_lock}                                                      │
│                           Key to hold for recording. Release to transcribe and insert text. Proposal for alternative │
│                           key: ctrl_r, alt_r, cmd_r, shift_r. (default: scroll_lock)                                 │
│ --sample-rate INT         Audio sample rate in Hz. Whisper expects 16000. (default: 16000)                           │
│ --device STR              Device to run inference on, e.g. cpu or cuda. (default: auto)                              │
│ --compute-type STR        Quantization type, e.g. int8, float16, float32. (default: int8)                            │
│ --num-workers {None}|INT  Number of parallel transcription workers. Defaults to CPU count. (default: None)           │
│ --sounds, --no-sounds     Play notification sounds via chime. (default: True)                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Whisper models

Just a selection and approximate values:

Model Size Speed Accuracy
tiny ~75 MB fastest lowest
base ~145 MB fast good
small ~460 MB slower better (default)
medium ~1.5 GB slow high

Larger models produce more accurate transcriptions but take longer to process ;)

start development

At least uv is needed. Install e.g.: via pipx:

apt-get install pipx
pipx install uv

Clone the project and just start the CLI help commands. A virtual environment will be created/updated automatically.

~$ git clone https://github.com/jedie/stt2desktop.git
~$ cd stt2desktop
~/stt2desktop$ ./cli.py --help
~/stt2desktop$ ./dev-cli.py --help
usage: ./dev-cli.py [-h] {coverage,install,lint,mypy,nox,pip-audit,publish,test,update,update-readme-history,update-test-snapshot-files,version}



╭─ options ────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ -h, --help    show this help message and exit                                                                        │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ subcommands ────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ (required)                                                                                                           │
│   • coverage  Run tests and show coverage report.                                                                    │
│   • install   Install requirements and 'stt2desktop' via pip as editable.                                            │
│   • lint      Check/fix code style by run: "ruff check --fix"                                                        │
│   • mypy      Run Mypy (configured in pyproject.toml)                                                                │
│   • nox       Run nox                                                                                                │
│   • pip-audit                                                                                                        │
│               Run pip-audit check against current requirements files                                                 │
│   • publish   Build and upload this project to PyPi                                                                  │
│   • test      Run unittests                                                                                          │
│   • update    Update dependencies (uv.lock) and git pre-commit hooks                                                 │
│   • update-readme-history                                                                                            │
│               Update project history base on git commits/tags in README.md Will be exited with 1 if the README.md    │
│               was updated otherwise with 0.                                                                          │
│                                                                                                                      │
│               Also, callable via e.g.:                                                                               │
│                   python -m cli_base update-readme-history -v                                                        │
│   • update-test-snapshot-files                                                                                       │
│               Update all test snapshot files (by remove and recreate all snapshot files)                             │
│   • version   Print version and exit                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

History

  • v0.1.2
    • 2026-03-30 - print warning when not running on Linux
    • 2026-03-30 - Update requirements
    • 2026-03-27 - Update README
  • v0.1.1
    • 2026-03-27 - +Proposal for alternative hotkey
    • 2026-03-27 - fix color outputs
    • 2026-03-27 - Update requirements
    • 2026-03-27 - add missing license file.
  • v0.1.0
    • 2026-03-27 - Use chime to play notification sounds
    • 2026-03-27 - Try to fix github CI run
    • 2026-03-27 - Cleanup README
    • 2026-03-27 - pipx usage
  • v0.0.1
    • 2026-03-26 - Add POC
    • 2026-03-26 - init

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stt2desktop-0.1.2.tar.gz (126.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stt2desktop-0.1.2-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

File details

Details for the file stt2desktop-0.1.2.tar.gz.

File metadata

  • Download URL: stt2desktop-0.1.2.tar.gz
  • Upload date:
  • Size: 126.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for stt2desktop-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9c94e726690a8ecb541a6121f5fba253b3d04687c162ab6a295edc71b1d5945d
MD5 9a7b713a427debb9f34524d52bdb5985
BLAKE2b-256 b09b24e52c91466097549b8494ae5f005dce6ad35630c2b36b2417f5456ed90f

See more details on using hashes here.

File details

Details for the file stt2desktop-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: stt2desktop-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 29.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for stt2desktop-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b0556726a88751c47e97900481bed59f24ecbddc357cb9f764ad37efacd3e7a8
MD5 64e1e29c74631b6d28599e7591cbd081
BLAKE2b-256 a4e31a85552893c2925576cf84d005ef9a557bc96b088fb9e8b17aa3204cd812

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page