Skip to main content

A background daemon for Wayland that transcribes audio and types results.

Project description

Harp 🎵

Version License: MIT CI Python 3.12+

Harp is a background daemon for Linux (Wayland) that turns your voice into text, typed live into the focused window. Harp is local-first and real-time: while you hold (or, in toggle mode, after you click) Ctrl+Space, audio is re-decoded over a rolling window with faster-whisper, and the stable prefix is typed as you speak — with minimal backspace+retype back-patches when the model revises an earlier word. There is no cloud LLM step and no separate command mode: one hotkey, one mode, fully on-device.

📚 Documentation

For in-depth information, please refer to our documentation:

✨ Features

...

  • Local-First, Fully Offline: Powered by faster-whisper. Your voice never leaves your machine.
  • Real-Time Streaming Dictation: While you speak, Harp re-decodes a rolling window and types the stable prefix live, using LocalAgreement-2 to commit only words confirmed across consecutive passes.
  • Back-Patch Typing: When the model revises an earlier word, Harp emits a minimal backspace + retype diff instead of waiting until the end — your buffer always reflects the current best transcription.
  • Single Hotkey, Single Mode (Ctrl + Space): Hold to dictate, or --toggle to click-on / click-off. No separate command mode; no clipboard-context mode.
  • Direct Keyboard Emulation: Transcribed text is typed directly into the focused application via uinput.
  • Model Management CLI: Easily download, list, and manage Whisper models (tiny, base, small, medium, large-v3) via harp models.
  • Tunable Cadence (--slide): Control how often the rolling window is re-decoded — match it to your hardware's decode wall-time for stable streaming.
  • Modern CLI: Terminal UI powered by Rich.

🚀 Installation

Using uv (Recommended)

The fastest way to run Harp without manual environment setup:

uvx harpio

Using pipx

For a persistent global installation:

pipx install harpio

From Source

git clone https://github.com/apiad/harp.git
cd harp
uv sync
uv run harp start

🛠 Setup & Requirements

  1. Permissions: Harp requires access to /dev/input and /dev/uinput.
sudo usermod -aG input $USER
# You may also need to set udev rules for uinput or run:
sudo chmod 666 /dev/uinput
  1. Whisper Model: Before starting for the first time, download a Whisper model.
harp models download base
  1. Dependencies: Ensure libportaudio2 and wl-clipboard (for Wayland clipboard support) are installed.
sudo apt install libportaudio2 wl-clipboard

⌨️ Usage

Start the daemon using the CLI. By default, running harp without arguments starts the background daemon in "Hold Mode" and only prints the result to the terminal.

harp

Commands

  • harp: Starts the background daemon (alias for harp start).
  • harp start: Starts the background daemon with explicit options.

Configuration & CLI Options

You can customize Harp's behavior using the following flags:

Option Short Description Use Case
--device <path> -d Target a specific input device (e.g., /dev/input/event0). Useful if you have multiple keyboards and only want to trigger Harp from one specific device.
--toggle -t Enable toggle mode instead of hold mode. Press Ctrl+Space once to start dictating, press again to finalize.
--full -f Disable safe filtering and type all returned characters, including symbols. Essential when dictating code, complex punctuation, or URLs.
--copy Automatically copy the final transcribed text to your clipboard. Dictate an idea, let Harp type it live, and also have the final text ready to paste elsewhere.
--type Type the streaming result live into the focused window (default: False). Enable with harp start --type to use Harp as a real-time dictation engine.
--slide <s> Cadence between rolling re-decode passes (seconds). Default: 1.0. Raise on slower CPUs / larger models so the slide stays above single-window decode time.

Examples

Live dictation, all symbols, toggle:

harp start --toggle --full --type

Slow CPU with a larger model: raise the slide so re-decodes don't queue.

harp start --type --slide 1.5

🤝 Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

🤖 Gemini CLI

This repository is enhanced with custom Gemini CLI commands to automate common tasks and workflows. If you are using Gemini, you can run:

gemini /onboard

to get started, explore the project architecture, and understand the automated workflows (planning, debugging, releases, etc.).

Standard Process

  1. Report Bugs: Open an issue if you find something broken.
  2. Suggest Features: Have an idea for a new mode? Let us know!
  3. Submit Pull Requests:
    • Fork the project.
    • Create your Feature Branch (git checkout -b feature/AmazingFeature).
    • Commit your changes (git commit -m 'feat: Add some AmazingFeature').
    • Push to the branch (git push origin feature/AmazingFeature).
    • Open a Pull Request.

📄 License

Distributed under the MIT License. See LICENSE for more information.

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

harpio-0.7.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

harpio-0.7.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file harpio-0.7.0.tar.gz.

File metadata

  • Download URL: harpio-0.7.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for harpio-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d946f4c74b7fbb768f8fd3a97da9ba28b0d761d51d5f2d158ecd351dcf9c9cb3
MD5 d7e7901b0e692924f323f6f52971b0bf
BLAKE2b-256 1042322a43386d6e4b64e57785886c0d2d478fe1d20eaf45af9a62cd54c29221

See more details on using hashes here.

File details

Details for the file harpio-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: harpio-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for harpio-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb87db93c16fe9b9023e32c3f458ab764f4a6513e7a90e58a07912c198a173a8
MD5 8c2bc8ca8037714abe628ef4f2a82508
BLAKE2b-256 4b7f2e4957ebf750415807873716aadb31520044e7c71cffc87d5eb0d969a04b

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