Voice Mode Audio Controller (tools/voice_mode.py)

maia · tools/voice_mode.py · python · MIT
voice, cli

Provides push-to-talk audio recording, playback, and STT/TTS dispatch for CLI applications. Use this to add voice-interactive capabilities to terminal-based tools.

# Source: https://github.com/and270/maia | License: MIT | Copyright 2026 AmpliIA
# Provided via justclaw.it.com; keep this notice with the code.
"""Voice Mode -- Push-to-talk audio recording and playback for the CLI.

Provides audio capture via sounddevice, WAV encoding via stdlib wave,
STT dispatch via tools.transcription_tools, and TTS playback via
sounddevice or system audio players.

Dependencies (optional):
    pip install sounddevice numpy
    or: pip install maia[voice]
"""

import logging
import os
import platform
import re
import shutil
import subprocess
import sys
import tempfile
import threading
import time
import wave
from typing import Any, Dict, List, Optional

logger = logging.getLogger(__name__)

# ---------------------------------------------------------------------------


... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key