Skip to main content

Hands-free voice input for Claude Code, Codex CLI, and any terminal — cross-platform

Project description

micoracle

Hands-free voice input for Claude Code, Codex CLI, OpenCode, and any terminal — on macOS, Linux, and Windows. OS is auto-detected at launch; STT and TTS backends are pluggable (local or cloud).

Say "Codex, refactor this function" → your speech is captured, transcribed, and pasted into the focused terminal with Enter pressed. No push-to-talk, no cloud required.

Features

  • Cross-platformplatform_adapter.py auto-selects macOS (AppleScript) / Linux (xdotool on X11, wtype on Wayland) / Windows (pywin32 + pyautogui).
  • 4 STT backends — MLX Whisper (Apple Silicon), faster-whisper (cross-platform local), OpenAI Whisper API, Azure OpenAI Whisper.
  • 4 TTS backends — macOS say, pyttsx3 (cross-platform offline), OpenAI TTS, Azure Speech TTS. Or none to stay silent.
  • Continuous listening with WebRTC VAD + 300 ms preroll buffer (wake words never get chopped by onset detection).
  • Wake-word gate"Claude, …" / "Codex, …" with fuzzy mishear tolerance.
  • Two-step follow-up — say the wake word alone, then the prompt within 8 s.
  • Silence-hallucination filter — Whisper's "Thank you." / "Amen." artifacts are dropped silently.
  • Locked dispatch target — frontmost app captured at startup (or pin via --target-app), stays fixed regardless of where you click.
  • Clipboard-safe — text is pasted via clipboard; your original contents are restored afterwards.

OS / backend matrix

Platform STT default TTS default Focus & paste Notes
macOS (Apple Silicon) mlx say AppleScript Best local latency
macOS (Intel) faster say AppleScript
Linux X11 faster pyttsx3 xdotool + xclip Full support
Linux Wayland faster pyttsx3 wtype + wl-copy --target-app required; auto-focus limited
Windows 10/11 faster pyttsx3 pywin32 + pyautogui Installed automatically by the PyPI package on Windows

All defaults can be overridden via --stt-backend / --tts-backend or environment variables.

Install

Use a virtual environment first:

python -m venv .venv

Activate it:

# macOS / Linux
source .venv/bin/activate

# Windows PowerShell
.\.venv\Scripts\activate

Install the package:

pip install --upgrade pip
pip install micoracle

Pick STT

macOS Apple Silicon: mlx-whisper is installed automatically by micoracle.

Windows, Linux, macOS Intel local Whisper:

pip install "micoracle[faster]"

If Windows has an onnxruntime resolver conflict, use a clean Python 3.12/3.13 venv or use OpenAI STT:

pip install "micoracle[openai]"
micoracle --stt-backend openai --no-speak --target-app active --dictate

Set OPENAI_API_KEY in your shell first, for example:

$env:OPENAI_API_KEY="your_key_here"

OS Setup

macOS: grant Microphone, Accessibility, and Automation permissions to your terminal.

Linux X11:

sudo apt install xdotool

Linux Wayland:

sudo apt install wtype wl-clipboard

Linux offline TTS only:

sudo apt install espeak
pip install "micoracle[pyttsx3]"

Windows: no extra Python dispatch packages are needed; pyperclip, pyautogui, pywin32, and psutil are installed automatically.

Configure

cp .env.example .env
# Edit .env to set API keys (only if using cloud backends), pick backends, etc.

Quickstart

# Focus Cursor, Claude CLI, Codex CLI, or any terminal input box, then:
micoracle --no-speak --target-app active --dictate

# Wake-word mode instead of direct dictation:
micoracle --no-speak --target-app active

# Override STT/TTS at launch:
micoracle --stt-backend openai --tts-backend none --target-app active --dictate

Speak:

  • One-shot: "Codex, write a Python hello world." → transcribed + pasted into the focused app.
  • Two-step: "Codex." → you hear "listening" → within 8 s say the prompt → pasted.

CLI reference

Flag Default Description
--device <id|name> system default mic Audio input device.
--list-devices Print available input devices and exit.
--target-app <name> active Paste into focused window, or target a specific app/process.
--dictate off Paste every transcribed utterance without requiring "Codex" / "Claude".
--stt-backend auto auto / mlx / faster / openai / azure / elevenlabs / gemini.
--tts-backend auto auto / say / pyttsx3 / openai / azure / none.
--no-speak Alias for --tts-backend none.

