python-voiceio 1.18.16__tar.gz → 1.18.19__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.16/python_voiceio.egg-info → python_voiceio-1.18.19}/PKG-INFO +1 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/pyproject.toml +1 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19/python_voiceio.egg-info}/PKG-INFO +1 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/python_voiceio.egg-info/SOURCES.txt +2 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_app_wiring.py +1 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_cancel.py +2 -2
- python_voiceio-1.18.19/tests/test_setup_sherpa_install.py +181 -0
- python_voiceio-1.18.19/tests/test_silent_tail.py +373 -0
- python_voiceio-1.18.19/voiceio/__init__.py +1 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/app.py +17 -6
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/audio_source.py +83 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/fetch.py +60 -15
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/recorder.py +21 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/speech.py +51 -7
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/steps.py +5 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/streaming.py +46 -13
- python_voiceio-1.18.16/voiceio/__init__.py +0 -1
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/LICENSE +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/README.md +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/python_voiceio.egg-info/dependency_links.txt +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/python_voiceio.egg-info/entry_points.txt +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/python_voiceio.egg-info/requires.txt +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/python_voiceio.egg-info/top_level.txt +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/setup.cfg +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_announce.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_audio_devices.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_audio_quality.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_audio_source.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_backend_probes.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_cli.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_clipboard_read.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_clipboard_typer.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_commands.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_concurrency_lockdown.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_config.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_context_terms.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_corrections.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_cuda_setup_hint.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_dead_mic.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_decoders.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_errorlog.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_evdev_uaccess.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_evdev_x11_optional.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_fallback.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_fcitx_bridge.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_feedback_stream.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_focus.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_gpu_fallback.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_health.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_hints.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_history.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_hotkey_modes.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_engine_limits.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_engine_listener.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_pending.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_pids.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_ping.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_session.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_textlimit.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_ibus_typer.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_idle_audio.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_input_latency.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_install_env.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_clean.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_import.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_language.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_metrics.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_pipeline.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_quiet.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_resume.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_review.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_summary.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_learn_targets.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_llm.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_llm_api.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_mic_gain.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_mic_test.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_modifier_guard.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_numbers.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_paste_last.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_pipeline.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_platform.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_postcorrect.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_postprocess.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_prebuffer.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_presence.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_prompt.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_quiet_audio.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_recorder_integration.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_replies.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_report.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_retention.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_robustness.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_security_hardening.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_server.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_service.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_setup.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_sherpa.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_spool.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_streaming.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_suggest.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_telemetry.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_tokens.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_transcriber.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_tray.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_tts.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_tts_socket.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_typer_manager.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_vad.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_vocabulary.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_wordfreq.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/tests/test_worker_decode.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/__main__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/announce.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/audio_devices.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/backends.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/configcmd.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/corrections.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/doctor.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/history.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/learn.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/models.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/replies.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/servicecmd.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/uninstall.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/cli/vocab.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/clipboard_read.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/commands.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/config.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/consent.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/context_terms.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/bias.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/base.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/catalog.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/lanes.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/sherpa.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/decoders/whispercpp.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/core/pipeline.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/corrections.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/data/60-voiceio-uaccess.rules +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/data/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/demo.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/display.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/errorlog.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/feedback.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/focus.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/health.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hints.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/history.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/base.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/chain.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/evdev.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/pynput_backend.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/hotkeys/socket_backend.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/install.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/pending.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/session.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ibus/textlimit.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/idle_audio.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/install_env.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/augment.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/clean.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/evaluate.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/importer.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/lastrun.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/metrics.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/quiet.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/review.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/store.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/summary.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/teacher.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/learn/train.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/llm.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/llm_api.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/mic_gain.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/models/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/models/silero_vad.onnx +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/numbers.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/pidlock.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/platform.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/postcorrect.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/postprocess.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/power.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/presence.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/privacy.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/prompt.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/quiet_audio.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/replies.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/report.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/retention.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/server/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/server/__main__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/server/app.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/server/config.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/server/runtime.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/service.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/configfile.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/extras.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/hotkey.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/noninteractive.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/system.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/setup/ui.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/sounds/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/sounds/alert.wav +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/sounds/commit.wav +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/sounds/start.wav +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/sounds/stop.wav +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/spool.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/suggest.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/telemetry.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tokens.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tray/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tray/_icons.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tray/_indicator.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tray/_pystray.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/base.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/chain.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/edge_engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/espeak.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/piper_engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/player.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/tts/supertonic_engine.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/__init__.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/base.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/chain.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/clipboard.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/collecting.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/fcitx_bridge.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/ibus.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/manager.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/modifier_guard.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/paste.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/pynput_type.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/wtype.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/xdotool.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/typers/ydotool.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/ui.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/vad.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/vocab_stats.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/vocabulary.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/watchdog.py +0 -0
- {python_voiceio-1.18.16 → python_voiceio-1.18.19}/voiceio/wordfreq.py +0 -0
|
@@ -83,7 +83,9 @@ tests/test_security_hardening.py
|
|
|
83
83
|
tests/test_server.py
|
|
84
84
|
tests/test_service.py
|
|
85
85
|
tests/test_setup.py
|
|
86
|
+
tests/test_setup_sherpa_install.py
|
|
86
87
|
tests/test_sherpa.py
|
|
88
|
+
tests/test_silent_tail.py
|
|
87
89
|
tests/test_spool.py
|
|
88
90
|
tests/test_streaming.py
|
|
89
91
|
tests/test_suggest.py
|
|
@@ -198,7 +198,7 @@ class TestStateMachine:
|
|
|
198
198
|
release = threading.Event()
|
|
199
199
|
seen = []
|
|
200
200
|
|
|
201
|
-
def fake_finalize(session, audio, elapsed, gen, rid):
|
|
201
|
+
def fake_finalize(session, audio, elapsed, gen, rid, speech=None):
|
|
202
202
|
finalizing.set()
|
|
203
203
|
release.wait(5)
|
|
204
204
|
seen.append((gen == vio._generation, rid == vio._recording))
|
|
@@ -134,7 +134,7 @@ def test_cancel_while_finalizing_keeps_nothing(tmp_path):
|
|
|
134
134
|
in_stop, release = threading.Event(), threading.Event()
|
|
135
135
|
session = MagicMock()
|
|
136
136
|
session.cancel.return_value = True
|
|
137
|
-
session.stop.side_effect = lambda audio: (in_stop.set(), release.wait(5), "words")[2]
|
|
137
|
+
session.stop.side_effect = lambda audio, speech=None: (in_stop.set(), release.wait(5), "words")[2]
|
|
138
138
|
done = threading.Event()
|
|
139
139
|
vio._typers.end.side_effect = lambda rid: done.set()
|
|
140
140
|
_finalizing(vio, tmp_path, session)
|
|
@@ -155,7 +155,7 @@ def test_cancel_too_late_changes_nothing(tmp_path):
|
|
|
155
155
|
in_stop, release = threading.Event(), threading.Event()
|
|
156
156
|
session = MagicMock()
|
|
157
157
|
session.cancel.return_value = False # final text already typed
|
|
158
|
-
session.stop.side_effect = lambda audio: (in_stop.set(), release.wait(5), "words")[2]
|
|
158
|
+
session.stop.side_effect = lambda audio, speech=None: (in_stop.set(), release.wait(5), "words")[2]
|
|
159
159
|
# The finalizer goes on to copy the text from its own thread; left real, it
|
|
160
160
|
# lands on whatever clipboard a later test has patched in.
|
|
161
161
|
vio._copy_result_async = MagicMock()
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""The setup wizard offering Parakeet to English users without sherpa-onnx."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from voiceio.core.decoders import catalog, fetch, sherpa
|
|
9
|
+
from voiceio.core.decoders.sherpa import SherpaFeatures
|
|
10
|
+
from voiceio.setup import noninteractive, speech, steps
|
|
11
|
+
from test_setup import _patch_noninteractive, cfg_paths # noqa: F401 — fixture
|
|
12
|
+
|
|
13
|
+
# conftest replaces `sherpa.features` in every test; keep the real one.
|
|
14
|
+
REAL_FEATURES = sherpa.features
|
|
15
|
+
FIXED = SherpaFeatures(installed=True, length_reward=True, pretokenized_hotwords=True)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.fixture
|
|
19
|
+
def installable(monkeypatch):
|
|
20
|
+
"""English user, no sherpa-onnx, an environment the installer can write to."""
|
|
21
|
+
monkeypatch.setattr(fetch, "can_install_sherpa", lambda: True)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@pytest.fixture
|
|
25
|
+
def wizard(monkeypatch):
|
|
26
|
+
"""Run `_step_model` with the menu answer given; record downloads."""
|
|
27
|
+
downloads: list[str] = []
|
|
28
|
+
monkeypatch.setattr(steps, "_download_model", lambda name: downloads.append(name) or True)
|
|
29
|
+
monkeypatch.setattr(steps, "_ask_yn", lambda *a, **k: False)
|
|
30
|
+
monkeypatch.setattr(steps, "_print_step", lambda *a: None)
|
|
31
|
+
|
|
32
|
+
def run(answer: int = 0, language: str = "en") -> tuple[steps.SetupState, list, list]:
|
|
33
|
+
shown: list = []
|
|
34
|
+
|
|
35
|
+
def ask(options, default=0):
|
|
36
|
+
shown.append((list(options), default))
|
|
37
|
+
return answer
|
|
38
|
+
monkeypatch.setattr(steps, "_ask_choice", ask)
|
|
39
|
+
state = steps.SetupState(language=language)
|
|
40
|
+
steps._step_model(state)
|
|
41
|
+
return state, shown, downloads
|
|
42
|
+
return run
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_english_without_sherpa_offers_parakeet_first_with_install_label(installable):
|
|
46
|
+
choices = speech.model_choices("en", offer_install=True)
|
|
47
|
+
assert choices[0] == speech.PARAKEET_INSTALL_CHOICE
|
|
48
|
+
assert choices[0][0] == catalog.PARAKEET
|
|
49
|
+
assert "installs sherpa-onnx" in choices[0][2]
|
|
50
|
+
assert speech.default_choice(choices) == 0
|
|
51
|
+
assert not any("recommended" in c[2] for c in choices[1:])
|
|
52
|
+
# Only the interactive wizard asks for it.
|
|
53
|
+
assert speech.model_choices("en") is speech.MODELS
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def test_choosing_it_runs_the_shared_installer_then_selects_parakeet(
|
|
57
|
+
installable, wizard, monkeypatch):
|
|
58
|
+
calls = []
|
|
59
|
+
|
|
60
|
+
def install(**kw):
|
|
61
|
+
calls.append(kw)
|
|
62
|
+
monkeypatch.setattr(sherpa, "features", lambda: FIXED)
|
|
63
|
+
monkeypatch.setattr(fetch, "install_sherpa", install)
|
|
64
|
+
state, shown, downloads = wizard(0)
|
|
65
|
+
assert shown[0][0][0] == speech.PARAKEET_INSTALL_CHOICE and shown[0][1] == 0
|
|
66
|
+
assert calls == [{"quiet": True}]
|
|
67
|
+
assert state.model_name == catalog.PARAKEET
|
|
68
|
+
assert downloads == [catalog.PARAKEET]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def test_installer_failure_falls_back_to_small_and_setup_goes_on(
|
|
72
|
+
installable, wizard, monkeypatch, capsys):
|
|
73
|
+
def install(**kw):
|
|
74
|
+
raise OSError("no network")
|
|
75
|
+
monkeypatch.setattr(fetch, "install_sherpa", install)
|
|
76
|
+
state, _, downloads = wizard(0)
|
|
77
|
+
assert state.model_name == "small"
|
|
78
|
+
assert downloads == ["small"]
|
|
79
|
+
out = capsys.readouterr().out
|
|
80
|
+
assert "Couldn't install sherpa-onnx (no network)" in out
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_install_that_still_cannot_load_falls_back(installable, wizard, monkeypatch):
|
|
84
|
+
monkeypatch.setattr(fetch, "install_sherpa", lambda **kw: None) # features unchanged
|
|
85
|
+
state, _, downloads = wizard(0)
|
|
86
|
+
assert state.model_name == "small" and downloads == ["small"]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def test_picking_whisper_does_not_install(installable, wizard, monkeypatch):
|
|
90
|
+
monkeypatch.setattr(fetch, "install_sherpa", lambda **kw: pytest.fail("installed"))
|
|
91
|
+
state, shown, _ = wizard(3)
|
|
92
|
+
assert state.model_name == shown[0][0][3][0] == "small"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_non_english_is_unchanged(installable, wizard, monkeypatch):
|
|
96
|
+
assert speech.model_choices("es", offer_install=True) is speech.MODELS
|
|
97
|
+
monkeypatch.setattr(fetch, "install_sherpa", lambda **kw: pytest.fail("installed"))
|
|
98
|
+
state, shown, _ = wizard(2, language="es")
|
|
99
|
+
assert shown[0][0] == speech.MODELS and state.model_name == "small"
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_already_installed_sherpa_keeps_todays_label(installable, wizard, monkeypatch):
|
|
103
|
+
monkeypatch.setattr(sherpa, "features", lambda: FIXED)
|
|
104
|
+
monkeypatch.setattr(fetch, "install_sherpa", lambda **kw: pytest.fail("installed"))
|
|
105
|
+
assert speech.model_choices("en", offer_install=True)[0] == speech.PARAKEET_CHOICE
|
|
106
|
+
state, _, downloads = wizard(0)
|
|
107
|
+
assert state.model_name == catalog.PARAKEET and downloads == [catalog.PARAKEET]
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def test_an_older_sherpa_is_not_swapped_inside_the_wizard(installable, monkeypatch):
|
|
111
|
+
monkeypatch.setattr(sherpa, "features", lambda: SherpaFeatures(installed=True))
|
|
112
|
+
assert speech.model_choices("en", offer_install=True) is speech.MODELS
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@pytest.mark.parametrize("where", ["deb", "nix", "uvx", "readonly", "no-pip", "armv7l"])
|
|
116
|
+
def test_not_offered_where_the_install_cannot_work(monkeypatch, tmp_path, where):
|
|
117
|
+
import platform
|
|
118
|
+
import sysconfig
|
|
119
|
+
|
|
120
|
+
import voiceio.install_env as install_env
|
|
121
|
+
import voiceio.service as service
|
|
122
|
+
monkeypatch.setattr(service, "packaged_by", lambda: "deb" if where == "deb" else None)
|
|
123
|
+
monkeypatch.setattr(sys, "prefix", "/nix/store/abc-voiceio" if where == "nix" else
|
|
124
|
+
str(tmp_path))
|
|
125
|
+
monkeypatch.setattr(install_env, "running_ephemeral", lambda: where == "uvx")
|
|
126
|
+
monkeypatch.setattr(platform, "machine", lambda: "armv7l" if where == "armv7l" else "x86_64")
|
|
127
|
+
monkeypatch.setattr(fetch, "_pip_command",
|
|
128
|
+
lambda reinstall=False: None if where == "no-pip" else ["pip"])
|
|
129
|
+
site = tmp_path / "site"
|
|
130
|
+
site.mkdir()
|
|
131
|
+
monkeypatch.setattr(sysconfig, "get_paths",
|
|
132
|
+
lambda: {"purelib": str(site), "platlib": str(site)})
|
|
133
|
+
if where == "readonly":
|
|
134
|
+
monkeypatch.setattr(fetch.os, "access", lambda p, mode: False)
|
|
135
|
+
assert fetch.can_install_sherpa() is False
|
|
136
|
+
assert speech.model_choices("en", offer_install=True) is speech.MODELS
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_offered_in_a_writable_pip_environment(monkeypatch, tmp_path):
|
|
140
|
+
import platform
|
|
141
|
+
import sysconfig
|
|
142
|
+
|
|
143
|
+
import voiceio.install_env as install_env
|
|
144
|
+
import voiceio.service as service
|
|
145
|
+
monkeypatch.setattr(service, "packaged_by", lambda: None)
|
|
146
|
+
monkeypatch.setattr(sys, "prefix", str(tmp_path))
|
|
147
|
+
monkeypatch.setattr(install_env, "running_ephemeral", lambda: False)
|
|
148
|
+
monkeypatch.setattr(platform, "machine", lambda: "x86_64")
|
|
149
|
+
monkeypatch.setattr(fetch, "_pip_command", lambda reinstall=False: ["pip"])
|
|
150
|
+
monkeypatch.setattr(sysconfig, "get_paths",
|
|
151
|
+
lambda: {"purelib": str(tmp_path), "platlib": str(tmp_path)})
|
|
152
|
+
assert fetch.can_install_sherpa() is True
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def test_noninteractive_setup_installs_nothing(installable, cfg_paths, monkeypatch): # noqa: F811
|
|
156
|
+
_patch_noninteractive(monkeypatch)
|
|
157
|
+
monkeypatch.setattr(fetch, "install_sherpa", lambda **kw: pytest.fail("installed"))
|
|
158
|
+
assert noninteractive.run_setup_noninteractive({}) == 0
|
|
159
|
+
from voiceio import config
|
|
160
|
+
assert config.load(cfg_paths).model.name == "small"
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def test_install_sherpa_uses_the_shared_pip_path_and_refreshes_detection(monkeypatch):
|
|
164
|
+
monkeypatch.setattr(sherpa, "features", REAL_FEATURES)
|
|
165
|
+
REAL_FEATURES()
|
|
166
|
+
assert REAL_FEATURES.cache_info().currsize == 1
|
|
167
|
+
calls = []
|
|
168
|
+
monkeypatch.setattr(fetch, "_pip_install", lambda args, **kw: calls.append((args, kw)))
|
|
169
|
+
fetch.install_sherpa(quiet=True)
|
|
170
|
+
assert calls == [(["--upgrade", fetch.SHERPA_REQUIREMENT], {"quiet": True})]
|
|
171
|
+
assert REAL_FEATURES.cache_info().currsize == 0
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_quiet_pip_failure_names_pips_last_line(monkeypatch):
|
|
175
|
+
import subprocess
|
|
176
|
+
import types
|
|
177
|
+
monkeypatch.setattr(fetch, "_pip_command", lambda reinstall=False: ["pip", "install"])
|
|
178
|
+
monkeypatch.setattr(subprocess, "run", lambda cmd, **kw: types.SimpleNamespace(
|
|
179
|
+
returncode=1, stderr="Collecting x\nERROR: No matching distribution\n"))
|
|
180
|
+
with pytest.raises(OSError, match="No matching distribution"):
|
|
181
|
+
fetch._pip_install(["sherpa-onnx>=2.0.2"], quiet=True)
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
"""A stop tail (audio.input_latency_ms, hotkey.release_tail_ms) records
|
|
2
|
+
after the stop press. When nothing more was said it is silence, and given
|
|
3
|
+
silence Whisper writes its context prompt back or a stock phrase ("Thank you
|
|
4
|
+
for watching."). So the tail is decoded only up to its speech; everything
|
|
5
|
+
before the press decodes exactly as in 1.18.18."""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
from unittest.mock import MagicMock
|
|
10
|
+
|
|
11
|
+
import numpy as np
|
|
12
|
+
import pytest
|
|
13
|
+
from fakes import FakeDecoder
|
|
14
|
+
from test_sherpa import FIXED, FakeSherpa, _model_dir
|
|
15
|
+
|
|
16
|
+
from voiceio.audio_source import SPEECH_TAIL_PAD_SECS, SpeechSpans
|
|
17
|
+
from voiceio.config import AudioConfig
|
|
18
|
+
from voiceio.core.decoders import sherpa
|
|
19
|
+
from voiceio.recorder import AudioRecorder
|
|
20
|
+
from voiceio.streaming import StreamingSession
|
|
21
|
+
from voiceio.typers.base import TyperBackend
|
|
22
|
+
|
|
23
|
+
SR = 16000
|
|
24
|
+
BLOCK = 1600 # 0.1 s: one audio callback
|
|
25
|
+
WORD_BLOCKS = 5 # a "word" is 0.5 s of one constant level
|
|
26
|
+
STOCK = "Thank you for watching."
|
|
27
|
+
PAD = int(SPEECH_TAIL_PAD_SECS * SR)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _words(*ids: int) -> np.ndarray:
|
|
31
|
+
"""Speech: word n is 0.5 s at level n/100 (n >= 10)."""
|
|
32
|
+
return np.concatenate([np.full(WORD_BLOCKS * BLOCK, n / 100, np.float32) for n in ids])
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _quiet(secs: float) -> np.ndarray:
|
|
36
|
+
"""A real room: low noise, not digital zeros."""
|
|
37
|
+
rng = np.random.default_rng(int(secs * 1000))
|
|
38
|
+
return (rng.standard_normal(int(secs * SR)) * 1e-3).astype(np.float32)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def whisper_like(audio, final=False, context=None) -> str:
|
|
42
|
+
"""Reads the words back like Whisper, including its silence failures:
|
|
43
|
+
no speech at all → the prompt's last sentence (or a stock phrase), and a
|
|
44
|
+
second or more of trailing silence → a stock phrase after the words."""
|
|
45
|
+
blocks = [float(np.mean(audio[i:i + BLOCK])) for i in range(0, len(audio), BLOCK)]
|
|
46
|
+
words, last_loud = [], -1
|
|
47
|
+
for i, v in enumerate(blocks):
|
|
48
|
+
if abs(v) > 0.05:
|
|
49
|
+
w = f"w{round(v * 100)}"
|
|
50
|
+
if not words or words[-1] != w or i != last_loud + 1:
|
|
51
|
+
words.append(w)
|
|
52
|
+
last_loud = i
|
|
53
|
+
if not words:
|
|
54
|
+
return context.split(". ")[-1] if context else STOCK
|
|
55
|
+
if len(blocks) - 1 - last_loud >= 10:
|
|
56
|
+
words.append(STOCK)
|
|
57
|
+
return " ".join(words)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ThresholdVad:
|
|
61
|
+
def reset(self) -> None:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
def is_speech(self, chunk) -> bool:
|
|
65
|
+
return float(np.max(np.abs(chunk))) > 0.05
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _rig(freeze_secs=8.0, decoder=None):
|
|
69
|
+
"""A real AudioRecorder (VAD + pause detection, no device) feeding a
|
|
70
|
+
session whose passes the test runs by hand."""
|
|
71
|
+
rec = AudioRecorder(AudioConfig(sample_rate=SR, prebuffer_secs=0.0,
|
|
72
|
+
silence_duration=0.6), vad=ThresholdVad())
|
|
73
|
+
rec._stream = MagicMock()
|
|
74
|
+
if decoder is None:
|
|
75
|
+
decoder = FakeDecoder()
|
|
76
|
+
decoder.transcribe.side_effect = whisper_like
|
|
77
|
+
session = StreamingSession(decoder=decoder, typer=MagicMock(spec=TyperBackend),
|
|
78
|
+
recorder=rec, freeze_secs=freeze_secs)
|
|
79
|
+
rec.start()
|
|
80
|
+
rec.set_on_speech_pause(session._on_vad_pause)
|
|
81
|
+
return rec, session, decoder
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _feed(rec, audio, session=None):
|
|
85
|
+
"""Deliver audio in 0.1 s callbacks; with a session, run a pass (what
|
|
86
|
+
the worker does every second or at a pause) after every callback."""
|
|
87
|
+
for i in range(0, len(audio), BLOCK):
|
|
88
|
+
chunk = audio[i:i + BLOCK].reshape(-1, 1)
|
|
89
|
+
rec._callback(chunk, len(chunk), None, None)
|
|
90
|
+
if session is not None:
|
|
91
|
+
session._transcribe_and_apply()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def _stop(rec, session):
|
|
95
|
+
audio = rec.stop()
|
|
96
|
+
return session.stop(audio, rec.speech_spans()), audio
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _decoded(dec) -> list[np.ndarray]:
|
|
100
|
+
return [c.args[0] for c in dec.transcribe.call_args_list]
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# Toggle: the tail is input_latency_ms; hold: release_tail_ms + latency.
|
|
104
|
+
TAILS = {"toggle": 2.0, "hold": 0.25 + 2.0}
|
|
105
|
+
TEN = tuple(range(20, 30)) # 5 s of speech: freezes at its pause
|
|
106
|
+
TEN_TEXT = " ".join(f"w{n}" for n in TEN)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def test_the_fake_reproduces_whisper_on_silence():
|
|
110
|
+
assert whisper_like(_quiet(2), context="Testing. Can you hear me") == "Can you hear me"
|
|
111
|
+
assert whisper_like(np.concatenate([_words(20, 21), _quiet(2)])) == f"w20 w21 {STOCK}"
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@pytest.mark.parametrize("mode", TAILS)
|
|
115
|
+
def test_silent_tail_after_speech_decodes_to_the_speech_only(mode):
|
|
116
|
+
rec, s, dec = _rig()
|
|
117
|
+
speech = _words(20, 21, 22, 23) # 2 s: too short to freeze
|
|
118
|
+
_feed(rec, speech)
|
|
119
|
+
rec.mark_stop_press()
|
|
120
|
+
_feed(rec, _quiet(TAILS[mode]))
|
|
121
|
+
_, audio = _stop(rec, s)
|
|
122
|
+
assert s.raw_final_text == "w20 w21 w22 w23"
|
|
123
|
+
# The final decode: everything before the press, plus the pad.
|
|
124
|
+
assert len(_decoded(dec)[-1]) == len(speech) + PAD
|
|
125
|
+
assert len(audio) > len(speech) + SR
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@pytest.mark.parametrize("mode", TAILS)
|
|
129
|
+
def test_silent_tail_after_a_freeze_is_not_decoded(mode):
|
|
130
|
+
"""The echo: the pause freeze lands in the tail, leaving the stop-time
|
|
131
|
+
pass only silence, conditioned on the frozen text."""
|
|
132
|
+
rec, s, dec = _rig()
|
|
133
|
+
_feed(rec, _words(*TEN))
|
|
134
|
+
rec.mark_stop_press()
|
|
135
|
+
_feed(rec, _quiet(TAILS[mode]), session=s) # pause → freeze, then interims
|
|
136
|
+
assert s._frozen_raw == TEN_TEXT
|
|
137
|
+
after = s.trace[[p["kind"] for p in s.trace].index("freeze") + 1:]
|
|
138
|
+
assert after and all(p["text"] == "" and p["voiced_secs"] == 0 for p in after)
|
|
139
|
+
assert s.interim_text == TEN_TEXT
|
|
140
|
+
decodes = dec.transcribe.call_count
|
|
141
|
+
_stop(rec, s)
|
|
142
|
+
assert dec.transcribe.call_count == decodes # the silent tail: no decode
|
|
143
|
+
assert s.raw_final_text == TEN_TEXT
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def test_interims_in_the_tail_show_no_hallucination():
|
|
147
|
+
rec, s, dec = _rig()
|
|
148
|
+
shown = []
|
|
149
|
+
s._on_interim = shown.append
|
|
150
|
+
_feed(rec, _words(20, 21), session=s)
|
|
151
|
+
rec.mark_stop_press()
|
|
152
|
+
_feed(rec, _quiet(2.0), session=s)
|
|
153
|
+
assert all(STOCK not in t for t in shown)
|
|
154
|
+
assert all(STOCK not in p["text"] for p in s.trace)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@pytest.mark.parametrize("freeze_first", [False, True])
|
|
158
|
+
def test_speech_arriving_inside_the_tail_is_kept(freeze_first):
|
|
159
|
+
"""What the tail is for: the last word lands 1.5 s after the stop press."""
|
|
160
|
+
rec, s, dec = _rig()
|
|
161
|
+
ids = TEN if freeze_first else (20, 21, 22, 23)
|
|
162
|
+
_feed(rec, _words(*ids), session=s)
|
|
163
|
+
rec.mark_stop_press()
|
|
164
|
+
_feed(rec, np.concatenate([_quiet(1.5), _words(40), _quiet(0.5)]), session=s)
|
|
165
|
+
assert bool(s._frozen_samples) == freeze_first
|
|
166
|
+
_stop(rec, s)
|
|
167
|
+
assert s.raw_final_text == " ".join(f"w{n}" for n in ids) + " w40"
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def test_trailing_pad_follows_the_last_speech_in_the_tail():
|
|
171
|
+
rec, s, dec = _rig(freeze_secs=0)
|
|
172
|
+
before = np.concatenate([_words(20), _quiet(0.2)])
|
|
173
|
+
_feed(rec, before)
|
|
174
|
+
rec.mark_stop_press()
|
|
175
|
+
_feed(rec, np.concatenate([_words(21), _quiet(2.0)]))
|
|
176
|
+
_stop(rec, s)
|
|
177
|
+
decoded = _decoded(dec)[-1]
|
|
178
|
+
end = len(before) + len(_words(21))
|
|
179
|
+
assert len(decoded) == end + PAD
|
|
180
|
+
assert np.array_equal(decoded[:end], np.concatenate([before, _words(21)]))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_audio_before_the_press_is_never_trimmed():
|
|
184
|
+
"""Silence the user left before pressing stop decodes as it always did."""
|
|
185
|
+
rec, s, dec = _rig(freeze_secs=0)
|
|
186
|
+
before = np.concatenate([_words(20, 21), _quiet(1.5)])
|
|
187
|
+
_feed(rec, before)
|
|
188
|
+
rec.mark_stop_press()
|
|
189
|
+
_feed(rec, _quiet(2.0))
|
|
190
|
+
_stop(rec, s)
|
|
191
|
+
assert np.array_equal(_decoded(dec)[-1], before)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def test_a_recording_the_vad_heard_no_speech_in_is_decoded_whole():
|
|
195
|
+
rec, s, dec = _rig()
|
|
196
|
+
_feed(rec, _quiet(1.0))
|
|
197
|
+
rec.mark_stop_press()
|
|
198
|
+
_feed(rec, _quiet(2.0))
|
|
199
|
+
_, audio = _stop(rec, s)
|
|
200
|
+
assert np.array_equal(_decoded(dec)[-1], audio)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
def test_withdrawn_stop_press_trims_nothing():
|
|
204
|
+
rec, s, dec = _rig(freeze_secs=0)
|
|
205
|
+
_feed(rec, _words(20))
|
|
206
|
+
rec.mark_stop_press()
|
|
207
|
+
rec.mark_stop_press(False) # a press during the tail resumed
|
|
208
|
+
_feed(rec, _quiet(2.0))
|
|
209
|
+
_, audio = _stop(rec, s)
|
|
210
|
+
assert np.array_equal(_decoded(dec)[-1], audio)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def test_voiced_end_rules():
|
|
214
|
+
spans = SpeechSpans(SR, unchecked=SR) # 1 s pre-buffer
|
|
215
|
+
spans.mark(SR, 2 * SR, False)
|
|
216
|
+
spans.mark(2 * SR, 3 * SR, True)
|
|
217
|
+
spans.mark(3 * SR, 6 * SR, False)
|
|
218
|
+
assert spans.voiced_end(0, 6 * SR) == 6 * SR # no press: untouched
|
|
219
|
+
spans.press = 4 * SR
|
|
220
|
+
assert spans.voiced_end(0, 6 * SR) == 4 * SR # silent tail: cut at the press
|
|
221
|
+
assert spans.voiced_end(0, 4 * SR + PAD) == 4 * SR + PAD # tail <= pad: whole
|
|
222
|
+
assert spans.voiced_end(5 * SR, 6 * SR) == 5 * SR # silent span in the tail: nothing
|
|
223
|
+
assert spans.voiced_end(0, 7 * SR) == 7 * SR # 6..7 s not judged yet: kept
|
|
224
|
+
spans.press = 3 * SR - PAD // 2 # speech ran just past the press
|
|
225
|
+
assert spans.voiced_end(0, 6 * SR) == 3 * SR + PAD
|
|
226
|
+
spans.press = 3 * SR + PAD // 2 # ...or ended just before it
|
|
227
|
+
assert spans.voiced_end(0, 6 * SR) == 3 * SR + PAD
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
# ── unchanged from 1.18.18 without a long tail ───────────────────────────
|
|
231
|
+
|
|
232
|
+
def _decodes_with_and_without_spans(script):
|
|
233
|
+
"""Every decode input of `script`, run through the new code and through
|
|
234
|
+
the 1.18.18 path (no speech spans anywhere)."""
|
|
235
|
+
runs = []
|
|
236
|
+
for spans in (True, False):
|
|
237
|
+
rec, s, dec = _rig()
|
|
238
|
+
if not spans:
|
|
239
|
+
rec.speech_spans = lambda: None
|
|
240
|
+
script(rec, s)
|
|
241
|
+
audio = rec.stop()
|
|
242
|
+
s.stop(audio, rec.speech_spans())
|
|
243
|
+
runs.append((_decoded(dec), s.raw_final_text))
|
|
244
|
+
return runs
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def _assert_identical(runs):
|
|
248
|
+
(new, new_text), (old, old_text) = runs
|
|
249
|
+
assert new_text == old_text
|
|
250
|
+
assert len(new) == len(old) > 1
|
|
251
|
+
assert all(a.dtype == b.dtype and np.array_equal(a, b) for a, b in zip(new, old))
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def test_toggle_without_latency_decodes_byte_identical():
|
|
255
|
+
"""input_latency_ms = 0: the stop is immediate, no press is marked."""
|
|
256
|
+
def script(rec, s):
|
|
257
|
+
_feed(rec, _words(*TEN), session=s)
|
|
258
|
+
_feed(rec, _quiet(1.0), session=s) # a pause freeze...
|
|
259
|
+
_feed(rec, np.concatenate([_words(40, 41), _quiet(0.5)]), session=s)
|
|
260
|
+
_assert_identical(_decodes_with_and_without_spans(script))
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
def test_hold_with_the_default_release_tail_decodes_byte_identical():
|
|
264
|
+
"""hotkey.release_tail_ms = 250, no latency: shorter than the pad."""
|
|
265
|
+
def script(rec, s):
|
|
266
|
+
_feed(rec, _words(*TEN), session=s)
|
|
267
|
+
_feed(rec, _quiet(1.0), session=s)
|
|
268
|
+
_feed(rec, _words(40, 41), session=s)
|
|
269
|
+
_feed(rec, _quiet(0.5), session=s) # paused before letting go
|
|
270
|
+
rec.mark_stop_press()
|
|
271
|
+
_feed(rec, _quiet(0.25), session=s)
|
|
272
|
+
_assert_identical(_decodes_with_and_without_spans(script))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
# ── every decode path gets the same trimming ─────────────────────────────
|
|
276
|
+
|
|
277
|
+
def test_parallel_tail_decode_is_trimmed_too():
|
|
278
|
+
"""A freeze still decoding at stop: the tail after its cut decodes on the
|
|
279
|
+
draft lane, with the same trimming."""
|
|
280
|
+
rec, s, dec = _rig()
|
|
281
|
+
dec.draft = FakeDecoder()
|
|
282
|
+
dec.draft.transcribe.side_effect = whisper_like
|
|
283
|
+
speech = _words(20, 21)
|
|
284
|
+
_feed(rec, speech)
|
|
285
|
+
rec.mark_stop_press()
|
|
286
|
+
_feed(rec, _quiet(2.0))
|
|
287
|
+
s._freeze_pending_end = 0
|
|
288
|
+
audio = rec.stop()
|
|
289
|
+
s._final_speech = rec.speech_spans()
|
|
290
|
+
pre = s._decode_past_pending_freeze(audio)
|
|
291
|
+
assert pre[1].text == "w20 w21"
|
|
292
|
+
assert len(dec.draft.transcribe.call_args.args[0]) == len(speech) + PAD
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _parakeet_rig(monkeypatch, tmp_path):
|
|
296
|
+
fake = FakeSherpa(text="hello")
|
|
297
|
+
monkeypatch.setitem(sys.modules, "sherpa_onnx", fake.module)
|
|
298
|
+
monkeypatch.setattr(sherpa, "features", lambda: FIXED)
|
|
299
|
+
rec, s, _ = _rig(decoder=sherpa.SherpaTransducer(_model_dir(tmp_path)))
|
|
300
|
+
return fake, rec, s
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def test_parakeet_decodes_only_the_speech(monkeypatch, tmp_path):
|
|
304
|
+
fake, rec, s = _parakeet_rig(monkeypatch, tmp_path)
|
|
305
|
+
speech = _words(20, 21, 22)
|
|
306
|
+
_feed(rec, speech)
|
|
307
|
+
rec.mark_stop_press()
|
|
308
|
+
_feed(rec, _quiet(2.0))
|
|
309
|
+
fake.streams.clear()
|
|
310
|
+
_stop(rec, s)
|
|
311
|
+
assert [st["samples"] for st in fake.streams] == [len(speech) + PAD]
|
|
312
|
+
assert s.raw_final_text == "hello"
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
def test_parakeet_never_sees_a_silent_tail_after_a_freeze(monkeypatch, tmp_path):
|
|
316
|
+
fake, rec, s = _parakeet_rig(monkeypatch, tmp_path)
|
|
317
|
+
_feed(rec, _words(*TEN))
|
|
318
|
+
rec.mark_stop_press()
|
|
319
|
+
_feed(rec, _quiet(2.0), session=s)
|
|
320
|
+
assert s._frozen_raw == "hello"
|
|
321
|
+
fake.streams.clear()
|
|
322
|
+
_stop(rec, s)
|
|
323
|
+
assert fake.streams == []
|
|
324
|
+
assert s.raw_final_text == "hello"
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
# ── the daemon marks the press and hands the spans to both final paths ───
|
|
328
|
+
|
|
329
|
+
def test_a_stop_with_a_tail_marks_the_press_and_a_resume_withdraws_it():
|
|
330
|
+
from test_input_latency import _app, _start_then_stop
|
|
331
|
+
|
|
332
|
+
from voiceio.app import _State
|
|
333
|
+
vio = _app("toggle", latency_ms=5000)
|
|
334
|
+
_start_then_stop(vio)
|
|
335
|
+
assert vio._state == _State.RECORDING
|
|
336
|
+
vio.recorder.mark_stop_press.assert_called_once_with()
|
|
337
|
+
vio._resume()
|
|
338
|
+
vio.recorder.mark_stop_press.assert_called_with(False)
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def test_an_immediate_stop_marks_no_press():
|
|
342
|
+
from test_input_latency import _app, _start_then_stop
|
|
343
|
+
vio = _app("toggle", latency_ms=0)
|
|
344
|
+
_start_then_stop(vio)
|
|
345
|
+
vio.recorder.mark_stop_press.assert_not_called()
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
def test_stop_passes_the_speech_spans_to_the_finalizer():
|
|
349
|
+
from test_cancel import _make_app
|
|
350
|
+
|
|
351
|
+
from voiceio.app import _State
|
|
352
|
+
vio = _make_app()
|
|
353
|
+
spans = SpeechSpans(SR)
|
|
354
|
+
vio.recorder.speech_spans.return_value = spans
|
|
355
|
+
vio.recorder.stop.return_value = np.zeros(SR, np.float32)
|
|
356
|
+
vio._state, vio._session, vio._streaming = _State.RECORDING, MagicMock(), True
|
|
357
|
+
calls = []
|
|
358
|
+
vio._output_thread = lambda target, *args: calls.append(args)
|
|
359
|
+
vio._do_stop()
|
|
360
|
+
assert calls[0][-1] is spans
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def test_batch_decode_is_trimmed():
|
|
364
|
+
from test_cancel import _make_app
|
|
365
|
+
vio = _make_app()
|
|
366
|
+
vio._retention_extra = lambda audio: {}
|
|
367
|
+
vio.engine.transcribe.return_value = MagicMock(text="", abort=False)
|
|
368
|
+
spans = SpeechSpans(SR)
|
|
369
|
+
spans.mark(0, SR, True)
|
|
370
|
+
spans.mark(SR, 3 * SR, False)
|
|
371
|
+
spans.press = SR
|
|
372
|
+
vio._process(np.zeros(3 * SR, np.float32), vio._generation, speech=spans)
|
|
373
|
+
assert len(vio.engine.transcribe.call_args.args[0]) == SR + PAD
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.18.19"
|