pi-dictate
v1.0.6
Published
Voice dictation extension for Pi - speak into your mic, text appears in the editor
Readme
pi-dictate 🎤
Dictate into Pi with your microphone. Toggle recording with a shortcut; the transcription is pasted into the editor.
How it works in one line: your shortcut (default Ctrl+q) starts/stops a 16 kHz mono recording, which is transcribed locally (whisper.cpp) or in the cloud (OpenAI Whisper), then pasted into the Pi editor.
Quick start
Install the extension (one time):
pi install npm:pi-dictate⚠️ The
npm:prefix is required. A barepi install pi-dictateis interpreted as a local folder path and fails with "Path does not exist".Install a microphone recorder (one time):
- macOS or Linux:
brew install sox(Homebrew works on both — on Linux the distro-native alternative issudo apt install sox)
- macOS or Linux:
Set up a transcription backend (pick one — local is recommended for privacy and works offline):
Recommended: Local (private, offline, free)
- Install whisper.cpp:
brew install whisper-cpp(works on macOS and Linux) or build from whisper.cpp - Download a model (the small
base.enis a good start; see the models list for better accuracy):curl -L -o ~/ggml-base.en.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-base.en.bin export WHISPER_MODEL_PATH=~/ggml-base.en.bin
Alternative: Cloud (OpenAI Whisper) — requires an API key and sends audio to OpenAI:
export OPENAI_API_KEY=sk-...- Install whisper.cpp:
Restart Pi. On startup you should see:
[voice] Voice input extension loaded (Ctrl+q) [voice] • Recorder: sox [voice] • Backend: 🏠 local STT (or ☁️ cloud STT)Dictate: press
Ctrl+qto start, speak, pressCtrl+qagain. The text is pasted into the editor.
Troubleshooting
| You see | Meaning | Fix |
|---|---|---|
| Path does not exist: .../pi-dictate | Installed without the npm: prefix | pi install npm:pi-dictate |
| Backend: ⚠️ no STT configured | No transcription backend set | Configure one in step 3, restart Pi |
| Crash: spawn sox ENOENT at startup | You ran a very old pre-1.0.2 build | pi uninstall npm:pi-dictate && pi install npm:pi-dictate |
| Mic permission prompt / silence | OS microphone permission | Grant microphone access to your terminal app |
Updating
pi update npm:pi-dictateConfiguration (environment variables)
| Variable | Default | Purpose |
|---|---|---|
| VOICE_INPUT_SHORTCUT | Ctrl+q | Toggle key, e.g. "Ctrl+k" |
| STT_BACKEND | auto | Force local or cloud (auto prefers local if available) |
| WHISPER_MODEL_PATH | auto-discovered | Path to a whisper.cpp .bin model |
| WHISPER_LANGUAGE | auto | Language hint, e.g. "it", "fr" |
| OPENAI_API_KEY | — | Enables the cloud (OpenAI Whisper) backend |
| DEBUG_VOICE | off | Set to 1 for verbose startup/log output |
Requirements
- Node.js 18+ (ships with Pi)
- Recorder:
soxorffmpeg(sox recommended) - Microphone permissions in your OS
- Local STT:
whisper-cpp+ a downloaded model
