跨平台语音输入工具 —— 按住快捷键说话,松开自动输入(SenseVoice ONNX 本地推理,支持中英日韩粤混合)
Project description
English | 中文
Whisper Input
Cross-platform voice input tool — hold a hotkey, speak, release to have speech transcribed and typed into the focused window.
Uses the official DAMO Academy SenseVoice-Small ONNX quantized model (direct inference via Microsoft onnxruntime), fully offline after first download. Supports Chinese, English, Japanese, Korean, and Cantonese with built-in punctuation, inverse text normalization, and casing. The model is downloaded from ModelScope CDN (~231 MB) on first launch, then works permanently offline.
Supports Linux (X11) and macOS.
Features
- Local speech recognition, works offline
- Multi-language mixed input (Chinese, English, etc.)
- Configurable hotkey (distinguishes left/right modifier keys)
- Browser-based settings UI + system tray
- Auto-start on login
- Automatic platform detection with matching backend
System Requirements
Common
Linux
- Ubuntu 24.04+ / Debian 13+ (X11 desktop environment)
- Any x86_64 CPU (
onnxruntimeCPU inference, RTF ~ 0.1, latency < 1s for short utterances)
macOS
- macOS 12+ (Monterey or later)
- Apple Silicon (recommended) or Intel Mac, both use CPU ONNX inference
Installation
macOS
# Install system dependency
brew install portaudio
# Install the tool
uv tool install whisper-input
# or: pipx install whisper-input
# Run
whisper-input
First-run permissions required in System Settings > Privacy & Security:
- Accessibility and Input Monitoring (for global hotkey listening and text input)
- Microphone (for voice recording; the system will prompt on first recording)
Note: The PyPI-installed
whisper-inputruns as~/.local/share/uv/tools/whisper-input/bin/python(or~/.local/pipx/venvs/whisper-input/bin/pythonfor pipx). macOS permission dialogs will show this Python binary, not "Whisper Input.app". Add the corresponding Python path to Accessibility / Input Monitoring.
Linux
# Install system dependencies (see table below for details)
sudo apt install xdotool xclip pulseaudio-utils libportaudio2 \
libgirepository-2.0-dev libcairo2-dev gir1.2-gtk-3.0 \
gir1.2-ayatanaappindicator3-0.1
# Add yourself to the input group (evdev needs /dev/input/* access)
sudo usermod -aG input $USER && newgrp input
# Install the tool
uv tool install whisper-input
# or: pipx install whisper-input
# Run
whisper-input
System dependency reference:
| Package | Purpose | Notes |
|---|---|---|
xdotool, xclip |
Text input | xclip for X11 clipboard, xdotool to simulate Shift+Insert paste |
libportaudio2 |
Audio recording | PortAudio library, runtime dependency of Python sounddevice |
pulseaudio-utils |
Sound notifications | Provides paplay for start/stop recording sounds |
libgirepository-2.0-dev, libcairo2-dev |
Build dependencies | Headers for compiling pygobject and pycairo C extensions |
gir1.2-gtk-3.0 |
Recording overlay | GTK 3 typelib for the recording status overlay |
gir1.2-ayatanaappindicator3-0.1 |
System tray icon | AppIndicator typelib, runtime dependency of pystray on Linux |
On first run, whisper-input downloads the SenseVoice ONNX model (~231 MB) via modelscope.snapshot_download to ~/.cache/modelscope/hub/. After one successful download, the app is fully offline.
From Source (Contributors)
git clone https://github.com/pkulijing/whisper-input
cd whisper-input
bash scripts/setup_macos.sh # or setup_linux.sh
uv run whisper-input
Usage
# Specify hotkey
whisper-input -k KEY_FN # macOS: Fn/Globe key
whisper-input -k KEY_RIGHTALT # Linux: Right Alt key
# More options
whisper-input --help
A browser settings page opens automatically on startup; you can also access it via the system tray icon.
How to use
- Start the app, then hold the hotkey to begin recording
- macOS default: Right Command key
- Linux default: Right Ctrl key
- Speak into the microphone
- Release the hotkey, wait for recognition
- The recognized text is automatically typed at the cursor position
Release Flow (Maintainers)
PyPI distribution via GitHub Actions tag trigger + Trusted Publishing (OIDC):
- Bump
versioninpyproject.toml git commit -am "release: v0.5.1"and push to mastergit tag v0.5.1 && git push --tags.github/workflows/release.ymltriggers automatically: verify tag matches version ->uv build-> publish to PyPI viapypa/gh-action-pypi-publish-> create GitHub Release
Configuration
Config file config.yaml, also editable via the browser settings UI:
| Setting | Description | macOS Default | Linux Default |
|---|---|---|---|
hotkey |
Trigger hotkey | KEY_RIGHTMETA |
KEY_RIGHTCTRL |
sensevoice.use_itn |
Inverse text normalization | true |
true |
sound.enabled |
Recording sound notification | true |
true |
ui.language |
Interface language (zh/en/fr) | zh |
zh |
Known Limitations
- Linux supports X11 only; Wayland is not yet supported
- Super/Win key is intercepted by GNOME desktop, not recommended as hotkey
- macOS requires Accessibility permission for global hotkey monitoring
- First run downloads the SenseVoice ONNX model (~231 MB from DAMO Academy ModelScope)
Technical Architecture
The project uses src layout with all Python code under src/whisper_input/, installable as a standard package. The entry point is the whisper-input console script (equivalent to python -m whisper_input).
Hold hotkey -> HotkeyListener (whisper_input.backends) -> AudioRecorder (sounddevice)
Release -> stt.SenseVoiceSTT (onnxruntime) -> InputMethod -> Text typed into focused window
Platform backends (whisper_input.backends) auto-select at runtime via sys.platform:
- Linux: evdev for keyboard events + xclip/xdotool clipboard paste
- macOS: pynput global keyboard listener + pbcopy/pbpaste + Cmd+V paste
STT inference (whisper_input.stt):
- Model: DAMO Academy official
iic/SenseVoiceSmall-onnx(quantized), downloaded viamodelscope.snapshot_downloadto~/.cache/modelscope/hub/ - Runtime: Microsoft official
onnxruntime, no torch dependency - Feature extraction, BPE decoding, meta-tag post-processing: ported from DAMO's
funasr_onnx(MIT license, ~250 lines pure Python), bit-aligned with FunASR - Dependency tree:
onnxruntime + kaldi-native-fbank + sentencepiece + numpy + modelscope(modelscope base is only 36 MB, no torch/transformers)
Common features:
- 300ms delay on modifier key press to distinguish combos (e.g., Ctrl+C) from single triggers
- Clipboard paste instead of key simulation, avoiding CJK encoding issues
- Unified CPU inference path, zero code difference between macOS/Linux
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whisper_input-0.6.0a2.tar.gz.
File metadata
- Download URL: whisper_input-0.6.0a2.tar.gz
- Upload date:
- Size: 733.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a988acac3348f14d276f8f0436ece25b3256f7638fdf993ed08ebdcf0aeb8e3d
|
|
| MD5 |
e43ea2d19ab1c8765061de057f38ab9e
|
|
| BLAKE2b-256 |
999ffeb02b453843c7e32d6963aad657152904092078cefdd0c3dc36900ff884
|
Provenance
The following attestation bundles were made for whisper_input-0.6.0a2.tar.gz:
Publisher:
release.yml on pkulijing/whisper-input
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whisper_input-0.6.0a2.tar.gz -
Subject digest:
a988acac3348f14d276f8f0436ece25b3256f7638fdf993ed08ebdcf0aeb8e3d - Sigstore transparency entry: 1317135952
- Sigstore integration time:
-
Permalink:
pkulijing/whisper-input@059b7cb274ee2334babf7e1489bfa796b5d5bf59 -
Branch / Tag:
refs/tags/v0.6.0a2 - Owner: https://github.com/pkulijing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b7cb274ee2334babf7e1489bfa796b5d5bf59 -
Trigger Event:
push
-
Statement type:
File details
Details for the file whisper_input-0.6.0a2-py3-none-any.whl.
File metadata
- Download URL: whisper_input-0.6.0a2-py3-none-any.whl
- Upload date:
- Size: 74.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69b1999b3364815699efd65d9341f2f78da73d7e1d30a6fcfbd517c2d124f406
|
|
| MD5 |
c058f2ef88b9f48bc69fe7427353ad84
|
|
| BLAKE2b-256 |
d52ca1d67f31ed1a8873c9ab23a70f0d137793d670456f0ee772e59d999d6abf
|
Provenance
The following attestation bundles were made for whisper_input-0.6.0a2-py3-none-any.whl:
Publisher:
release.yml on pkulijing/whisper-input
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whisper_input-0.6.0a2-py3-none-any.whl -
Subject digest:
69b1999b3364815699efd65d9341f2f78da73d7e1d30a6fcfbd517c2d124f406 - Sigstore transparency entry: 1317135969
- Sigstore integration time:
-
Permalink:
pkulijing/whisper-input@059b7cb274ee2334babf7e1489bfa796b5d5bf59 -
Branch / Tag:
refs/tags/v0.6.0a2 - Owner: https://github.com/pkulijing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@059b7cb274ee2334babf7e1489bfa796b5d5bf59 -
Trigger Event:
push
-
Statement type: