python-voiceio 1.18.14__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.14/python_voiceio.egg-info → python_voiceio-1.18.15}/PKG-INFO +1 -1
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/pyproject.toml +1 -1
- {python_voiceio-1.18.14 → python_voiceio-1.18.15/python_voiceio.egg-info}/PKG-INFO +1 -1
- {python_voiceio-1.18.14 → 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.15/voiceio/__init__.py +1 -0
- python_voiceio-1.18.15/voiceio/audio_devices.py +121 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/feedback.py +10 -5
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/recorder.py +34 -13
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/player.py +18 -15
- python_voiceio-1.18.14/voiceio/__init__.py +0 -1
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/LICENSE +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/README.md +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/python_voiceio.egg-info/dependency_links.txt +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/python_voiceio.egg-info/entry_points.txt +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/python_voiceio.egg-info/requires.txt +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/python_voiceio.egg-info/top_level.txt +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/setup.cfg +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_announce.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_app_wiring.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_audio_quality.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_audio_source.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_backend_probes.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_cancel.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_cli.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_clipboard_read.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_clipboard_typer.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_commands.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_concurrency_lockdown.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_config.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_context_terms.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_corrections.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_cuda_setup_hint.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_dead_mic.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_decoders.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_errorlog.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_evdev_uaccess.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_evdev_x11_optional.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_fallback.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_fcitx_bridge.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_feedback_stream.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_focus.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_gpu_fallback.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_health.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_hints.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_history.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_hotkey_modes.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_engine_limits.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_engine_listener.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_pending.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_pids.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_ping.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_session.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_textlimit.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_ibus_typer.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_idle_audio.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_install_env.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_clean.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_import.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_language.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_metrics.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_pipeline.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_quiet.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_resume.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_review.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_summary.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_learn_targets.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_llm.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_llm_api.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_mic_gain.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_mic_test.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_modifier_guard.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_numbers.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_paste_last.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_pipeline.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_platform.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_postcorrect.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_postprocess.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_prebuffer.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_presence.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_prompt.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_quiet_audio.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_recorder_integration.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_replies.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_report.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_retention.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_robustness.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_security_hardening.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_server.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_service.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_setup.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_sherpa.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_spool.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_streaming.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_suggest.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_telemetry.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_tokens.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_transcriber.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_tray.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_tts.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_tts_socket.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_typer_manager.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_vad.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_vocabulary.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_wordfreq.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/tests/test_worker_decode.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/__main__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/announce.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/app.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/audio_source.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/backends.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/configcmd.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/corrections.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/doctor.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/history.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/learn.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/models.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/replies.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/servicecmd.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/uninstall.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/cli/vocab.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/clipboard_read.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/commands.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/config.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/consent.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/context_terms.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/bias.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/base.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/catalog.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/fetch.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/lanes.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/sherpa.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/decoders/whispercpp.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/core/pipeline.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/corrections.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/data/60-voiceio-uaccess.rules +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/data/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/demo.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/display.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/errorlog.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/focus.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/health.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hints.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/history.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/base.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/chain.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/evdev.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/pynput_backend.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/hotkeys/socket_backend.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/install.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/pending.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/session.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ibus/textlimit.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/idle_audio.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/install_env.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/augment.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/clean.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/evaluate.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/importer.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/lastrun.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/metrics.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/quiet.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/review.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/store.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/summary.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/teacher.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/learn/train.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/llm.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/llm_api.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/mic_gain.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/models/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/models/silero_vad.onnx +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/numbers.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/pidlock.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/platform.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/postcorrect.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/postprocess.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/power.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/presence.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/privacy.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/prompt.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/quiet_audio.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/replies.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/report.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/retention.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/server/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/server/__main__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/server/app.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/server/config.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/server/runtime.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/service.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/configfile.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/extras.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/hotkey.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/noninteractive.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/speech.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/steps.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/system.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/setup/ui.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/sounds/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/sounds/alert.wav +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/sounds/commit.wav +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/sounds/start.wav +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/sounds/stop.wav +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/spool.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/streaming.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/suggest.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/telemetry.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tokens.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tray/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tray/_icons.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tray/_indicator.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tray/_pystray.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/base.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/chain.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/edge_engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/espeak.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/piper_engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/tts/supertonic_engine.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/__init__.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/base.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/chain.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/clipboard.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/collecting.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/fcitx_bridge.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/ibus.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/manager.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/modifier_guard.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/paste.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/pynput_type.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/wtype.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/xdotool.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/typers/ydotool.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/ui.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/vad.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/vocab_stats.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/vocabulary.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/watchdog.py +0 -0
- {python_voiceio-1.18.14 → python_voiceio-1.18.15}/voiceio/wordfreq.py +0 -0
|
@@ -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
|
|
@@ -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")
|
|
@@ -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:
|
|
@@ -160,16 +160,32 @@ class AudioRecorder:
|
|
|
160
160
|
return
|
|
161
161
|
# A heartbeat left over from before a close would read as a stale stream.
|
|
162
162
|
self._last_callback_time = 0.0
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
163
|
+
from voiceio.audio_devices import stream_in_use
|
|
164
|
+
with stream_in_use():
|
|
165
|
+
# device=None is PortAudio's default input, a name is matched
|
|
166
|
+
# against its device list: both resolved here, at every open.
|
|
167
|
+
stream = sd.InputStream(
|
|
168
|
+
samplerate=self.sample_rate,
|
|
169
|
+
channels=1,
|
|
170
|
+
dtype="float32",
|
|
171
|
+
device=self.device,
|
|
172
|
+
callback=self._callback,
|
|
173
|
+
)
|
|
174
|
+
self._stream = stream
|
|
175
|
+
stream.start()
|
|
176
|
+
log.info("Mic open: %s", self._describe_device(stream))
|
|
171
177
|
log.debug("Audio stream opened (prebuffer=%.1fs)", self.prebuffer_secs)
|
|
172
178
|
|
|
179
|
+
def _describe_device(self, stream: object) -> str:
|
|
180
|
+
"""Which device an open stream captures from, for the log."""
|
|
181
|
+
configured = "default" if self.device is None else repr(self.device)
|
|
182
|
+
index = getattr(stream, "device", None)
|
|
183
|
+
try:
|
|
184
|
+
name = sd.query_devices(index)["name"]
|
|
185
|
+
except Exception:
|
|
186
|
+
name = "?"
|
|
187
|
+
return f"{name!r} (index {index}, audio.device = {configured})"
|
|
188
|
+
|
|
173
189
|
# Maximum seconds between callbacks before we consider the stream dead.
|
|
174
190
|
# PortAudio typically fires every ~50-100ms; 5s covers long system sleeps.
|
|
175
191
|
_HEARTBEAT_TIMEOUT = 5.0
|
|
@@ -236,9 +252,16 @@ class AudioRecorder:
|
|
|
236
252
|
return float(np.max(np.abs(buf))) > 1e-4
|
|
237
253
|
|
|
238
254
|
def reopen_stream(self) -> None:
|
|
239
|
-
"""Close and reopen the audio stream (recovery from audio errors).
|
|
255
|
+
"""Close and reopen the audio stream (recovery from audio errors).
|
|
256
|
+
PortAudio is re-initialised in between (rate-limited), so the reopen
|
|
257
|
+
lands on the current default input, or the configured name's current
|
|
258
|
+
index, rather than the device list from daemon start."""
|
|
240
259
|
log.info("Reopening audio stream")
|
|
241
|
-
self.
|
|
260
|
+
self._reopen()
|
|
261
|
+
|
|
262
|
+
def _reopen(self) -> None:
|
|
263
|
+
from voiceio.audio_devices import refresh
|
|
264
|
+
refresh(close=self.close_stream)
|
|
242
265
|
self._last_callback_time = 0.0
|
|
243
266
|
self.open_stream()
|
|
244
267
|
|
|
@@ -344,9 +367,7 @@ class AudioRecorder:
|
|
|
344
367
|
"""Reopen a stream that died mid-recording; the recording goes on in
|
|
345
368
|
the new stream. Raises if the device can't be opened."""
|
|
346
369
|
try:
|
|
347
|
-
self.
|
|
348
|
-
self._last_callback_time = 0.0
|
|
349
|
-
self.open_stream()
|
|
370
|
+
self._reopen()
|
|
350
371
|
finally:
|
|
351
372
|
self._silent_signal_secs = 0.0
|
|
352
373
|
self._reviving = False
|
|
@@ -32,23 +32,26 @@ class TTSPlayer:
|
|
|
32
32
|
audio = audio.astype(np.int16).reshape(-1, 1)
|
|
33
33
|
|
|
34
34
|
try:
|
|
35
|
+
from voiceio.audio_devices import stream_in_use
|
|
35
36
|
from voiceio.feedback import open_output_stream
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
# Open to close: a PortAudio re-init meanwhile would free the stream.
|
|
39
|
+
with stream_in_use():
|
|
40
|
+
stream = open_output_stream(samplerate=sample_rate)
|
|
41
|
+
if stream is None:
|
|
42
|
+
log.warning("TTS: no audio output device")
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
stream.start()
|
|
46
|
+
try:
|
|
47
|
+
offset = 0
|
|
48
|
+
while offset < len(audio) and not self._cancel.is_set():
|
|
49
|
+
end = min(offset + _CHUNK_SIZE, len(audio))
|
|
50
|
+
stream.write(audio[offset:end])
|
|
51
|
+
offset = end
|
|
52
|
+
finally:
|
|
53
|
+
stream.stop()
|
|
54
|
+
stream.close()
|
|
52
55
|
except Exception:
|
|
53
56
|
log.debug("TTS playback error", exc_info=True)
|
|
54
57
|
finally:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.18.14"
|
|
File without changes
|
|
File without changes
|
{python_voiceio-1.18.14 → python_voiceio-1.18.15}/python_voiceio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|