A small Ubuntu 22.04 hotkey speech-to-text helper. Press one shortcut to start recording, press it again to stop recording and send the audio to Tencent Cloud ASR, then copy the transcript to the clipboard. You can then use DeepSeek to clean the transcript or organize it into brief and detailed versions.
cd <project-dir>
python3 -m venv .venv
. .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
chmod +x scripts/s2t-shortcutSystem tools:
sudo apt install alsa-utils xclip libnotify-binThe current implementation records 16 kHz mono WAV files with arecord; it does not require ffmpeg.
cp .env.example .envThen edit .env:
TENCENTCLOUD_SECRET_ID=...
TENCENTCLOUD_SECRET_KEY=...
TENCENTCLOUD_REGION=ap-guangzhou
TENCENT_ASR_ENGINE=16k_zh-PY
DEEPSEEK_API_KEY=...
DEEPSEEK_MODEL=deepseek-v4-flash
DEEPSEEK_BASE_URL=https://api.deepseek.comscripts/s2t-shortcut loads .env from the project directory automatically, which is more reliable than depending on desktop shortcuts to inherit your shell environment.
DeepSeek has announced that the legacy model names deepseek-chat and deepseek-reasoner will stop working on 2026-07-24. This project uses deepseek-v4-flash by default.
scripts/s2t-shortcut record-toggle
scripts/s2t-shortcut clean
scripts/s2t-shortcut summary --style brief
scripts/s2t-shortcut summary --style detailed
scripts/s2t-shortcut statusYou can also test Tencent ASR with an existing WAV file:
scripts/s2t-shortcut transcribe-file /path/to/audio.wavAdd custom shortcuts in Settings -> Keyboard -> View and Customize Shortcuts -> Custom Shortcuts.
If you are already in the project directory, test these commands first:
./scripts/s2t-shortcut record-toggle
./scripts/s2t-shortcut clean
./scripts/s2t-shortcut summary --style brief
./scripts/s2t-shortcut summary --style detailedUbuntu custom shortcuts usually need absolute paths. Run pwd in the project directory, then replace <project-dir> with that path:
| Purpose | Command |
|---|---|
| Start/stop recording and ASR | <project-dir>/scripts/s2t-shortcut record-toggle |
| Clean clipboard text | <project-dir>/scripts/s2t-shortcut clean |
| Brief organized text | <project-dir>/scripts/s2t-shortcut summary --style brief |
| Detailed organized text | <project-dir>/scripts/s2t-shortcut summary --style detailed |
Suggested shortcuts:
Ctrl+Alt+R: recording toggleCtrl+Alt+C: clean textCtrl+Alt+B: brief organized textCtrl+Alt+D: detailed organized text
- Recordings are stored under
/tmp/speech2text-<uid>/recordings/by default. - The latest result is stored at
/tmp/speech2text-<uid>/last_result.jsonby default. - History is appended to
/tmp/speech2text-<uid>/history.jsonlby default. - Set
S2T_CACHE_DIRif you want to use another location. - Tencent one-sentence ASR is checked locally with a default limit of 60 seconds and 3 MB. You can adjust the local checks with
S2T_MAX_SECONDSandS2T_MAX_BYTES, but Tencent Cloud still enforces its own service limits. - The tool writes to the clipboard only. It does not auto-paste into the current window, which avoids desktop focus issues.