python-voiceio 1.18.13__tar.gz → 1.18.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_voiceio-1.18.13/python_voiceio.egg-info → python_voiceio-1.18.15}/PKG-INFO +3 -1
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/README.md +2 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/pyproject.toml +1 -1
- {python_voiceio-1.18.13 → python_voiceio-1.18.15/python_voiceio.egg-info}/PKG-INFO +3 -1
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/python_voiceio.egg-info/SOURCES.txt +2 -0
- python_voiceio-1.18.15/tests/test_audio_devices.py +290 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_cli.py +52 -0
- python_voiceio-1.18.15/voiceio/__init__.py +1 -0
- python_voiceio-1.18.15/voiceio/audio_devices.py +121 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/__init__.py +29 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/feedback.py +10 -5
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/platform.py +14 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/recorder.py +34 -13
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/player.py +18 -15
- python_voiceio-1.18.13/voiceio/__init__.py +0 -1
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/LICENSE +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/python_voiceio.egg-info/dependency_links.txt +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/python_voiceio.egg-info/entry_points.txt +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/python_voiceio.egg-info/requires.txt +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/python_voiceio.egg-info/top_level.txt +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/setup.cfg +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_announce.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_app_wiring.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_audio_quality.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_audio_source.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_backend_probes.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_cancel.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_clipboard_read.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_clipboard_typer.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_commands.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_concurrency_lockdown.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_config.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_context_terms.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_corrections.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_cuda_setup_hint.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_dead_mic.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_decoders.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_errorlog.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_evdev_uaccess.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_evdev_x11_optional.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_fallback.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_fcitx_bridge.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_feedback_stream.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_focus.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_gpu_fallback.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_health.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_hints.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_history.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_hotkey_modes.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_engine_limits.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_engine_listener.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_pending.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_pids.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_ping.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_session.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_textlimit.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_ibus_typer.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_idle_audio.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_install_env.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_clean.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_import.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_language.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_metrics.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_pipeline.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_quiet.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_resume.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_review.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_summary.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_learn_targets.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_llm.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_llm_api.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_mic_gain.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_mic_test.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_modifier_guard.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_numbers.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_paste_last.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_pipeline.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_platform.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_postcorrect.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_postprocess.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_prebuffer.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_presence.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_prompt.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_quiet_audio.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_recorder_integration.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_replies.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_report.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_retention.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_robustness.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_security_hardening.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_server.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_service.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_setup.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_sherpa.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_spool.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_streaming.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_suggest.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_telemetry.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_tokens.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_transcriber.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_tray.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_tts.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_tts_socket.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_typer_manager.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_vad.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_vocabulary.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_wordfreq.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/tests/test_worker_decode.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/__main__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/announce.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/app.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/audio_source.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/backends.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/configcmd.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/corrections.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/doctor.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/history.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/learn.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/models.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/replies.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/servicecmd.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/uninstall.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/cli/vocab.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/clipboard_read.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/commands.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/config.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/consent.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/context_terms.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/bias.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/base.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/catalog.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/fetch.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/lanes.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/sherpa.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/decoders/whispercpp.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/core/pipeline.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/corrections.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/data/60-voiceio-uaccess.rules +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/data/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/demo.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/display.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/errorlog.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/focus.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/health.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hints.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/history.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/base.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/chain.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/evdev.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/pynput_backend.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/hotkeys/socket_backend.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/install.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/pending.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/session.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ibus/textlimit.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/idle_audio.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/install_env.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/augment.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/clean.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/evaluate.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/importer.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/lastrun.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/metrics.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/quiet.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/review.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/store.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/summary.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/teacher.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/learn/train.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/llm.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/llm_api.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/mic_gain.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/models/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/models/silero_vad.onnx +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/numbers.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/pidlock.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/postcorrect.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/postprocess.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/power.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/presence.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/privacy.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/prompt.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/quiet_audio.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/replies.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/report.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/retention.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/server/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/server/__main__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/server/app.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/server/config.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/server/runtime.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/service.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/configfile.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/extras.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/hotkey.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/noninteractive.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/speech.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/steps.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/system.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/setup/ui.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/sounds/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/sounds/alert.wav +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/sounds/commit.wav +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/sounds/start.wav +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/sounds/stop.wav +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/spool.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/streaming.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/suggest.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/telemetry.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tokens.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tray/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tray/_icons.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tray/_indicator.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tray/_pystray.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/base.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/chain.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/edge_engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/espeak.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/piper_engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/tts/supertonic_engine.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/__init__.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/base.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/chain.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/clipboard.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/collecting.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/fcitx_bridge.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/ibus.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/manager.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/modifier_guard.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/paste.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/pynput_type.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/wtype.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/xdotool.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/typers/ydotool.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/ui.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/vad.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/vocab_stats.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/vocabulary.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/watchdog.py +0 -0
- {python_voiceio-1.18.13 → python_voiceio-1.18.15}/voiceio/wordfreq.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-voiceio
|
|
3
|
-
Version: 1.18.
|
|
3
|
+
Version: 1.18.15
|
|
4
4
|
Summary: Voice dictation for Linux. Speak → text, locally, instantly.
|
|
5
5
|
Author: Hugo Montenegro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -99,6 +99,8 @@ sudo apt install ./voiceio_*.deb
|
|
|
99
99
|
voiceio setup
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
To upgrade, download the newer `.deb` from the [latest release](https://github.com/Hugo0/voiceio/releases/latest) and run `sudo apt install ./voiceio_*.deb` again (there is no apt repository, so `apt upgrade` won't find it). Run `voiceio` itself as your user, never with `sudo`: `voiceio doctor --fix` asks for your password when it needs to.
|
|
103
|
+
|
|
102
104
|
Then press your hotkey, speak, and press it again (or hold it while you speak). `voiceio doctor` shows what works, `voiceio doctor --fix` repairs what it can, and `voiceio doctor --report` shares an anonymous install report on the [feedback board](https://voiceio.dev/#feedback) (it shows you the text and asks first). Doctor offers one when a check fails, and so does the tray's "Report a problem...". A report names the last error only by its type and `file:line`, never its message. NixOS, other extras and installing from source: [docs/linux.md](docs/linux.md). Agent runbook: [INSTALL.md](INSTALL.md).
|
|
103
105
|
|
|
104
106
|
## Make it yours
|
|
@@ -46,6 +46,8 @@ sudo apt install ./voiceio_*.deb
|
|
|
46
46
|
voiceio setup
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
To upgrade, download the newer `.deb` from the [latest release](https://github.com/Hugo0/voiceio/releases/latest) and run `sudo apt install ./voiceio_*.deb` again (there is no apt repository, so `apt upgrade` won't find it). Run `voiceio` itself as your user, never with `sudo`: `voiceio doctor --fix` asks for your password when it needs to.
|
|
50
|
+
|
|
49
51
|
Then press your hotkey, speak, and press it again (or hold it while you speak). `voiceio doctor` shows what works, `voiceio doctor --fix` repairs what it can, and `voiceio doctor --report` shares an anonymous install report on the [feedback board](https://voiceio.dev/#feedback) (it shows you the text and asks first). Doctor offers one when a check fails, and so does the tray's "Report a problem...". A report names the last error only by its type and `file:line`, never its message. NixOS, other extras and installing from source: [docs/linux.md](docs/linux.md). Agent runbook: [INSTALL.md](INSTALL.md).
|
|
50
52
|
|
|
51
53
|
## Make it yours
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-voiceio
|
|
3
|
-
Version: 1.18.
|
|
3
|
+
Version: 1.18.15
|
|
4
4
|
Summary: Voice dictation for Linux. Speak → text, locally, instantly.
|
|
5
5
|
Author: Hugo Montenegro
|
|
6
6
|
License-Expression: MIT
|
|
@@ -99,6 +99,8 @@ sudo apt install ./voiceio_*.deb
|
|
|
99
99
|
voiceio setup
|
|
100
100
|
```
|
|
101
101
|
|
|
102
|
+
To upgrade, download the newer `.deb` from the [latest release](https://github.com/Hugo0/voiceio/releases/latest) and run `sudo apt install ./voiceio_*.deb` again (there is no apt repository, so `apt upgrade` won't find it). Run `voiceio` itself as your user, never with `sudo`: `voiceio doctor --fix` asks for your password when it needs to.
|
|
103
|
+
|
|
102
104
|
Then press your hotkey, speak, and press it again (or hold it while you speak). `voiceio doctor` shows what works, `voiceio doctor --fix` repairs what it can, and `voiceio doctor --report` shares an anonymous install report on the [feedback board](https://voiceio.dev/#feedback) (it shows you the text and asks first). Doctor offers one when a check fails, and so does the tray's "Report a problem...". A report names the last error only by its type and `file:line`, never its message. NixOS, other extras and installing from source: [docs/linux.md](docs/linux.md). Agent runbook: [INSTALL.md](INSTALL.md).
|
|
103
105
|
|
|
104
106
|
## Make it yours
|
|
@@ -9,6 +9,7 @@ python_voiceio.egg-info/requires.txt
|
|
|
9
9
|
python_voiceio.egg-info/top_level.txt
|
|
10
10
|
tests/test_announce.py
|
|
11
11
|
tests/test_app_wiring.py
|
|
12
|
+
tests/test_audio_devices.py
|
|
12
13
|
tests/test_audio_quality.py
|
|
13
14
|
tests/test_audio_source.py
|
|
14
15
|
tests/test_backend_probes.py
|
|
@@ -100,6 +101,7 @@ voiceio/__init__.py
|
|
|
100
101
|
voiceio/__main__.py
|
|
101
102
|
voiceio/announce.py
|
|
102
103
|
voiceio/app.py
|
|
104
|
+
voiceio/audio_devices.py
|
|
103
105
|
voiceio/audio_source.py
|
|
104
106
|
voiceio/backends.py
|
|
105
107
|
voiceio/clipboard_read.py
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"""A reopened mic re-resolves its device against a fresh PortAudio device list.
|
|
2
|
+
|
|
3
|
+
The real failure: the user switched to a USB mic (new default source) while
|
|
4
|
+
the daemon had been up for days; every dead-stream reopen landed on the old
|
|
5
|
+
device PortAudio had cached at import, and only a restart fixed it.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import logging
|
|
10
|
+
import sys
|
|
11
|
+
import threading
|
|
12
|
+
|
|
13
|
+
import pytest
|
|
14
|
+
|
|
15
|
+
from voiceio import audio_devices, feedback
|
|
16
|
+
from voiceio.config import AudioConfig
|
|
17
|
+
from voiceio.recorder import AudioRecorder
|
|
18
|
+
|
|
19
|
+
# Taken at import, before conftest's per-test stub replaces it.
|
|
20
|
+
_REAL_REINITIALIZE = audio_devices._reinitialize
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class FakeStream:
|
|
24
|
+
def __init__(self, pa: FakePortAudio, device: int, samplerate: int = 16000):
|
|
25
|
+
self._pa = pa
|
|
26
|
+
self.device = device
|
|
27
|
+
self.samplerate = samplerate
|
|
28
|
+
self.latency = 0.08
|
|
29
|
+
self.closed = False
|
|
30
|
+
self.active = False
|
|
31
|
+
self.stopped = True
|
|
32
|
+
self.written = 0
|
|
33
|
+
|
|
34
|
+
def start(self):
|
|
35
|
+
self.active, self.stopped = True, False
|
|
36
|
+
|
|
37
|
+
def stop(self):
|
|
38
|
+
self.active, self.stopped = False, True
|
|
39
|
+
|
|
40
|
+
def close(self):
|
|
41
|
+
self.closed = True
|
|
42
|
+
|
|
43
|
+
def write(self, data):
|
|
44
|
+
assert not self.closed and self._pa._initialized, "write on a freed stream"
|
|
45
|
+
self.written += len(data)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class FakePortAudio:
|
|
49
|
+
"""sounddevice over a device list that only refreshes at Pa_Initialize,
|
|
50
|
+
like the real one. Pa_Terminate with a stream still open is a failure."""
|
|
51
|
+
|
|
52
|
+
PortAudioError = RuntimeError
|
|
53
|
+
|
|
54
|
+
def __init__(self, devices: list[str], default: int):
|
|
55
|
+
self.live_devices, self.live_default = list(devices), default
|
|
56
|
+
self._initialized = 1
|
|
57
|
+
self.inits = 0
|
|
58
|
+
self.streams: list[FakeStream] = []
|
|
59
|
+
self._snapshot()
|
|
60
|
+
|
|
61
|
+
def _snapshot(self):
|
|
62
|
+
self.devices, self.default = list(self.live_devices), self.live_default
|
|
63
|
+
|
|
64
|
+
def plug(self, devices: list[str], default: int):
|
|
65
|
+
self.live_devices, self.live_default = list(devices), default
|
|
66
|
+
|
|
67
|
+
def _terminate(self):
|
|
68
|
+
still_open = [s for s in self.streams if not s.closed]
|
|
69
|
+
assert not still_open, f"Pa_Terminate with open streams: {still_open}"
|
|
70
|
+
self._initialized -= 1
|
|
71
|
+
|
|
72
|
+
def _initialize(self):
|
|
73
|
+
self._initialized += 1
|
|
74
|
+
self.inits += 1
|
|
75
|
+
self._snapshot()
|
|
76
|
+
|
|
77
|
+
def _resolve(self, device):
|
|
78
|
+
if device is None:
|
|
79
|
+
return self.default
|
|
80
|
+
if isinstance(device, int):
|
|
81
|
+
return device
|
|
82
|
+
for i, name in enumerate(self.devices):
|
|
83
|
+
if device.lower() in name.lower():
|
|
84
|
+
return i
|
|
85
|
+
raise ValueError(f"No input device matching {device!r}")
|
|
86
|
+
|
|
87
|
+
def query_devices(self, device=None, kind=None):
|
|
88
|
+
index = self.default if kind == "input" else device
|
|
89
|
+
return {"name": self.devices[index], "index": index}
|
|
90
|
+
|
|
91
|
+
def InputStream(self, device=None, samplerate=16000, **_):
|
|
92
|
+
stream = FakeStream(self, self._resolve(device), samplerate)
|
|
93
|
+
self.streams.append(stream)
|
|
94
|
+
return stream
|
|
95
|
+
|
|
96
|
+
def OutputStream(self, device=None, samplerate=44100, **_):
|
|
97
|
+
stream = FakeStream(self, 0, samplerate)
|
|
98
|
+
self.streams.append(stream)
|
|
99
|
+
return stream
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@pytest.fixture
|
|
103
|
+
def pa(monkeypatch):
|
|
104
|
+
fake = FakePortAudio(["HDA Intel PCH: ALC257 Analog", "HD Pro Webcam C920"], default=0)
|
|
105
|
+
monkeypatch.setitem(sys.modules, "sounddevice", fake)
|
|
106
|
+
monkeypatch.setattr("voiceio.recorder.sd", fake)
|
|
107
|
+
monkeypatch.setattr(feedback, "sd", fake)
|
|
108
|
+
monkeypatch.setattr(feedback, "_stream", None)
|
|
109
|
+
# The real re-init, against the fake module (conftest stubs it out).
|
|
110
|
+
monkeypatch.setattr(audio_devices, "_reinitialize", _REAL_REINITIALIZE)
|
|
111
|
+
return fake
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def _recorder(device: str = "default") -> AudioRecorder:
|
|
115
|
+
return AudioRecorder(AudioConfig(sample_rate=16000, device=device, prebuffer_secs=0.5,
|
|
116
|
+
auto_stop_silence_secs=0, auto_stop_no_speech_secs=0))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
HYPERX = ["HDA Intel PCH: ALC257 Analog", "HD Pro Webcam C920", "HyperX SoloCast"]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def test_dead_stream_reopen_lands_on_the_new_default(pa):
|
|
123
|
+
rec = _recorder()
|
|
124
|
+
rec.open_stream()
|
|
125
|
+
assert rec._stream.device == 0
|
|
126
|
+
pa.plug(HYPERX, default=2) # USB mic plugged in, made default
|
|
127
|
+
|
|
128
|
+
rec.revive_stream() # the dead-mic (exact zeros) path
|
|
129
|
+
|
|
130
|
+
assert pa.inits == 1
|
|
131
|
+
assert rec._stream.device == 2
|
|
132
|
+
assert not rec._stream.closed and rec._stream.active
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_reopen_without_reinit_would_keep_the_stale_default(pa, monkeypatch):
|
|
136
|
+
"""The bug itself: PortAudio's cached list knows nothing of the new mic."""
|
|
137
|
+
monkeypatch.setattr(audio_devices, "_reinitialize", lambda: None)
|
|
138
|
+
rec = _recorder()
|
|
139
|
+
rec.open_stream()
|
|
140
|
+
pa.plug(HYPERX, default=2)
|
|
141
|
+
rec.reopen_stream()
|
|
142
|
+
assert rec._stream.device == 0
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_named_device_is_re_resolved_by_name(pa):
|
|
146
|
+
pa.plug(["HyperX SoloCast", "HDA Intel PCH: ALC257 Analog"], default=1)
|
|
147
|
+
pa._snapshot()
|
|
148
|
+
rec = _recorder("HyperX")
|
|
149
|
+
rec.open_stream()
|
|
150
|
+
assert rec._stream.device == 0
|
|
151
|
+
pa.plug(HYPERX, default=0) # replugged: its index moved
|
|
152
|
+
|
|
153
|
+
rec.reopen_stream()
|
|
154
|
+
|
|
155
|
+
assert rec._stream.device == 2
|
|
156
|
+
assert pa.query_devices(rec._stream.device)["name"] == "HyperX SoloCast"
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def test_cue_stream_closed_before_reinit_and_usable_after(pa):
|
|
160
|
+
assert feedback.open_cue_stream()
|
|
161
|
+
old_cue = feedback._stream
|
|
162
|
+
rec = _recorder()
|
|
163
|
+
rec.open_stream()
|
|
164
|
+
old_mic = rec._stream
|
|
165
|
+
|
|
166
|
+
rec.reopen_stream() # FakePortAudio asserts nothing is open
|
|
167
|
+
|
|
168
|
+
assert pa.inits == 1
|
|
169
|
+
assert old_cue.closed and old_mic.closed
|
|
170
|
+
assert feedback._stream is not None and feedback._stream is not old_cue
|
|
171
|
+
feedback._play_sync("start")
|
|
172
|
+
assert feedback._stream.written > 0
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def test_a_closed_cue_stream_stays_closed(pa):
|
|
176
|
+
rec = _recorder()
|
|
177
|
+
rec.open_stream()
|
|
178
|
+
rec.reopen_stream()
|
|
179
|
+
assert pa.inits == 1
|
|
180
|
+
assert feedback._stream is None
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_reinit_backoff(pa):
|
|
184
|
+
rec = _recorder()
|
|
185
|
+
rec.open_stream()
|
|
186
|
+
pa.plug(HYPERX, default=2)
|
|
187
|
+
rec.revive_stream()
|
|
188
|
+
assert pa.inits == 1
|
|
189
|
+
pa.plug(HYPERX, default=1)
|
|
190
|
+
rec.revive_stream() # still dead right after: no second re-init
|
|
191
|
+
assert pa.inits == 1
|
|
192
|
+
assert rec._stream.device == 2 # reopened, on the list it already has
|
|
193
|
+
audio_devices._last_refresh -= audio_devices.REFRESH_MIN_INTERVAL_SECS + 1
|
|
194
|
+
rec.revive_stream()
|
|
195
|
+
assert pa.inits == 2
|
|
196
|
+
assert rec._stream.device == 1
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def test_refresh_is_skipped_while_tts_plays(pa):
|
|
200
|
+
playing, done = threading.Event(), threading.Event()
|
|
201
|
+
|
|
202
|
+
def tts():
|
|
203
|
+
with audio_devices.stream_in_use():
|
|
204
|
+
stream = pa.OutputStream()
|
|
205
|
+
playing.set()
|
|
206
|
+
done.wait(2)
|
|
207
|
+
stream.close()
|
|
208
|
+
|
|
209
|
+
t = threading.Thread(target=tts)
|
|
210
|
+
t.start()
|
|
211
|
+
assert playing.wait(2)
|
|
212
|
+
closed = []
|
|
213
|
+
assert audio_devices.refresh(close=lambda: closed.append(1)) is False
|
|
214
|
+
assert closed == [1] # the caller's stream still closes
|
|
215
|
+
assert pa.inits == 0
|
|
216
|
+
done.set()
|
|
217
|
+
t.join(2)
|
|
218
|
+
assert audio_devices.refresh() is True
|
|
219
|
+
assert pa.inits == 1
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
def test_an_open_waits_for_a_refresh_in_progress(pa, monkeypatch):
|
|
223
|
+
monkeypatch.setattr(audio_devices, "_refreshing", True)
|
|
224
|
+
entered = threading.Event()
|
|
225
|
+
|
|
226
|
+
def opener():
|
|
227
|
+
with audio_devices.stream_in_use():
|
|
228
|
+
entered.set()
|
|
229
|
+
|
|
230
|
+
t = threading.Thread(target=opener, daemon=True)
|
|
231
|
+
t.start()
|
|
232
|
+
assert not entered.wait(0.2)
|
|
233
|
+
with audio_devices._cond:
|
|
234
|
+
audio_devices._refreshing = False
|
|
235
|
+
audio_devices._cond.notify_all()
|
|
236
|
+
assert entered.wait(2)
|
|
237
|
+
t.join(2)
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
def test_refresh_backoff_with_a_clock(pa):
|
|
241
|
+
now = [1000.0]
|
|
242
|
+
assert audio_devices.refresh(clock=lambda: now[0]) is True
|
|
243
|
+
now[0] += audio_devices.REFRESH_MIN_INTERVAL_SECS - 1
|
|
244
|
+
assert audio_devices.refresh(clock=lambda: now[0]) is False
|
|
245
|
+
now[0] += 2
|
|
246
|
+
assert audio_devices.refresh(clock=lambda: now[0]) is True
|
|
247
|
+
assert pa.inits == 2
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
def test_a_failed_reinit_does_not_raise_and_next_one_recovers(pa, monkeypatch):
|
|
251
|
+
working = pa._initialize
|
|
252
|
+
calls = []
|
|
253
|
+
|
|
254
|
+
def flaky():
|
|
255
|
+
calls.append(1)
|
|
256
|
+
if len(calls) == 1:
|
|
257
|
+
raise RuntimeError("Error initializing PortAudio")
|
|
258
|
+
working()
|
|
259
|
+
|
|
260
|
+
monkeypatch.setattr(pa, "_initialize", flaky)
|
|
261
|
+
assert audio_devices.refresh() is False
|
|
262
|
+
assert pa._initialized == 0 # terminated, the init failed
|
|
263
|
+
audio_devices._last_refresh = float("-inf")
|
|
264
|
+
assert audio_devices.refresh() is True
|
|
265
|
+
assert pa._initialized == 1
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def test_every_open_logs_the_device(pa, caplog):
|
|
269
|
+
rec = _recorder()
|
|
270
|
+
with caplog.at_level(logging.INFO, logger="voiceio.recorder"):
|
|
271
|
+
rec.open_stream()
|
|
272
|
+
pa.plug(HYPERX, default=2)
|
|
273
|
+
rec.reopen_stream()
|
|
274
|
+
opens = [r.getMessage() for r in caplog.records if r.getMessage().startswith("Mic open:")]
|
|
275
|
+
assert opens == [
|
|
276
|
+
"Mic open: 'HDA Intel PCH: ALC257 Analog' (index 0, audio.device = default)",
|
|
277
|
+
"Mic open: 'HyperX SoloCast' (index 2, audio.device = default)",
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def test_a_close_that_raises_propagates_and_skips_the_reinit(pa):
|
|
282
|
+
def broken():
|
|
283
|
+
raise RuntimeError("stop failed")
|
|
284
|
+
|
|
285
|
+
with pytest.raises(RuntimeError):
|
|
286
|
+
audio_devices.refresh(close=broken)
|
|
287
|
+
assert pa.inits == 0
|
|
288
|
+
assert audio_devices.refresh() is not None # not left "refreshing"
|
|
289
|
+
with audio_devices.stream_in_use():
|
|
290
|
+
pass
|
|
@@ -69,3 +69,55 @@ def test_config_show_redacts_secrets_and_set_writes(monkeypatch, capsys):
|
|
|
69
69
|
def test_service_unit_runs_the_run_subcommand():
|
|
70
70
|
from voiceio.service import _service_unit
|
|
71
71
|
assert "ExecStart=/x/voiceio run\n" in _service_unit("/x/voiceio")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@pytest.mark.parametrize("argv", [("doctor", "--fix"), ("doctor",), ("setup", "--defaults"),
|
|
75
|
+
("service", "install")])
|
|
76
|
+
@pytest.mark.parametrize("var", ["SUDO_USER", "DOAS_USER"])
|
|
77
|
+
def test_user_commands_refuse_sudo(monkeypatch, capsys, argv, var):
|
|
78
|
+
"""Under sudo, voiceio would set up root's session: refuse, naming the fix."""
|
|
79
|
+
monkeypatch.setattr("os.geteuid", lambda: 0)
|
|
80
|
+
monkeypatch.setenv(var, "alice")
|
|
81
|
+
monkeypatch.setattr("voiceio.cli.doctor._cmd_doctor", lambda a: pytest.fail("ran"))
|
|
82
|
+
monkeypatch.setattr("voiceio.cli._cmd_setup", lambda a: pytest.fail("ran"))
|
|
83
|
+
monkeypatch.setattr("voiceio.cli.servicecmd._cmd_service", lambda a: pytest.fail("ran"))
|
|
84
|
+
with pytest.raises(SystemExit) as e:
|
|
85
|
+
run(monkeypatch, capsys, *argv)
|
|
86
|
+
msg = str(e.value.code)
|
|
87
|
+
assert msg.startswith("Don't run voiceio with sudo")
|
|
88
|
+
assert f"`voiceio {' '.join(argv)}` as alice" in msg
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def test_sudo_guard_ignores_normal_users(monkeypatch, capsys):
|
|
92
|
+
monkeypatch.setattr("os.geteuid", lambda: 1000)
|
|
93
|
+
monkeypatch.setenv("SUDO_USER", "alice") # leaked into a user shell: not root, not sudo
|
|
94
|
+
called = []
|
|
95
|
+
monkeypatch.setattr("voiceio.cli._cmd_setup", lambda a: called.append(a))
|
|
96
|
+
run(monkeypatch, capsys, "setup", "--defaults")
|
|
97
|
+
assert called and capsys.readouterr().err == ""
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@pytest.mark.parametrize("sudo_user", [None, "root"])
|
|
101
|
+
def test_root_login_warns_and_runs(monkeypatch, capsys, sudo_user):
|
|
102
|
+
"""A container or root-only box: no one else to configure, so only warn."""
|
|
103
|
+
monkeypatch.setattr("os.geteuid", lambda: 0)
|
|
104
|
+
monkeypatch.delenv("DOAS_USER", raising=False)
|
|
105
|
+
if sudo_user:
|
|
106
|
+
monkeypatch.setenv("SUDO_USER", sudo_user)
|
|
107
|
+
else:
|
|
108
|
+
monkeypatch.delenv("SUDO_USER", raising=False)
|
|
109
|
+
called = []
|
|
110
|
+
monkeypatch.setattr("voiceio.cli._cmd_setup", lambda a: called.append(a))
|
|
111
|
+
monkeypatch.setattr(sys, "argv", ["voiceio", "setup", "--defaults"])
|
|
112
|
+
main()
|
|
113
|
+
assert called
|
|
114
|
+
assert "running as root" in capsys.readouterr().err
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
def test_daemon_commands_skip_the_sudo_guard(monkeypatch, capsys):
|
|
118
|
+
monkeypatch.setattr("os.geteuid", lambda: 0)
|
|
119
|
+
monkeypatch.setenv("SUDO_USER", "alice")
|
|
120
|
+
sent = []
|
|
121
|
+
monkeypatch.setattr("voiceio.cli._send", lambda c: sent.append(c))
|
|
122
|
+
run(monkeypatch, capsys, "toggle")
|
|
123
|
+
assert sent == ["toggle"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.18.15"
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Re-initialising PortAudio, so a reopened mic sees today's devices.
|
|
2
|
+
|
|
3
|
+
PortAudio enumerates devices and resolves the default input once, at
|
|
4
|
+
``Pa_Initialize`` (the ``import sounddevice``). A daemon up for days never sees
|
|
5
|
+
a mic plugged in later, nor a new default source: reopening a dead stream
|
|
6
|
+
lands on the same stale device. ``refresh()`` terminates and re-initialises
|
|
7
|
+
PortAudio so the next open resolves the default, or a configured device name,
|
|
8
|
+
against the current list.
|
|
9
|
+
|
|
10
|
+
``Pa_Terminate`` frees EVERY open PortAudio stream in the process; a Python
|
|
11
|
+
stream object left pointing at one would crash on its next call. So every
|
|
12
|
+
sounddevice stream in the daemon goes through here:
|
|
13
|
+
|
|
14
|
+
- the mic (recorder.py): ``refresh(close=...)`` closes it, and its
|
|
15
|
+
``open_stream`` runs inside ``stream_in_use()``;
|
|
16
|
+
- the persistent cue stream (feedback.py): closed by ``refresh()`` and
|
|
17
|
+
reopened after it, its open runs inside ``stream_in_use()``;
|
|
18
|
+
- TTS playback (tts/player.py): the whole play, open to close, runs inside
|
|
19
|
+
``stream_in_use()``, and a refresh asked for meanwhile is skipped.
|
|
20
|
+
|
|
21
|
+
Imports sounddevice lazily (the base install is headless).
|
|
22
|
+
"""
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
import logging
|
|
26
|
+
import threading
|
|
27
|
+
import time
|
|
28
|
+
from collections.abc import Callable, Iterator
|
|
29
|
+
from contextlib import contextmanager
|
|
30
|
+
|
|
31
|
+
log = logging.getLogger(__name__)
|
|
32
|
+
|
|
33
|
+
# At most one re-init per this many seconds: a mic still dead right after one
|
|
34
|
+
# reopens on the device list it already has instead of re-enumerating in a loop.
|
|
35
|
+
REFRESH_MIN_INTERVAL_SECS = 30.0
|
|
36
|
+
|
|
37
|
+
_cond = threading.Condition()
|
|
38
|
+
_refreshing = False
|
|
39
|
+
_users = 0
|
|
40
|
+
_last_refresh = float("-inf")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@contextmanager
|
|
44
|
+
def stream_in_use() -> Iterator[None]:
|
|
45
|
+
"""Hold while opening or using a sounddevice stream that refresh() does
|
|
46
|
+
not close itself. Waits for a refresh in progress; a refresh asked for
|
|
47
|
+
while any is held is skipped."""
|
|
48
|
+
global _users
|
|
49
|
+
with _cond:
|
|
50
|
+
while _refreshing:
|
|
51
|
+
_cond.wait()
|
|
52
|
+
_users += 1
|
|
53
|
+
try:
|
|
54
|
+
yield
|
|
55
|
+
finally:
|
|
56
|
+
with _cond:
|
|
57
|
+
_users -= 1
|
|
58
|
+
_cond.notify_all()
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def refresh(close: Callable[[], None] | None = None, *,
|
|
62
|
+
clock: Callable[[], float] = time.monotonic) -> bool:
|
|
63
|
+
"""Close ``close``'s stream and the cue stream, then terminate and
|
|
64
|
+
re-initialise PortAudio. True when it re-initialised. Raises only what
|
|
65
|
+
``close`` raises (then nothing is re-initialised).
|
|
66
|
+
|
|
67
|
+
Skipped (False, after still calling ``close``) when the last one was less
|
|
68
|
+
than REFRESH_MIN_INTERVAL_SECS ago, another runs, or a stream is in use.
|
|
69
|
+
"""
|
|
70
|
+
global _refreshing, _last_refresh
|
|
71
|
+
with _cond:
|
|
72
|
+
now = clock()
|
|
73
|
+
if _refreshing or _users or now - _last_refresh < REFRESH_MIN_INTERVAL_SECS:
|
|
74
|
+
skip = ("in use" if _users else "running" if _refreshing else "backoff")
|
|
75
|
+
else:
|
|
76
|
+
skip = ""
|
|
77
|
+
_refreshing = True
|
|
78
|
+
_last_refresh = now
|
|
79
|
+
if skip:
|
|
80
|
+
log.debug("PortAudio re-init skipped (%s)", skip)
|
|
81
|
+
if close is not None:
|
|
82
|
+
close()
|
|
83
|
+
return False
|
|
84
|
+
|
|
85
|
+
reopen_cue = False
|
|
86
|
+
try:
|
|
87
|
+
if close is not None:
|
|
88
|
+
close() # raises to the caller, as a plain close would
|
|
89
|
+
from voiceio import feedback
|
|
90
|
+
reopen_cue = feedback.close_cue_stream()
|
|
91
|
+
try:
|
|
92
|
+
_reinitialize()
|
|
93
|
+
ok = True
|
|
94
|
+
except Exception:
|
|
95
|
+
log.warning("PortAudio re-init failed", exc_info=True)
|
|
96
|
+
ok = False
|
|
97
|
+
finally:
|
|
98
|
+
with _cond:
|
|
99
|
+
_refreshing = False
|
|
100
|
+
_cond.notify_all()
|
|
101
|
+
if reopen_cue:
|
|
102
|
+
from voiceio import feedback
|
|
103
|
+
feedback.open_cue_stream()
|
|
104
|
+
return ok
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _reinitialize() -> None:
|
|
108
|
+
import sounddevice
|
|
109
|
+
# Pa_Initialize is reference-counted: the device list is only rebuilt
|
|
110
|
+
# once the count reaches zero.
|
|
111
|
+
n = sounddevice._initialized
|
|
112
|
+
for _ in range(n):
|
|
113
|
+
sounddevice._terminate()
|
|
114
|
+
for _ in range(max(n, 1)):
|
|
115
|
+
sounddevice._initialize()
|
|
116
|
+
try:
|
|
117
|
+
info = sounddevice.query_devices(kind="input")
|
|
118
|
+
log.info("PortAudio re-initialised: default input is %r (index %s)",
|
|
119
|
+
info["name"], info["index"])
|
|
120
|
+
except Exception:
|
|
121
|
+
log.info("PortAudio re-initialised: no default input device")
|
|
@@ -84,6 +84,8 @@ def main() -> None:
|
|
|
84
84
|
uninstall.register(sub)
|
|
85
85
|
|
|
86
86
|
args = parser.parse_args()
|
|
87
|
+
if args.command in _USER_SCOPED:
|
|
88
|
+
_refuse_sudo(sys.argv[1:])
|
|
87
89
|
if args.command is None:
|
|
88
90
|
# A pre-1.0 systemd unit runs bare `voiceio`; keep it working until
|
|
89
91
|
# `voiceio service install` (or doctor --fix) rewrites it.
|
|
@@ -94,6 +96,33 @@ def main() -> None:
|
|
|
94
96
|
args.func(args)
|
|
95
97
|
|
|
96
98
|
|
|
99
|
+
# Commands that write the user's config, data, IBus files or systemd user
|
|
100
|
+
# units, or run the daemon. The rest only talk to the daemon or read.
|
|
101
|
+
_USER_SCOPED = frozenset({
|
|
102
|
+
"run", "setup", "doctor", "service", "uninstall", "demo", "learn", "models",
|
|
103
|
+
"vocab", "corrections", "config",
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
def _refuse_sudo(argv: list[str]) -> None:
|
|
108
|
+
"""Exit when run through sudo/doas; warn when logged in as root.
|
|
109
|
+
|
|
110
|
+
Privileged steps (doctor --fix, setup) elevate by themselves, so sudo is
|
|
111
|
+
never needed and would set up root's session instead of the user's.
|
|
112
|
+
"""
|
|
113
|
+
from voiceio import platform as plat
|
|
114
|
+
if user := plat.sudo_invoker():
|
|
115
|
+
import shlex
|
|
116
|
+
cmd = shlex.join(["voiceio", *argv])
|
|
117
|
+
raise SystemExit(
|
|
118
|
+
"Don't run voiceio with sudo: it would configure root's session instead of "
|
|
119
|
+
f"yours. Run `{cmd}` as {user}; it asks for your password itself when it "
|
|
120
|
+
"needs to install packages.")
|
|
121
|
+
if plat._is_root():
|
|
122
|
+
print("voiceio: running as root, so this uses root's own config and session.",
|
|
123
|
+
file=sys.stderr)
|
|
124
|
+
|
|
125
|
+
|
|
97
126
|
def _cmd_run(args: argparse.Namespace) -> None:
|
|
98
127
|
"""Run the voiceio daemon (default command)."""
|
|
99
128
|
from voiceio import config
|
|
@@ -89,7 +89,10 @@ def _load_sounds() -> None:
|
|
|
89
89
|
def open_cue_stream() -> bool:
|
|
90
90
|
"""Open and start the cue stream unless it is open. True when open."""
|
|
91
91
|
global _stream
|
|
92
|
-
|
|
92
|
+
from voiceio.audio_devices import stream_in_use
|
|
93
|
+
# Gate first, then the lock: audio_devices.refresh() takes the lock (to
|
|
94
|
+
# close this stream) while it holds the gate.
|
|
95
|
+
with stream_in_use(), _stream_lock:
|
|
93
96
|
if _stream is not None:
|
|
94
97
|
return True
|
|
95
98
|
_load_sounds()
|
|
@@ -107,20 +110,22 @@ def open_cue_stream() -> bool:
|
|
|
107
110
|
return True
|
|
108
111
|
|
|
109
112
|
|
|
110
|
-
def close_cue_stream() ->
|
|
111
|
-
"""Close the cue stream (idle policy). A cue still
|
|
112
|
-
the lock waits for its write, and stop() drains
|
|
113
|
+
def close_cue_stream() -> bool:
|
|
114
|
+
"""Close the cue stream (idle policy, PortAudio re-init). A cue still
|
|
115
|
+
playing finishes first: the lock waits for its write, and stop() drains
|
|
116
|
+
the buffer. True when a stream was open."""
|
|
113
117
|
global _stream
|
|
114
118
|
with _stream_lock:
|
|
115
119
|
stream, _stream = _stream, None
|
|
116
120
|
if stream is None:
|
|
117
|
-
return
|
|
121
|
+
return False
|
|
118
122
|
try:
|
|
119
123
|
stream.stop()
|
|
120
124
|
stream.close()
|
|
121
125
|
except Exception:
|
|
122
126
|
log.debug("Closing the cue stream failed", exc_info=True)
|
|
123
127
|
log.debug("Cue stream closed")
|
|
128
|
+
return True
|
|
124
129
|
|
|
125
130
|
|
|
126
131
|
def cue_stream_open() -> bool:
|
|
@@ -291,6 +291,20 @@ def _is_root() -> bool:
|
|
|
291
291
|
return hasattr(os, "geteuid") and os.geteuid() == 0
|
|
292
292
|
|
|
293
293
|
|
|
294
|
+
def sudo_invoker() -> str | None:
|
|
295
|
+
"""The user who ran us as root through sudo or doas, else None.
|
|
296
|
+
|
|
297
|
+
voiceio's user-scoped commands would then set up root's session (its
|
|
298
|
+
home, its systemd user manager, no Wayland or DBus) instead of theirs.
|
|
299
|
+
"""
|
|
300
|
+
if not _is_root():
|
|
301
|
+
return None
|
|
302
|
+
for var in ("SUDO_USER", "DOAS_USER"):
|
|
303
|
+
if (user := os.environ.get(var, "")) and user != "root":
|
|
304
|
+
return user
|
|
305
|
+
return None
|
|
306
|
+
|
|
307
|
+
|
|
294
308
|
# Flags that make a package manager prompt; dropped instead (emerge has no
|
|
295
309
|
# subcommand to put a yes-flag after, and without --ask it never asks).
|
|
296
310
|
_ASK_FLAGS: dict[str, tuple[str, ...]] = {"emerge": ("--ask", "-a")}
|