Environment variables

See .env.example for the full commented list. Highlights:

Variable Purpose
VOICE_AGENT_STT_BACKEND Default STT backend
VOICE_AGENT_TTS_BACKEND Default TTS backend
VOICE_AGENT_TARGET_APP Default dispatch target
VOICE_AGENT_INPUT_DEVICE Default mic
VOICE_AGENT_MLX_REPO MLX Whisper HF repo
VOICE_AGENT_FASTER_MODEL faster-whisper model name
OPENAI_API_KEY For openai STT/TTS backends
AZURE_OPENAI_ENDPOINT / AZURE_OPENAI_KEY / AZURE_WHISPER_DEPLOYMENT For azure STT
AZURE_SPEECH_KEY / AZURE_SPEECH_REGION For azure TTS

Architecture

[ mic ] ──▶ sounddevice callback ──▶ audio_q ──▶ main loop
                                                   │
                                                   ▼  (VAD + preroll buffer)
                                               utterance_q
                                                   │
                                                   ▼
                  worker: STTBackend → wake/cleanup → PlatformAdapter → TTSBackend
  • stt.pySTTBackend interface + 4 implementations + OS-aware factory.
  • tts.pyTTSBackend interface + 4 implementations + factory.
  • platform_adapter.pyPlatformAdapter interface + MacAdapter, LinuxAdapter, WindowsAdapter + get_platform_adapter() factory.
  • hands_free_voice.py — mic capture, VAD state machine, wake-state, wiring.

Troubleshooting

No input devices shown. OS microphone permission for your terminal is missing. Grant it (macOS: Privacy & Security → Microphone; Linux: check PulseAudio / PipeWire; Windows: Settings → Privacy → Microphone) and relaunch the terminal.

Wake word never fires. Confirm the right mic via --list-devices. Say "Codex" slowly and clearly — fuzzy matching covers most mishears but a low input gain can strip initial consonants.

[dispatch error] on Wayland. Wayland blocks programmatic window focusing. Pass --target-app and keep that window focused yourself.

Windows: keystrokes sent to the wrong window. Windows' focus-stealing prevention can block SetForegroundWindow. Give the target window focus manually, or use [AutoHotkey] to nudge focus-stealing permissions.

macOS: keystrokes ignored. Accessibility + Automation permissions missing for the terminal. System Settings → Privacy & Security → Accessibility / Automation.

Privacy & security

  • Local backends keep audio on-device. MLX Whisper and faster-whisper do not make any network calls at inference time.
  • Cloud backends upload audio (OpenAI / Azure). Use only if you're comfortable.
  • Clipboard is temporarily overwritten with each dispatch; original contents are restored immediately after.
  • No telemetry. No analytics. No phone-home.
  • Accessibility / Automation permissions are powerful — the agent types into the focused app and presses Enter. Review the source before granting.

License

MIT © 2026 Pradip Tivhale

Acknowledgements

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

micoracle-1.3.6.tar.gz (59.6 kB view details)

Uploaded Source

Built Distribution

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

micoracle-1.3.6-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file micoracle-1.3.6.tar.gz.

File metadata

  • Download URL: micoracle-1.3.6.tar.gz
  • Upload date:
  • Size: 59.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for micoracle-1.3.6.tar.gz
Algorithm Hash digest
SHA256 139572600bf51de9e49e38fbef834fd20a3fad20fd22c2c9c80cb71ea3e24e43
MD5 37a2dacb1d81475acf37adcd7923d5fa
BLAKE2b-256 34674d071e6b0a5dd0a8104f3a88212fff13780d3fcedad0264cd6004920347b

See more details on using hashes here.

File details

Details for the file micoracle-1.3.6-py3-none-any.whl.

File metadata

  • Download URL: micoracle-1.3.6-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for micoracle-1.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b99b6d43751085fc5410b4bf005a6d2785b365b1643bb621b32ef757f63caef5
MD5 37e055b7085a7162831ca035497c37c1
BLAKE2b-256 0a1cf49c0697023ef6b3a80b5f40fa5f71079bb780d2be64c9ec4e65b66841b6

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