python-voiceio 1.18.15__tar.gz → 1.18.16__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.
Files changed (253) hide show
  1. {python_voiceio-1.18.15/python_voiceio.egg-info → python_voiceio-1.18.16}/PKG-INFO +1 -1
  2. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/pyproject.toml +1 -1
  3. {python_voiceio-1.18.15 → python_voiceio-1.18.16/python_voiceio.egg-info}/PKG-INFO +1 -1
  4. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/python_voiceio.egg-info/SOURCES.txt +1 -0
  5. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_hotkey_modes.py +10 -3
  6. python_voiceio-1.18.16/tests/test_input_latency.py +212 -0
  7. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_mic_test.py +35 -0
  8. python_voiceio-1.18.16/voiceio/__init__.py +1 -0
  9. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/app.py +111 -15
  10. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/config.py +16 -0
  11. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/speech.py +42 -1
  12. python_voiceio-1.18.15/voiceio/__init__.py +0 -1
  13. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/LICENSE +0 -0
  14. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/README.md +0 -0
  15. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/python_voiceio.egg-info/dependency_links.txt +0 -0
  16. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/python_voiceio.egg-info/entry_points.txt +0 -0
  17. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/python_voiceio.egg-info/requires.txt +0 -0
  18. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/python_voiceio.egg-info/top_level.txt +0 -0
  19. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/setup.cfg +0 -0
  20. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_announce.py +0 -0
  21. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_app_wiring.py +0 -0
  22. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_audio_devices.py +0 -0
  23. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_audio_quality.py +0 -0
  24. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_audio_source.py +0 -0
  25. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_backend_probes.py +0 -0
  26. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_cancel.py +0 -0
  27. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_cli.py +0 -0
  28. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_clipboard_read.py +0 -0
  29. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_clipboard_typer.py +0 -0
  30. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_commands.py +0 -0
  31. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_concurrency_lockdown.py +0 -0
  32. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_config.py +0 -0
  33. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_context_terms.py +0 -0
  34. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_corrections.py +0 -0
  35. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_cuda_setup_hint.py +0 -0
  36. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_dead_mic.py +0 -0
  37. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_decoders.py +0 -0
  38. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_engine.py +0 -0
  39. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_errorlog.py +0 -0
  40. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_evdev_uaccess.py +0 -0
  41. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_evdev_x11_optional.py +0 -0
  42. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_fallback.py +0 -0
  43. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_fcitx_bridge.py +0 -0
  44. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_feedback_stream.py +0 -0
  45. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_focus.py +0 -0
  46. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_gpu_fallback.py +0 -0
  47. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_health.py +0 -0
  48. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_hints.py +0 -0
  49. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_history.py +0 -0
  50. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_engine_limits.py +0 -0
  51. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_engine_listener.py +0 -0
  52. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_pending.py +0 -0
  53. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_pids.py +0 -0
  54. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_ping.py +0 -0
  55. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_session.py +0 -0
  56. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_textlimit.py +0 -0
  57. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_ibus_typer.py +0 -0
  58. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_idle_audio.py +0 -0
  59. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_install_env.py +0 -0
  60. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_clean.py +0 -0
  61. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_import.py +0 -0
  62. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_language.py +0 -0
  63. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_metrics.py +0 -0
  64. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_pipeline.py +0 -0
  65. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_quiet.py +0 -0
  66. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_resume.py +0 -0
  67. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_review.py +0 -0
  68. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_summary.py +0 -0
  69. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_learn_targets.py +0 -0
  70. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_llm.py +0 -0
  71. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_llm_api.py +0 -0
  72. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_mic_gain.py +0 -0
  73. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_modifier_guard.py +0 -0
  74. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_numbers.py +0 -0
  75. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_paste_last.py +0 -0
  76. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_pipeline.py +0 -0
  77. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_platform.py +0 -0
  78. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_postcorrect.py +0 -0
  79. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_postprocess.py +0 -0
  80. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_prebuffer.py +0 -0
  81. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_presence.py +0 -0
  82. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_prompt.py +0 -0
  83. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_quiet_audio.py +0 -0
  84. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_recorder_integration.py +0 -0
  85. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_replies.py +0 -0
  86. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_report.py +0 -0
  87. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_retention.py +0 -0
  88. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_robustness.py +0 -0
  89. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_security_hardening.py +0 -0
  90. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_server.py +0 -0
  91. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_service.py +0 -0
  92. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_setup.py +0 -0
  93. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_sherpa.py +0 -0
  94. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_spool.py +0 -0
  95. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_streaming.py +0 -0
  96. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_suggest.py +0 -0
  97. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_telemetry.py +0 -0
  98. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_tokens.py +0 -0
  99. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_transcriber.py +0 -0
  100. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_tray.py +0 -0
  101. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_tts.py +0 -0
  102. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_tts_socket.py +0 -0
  103. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_typer_manager.py +0 -0
  104. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_vad.py +0 -0
  105. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_vocabulary.py +0 -0
  106. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_wordfreq.py +0 -0
  107. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/tests/test_worker_decode.py +0 -0
  108. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/__main__.py +0 -0
  109. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/announce.py +0 -0
  110. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/audio_devices.py +0 -0
  111. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/audio_source.py +0 -0
  112. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/backends.py +0 -0
  113. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/__init__.py +0 -0
  114. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/configcmd.py +0 -0
  115. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/corrections.py +0 -0
  116. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/doctor.py +0 -0
  117. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/history.py +0 -0
  118. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/learn.py +0 -0
  119. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/models.py +0 -0
  120. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/replies.py +0 -0
  121. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/servicecmd.py +0 -0
  122. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/uninstall.py +0 -0
  123. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/cli/vocab.py +0 -0
  124. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/clipboard_read.py +0 -0
  125. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/commands.py +0 -0
  126. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/consent.py +0 -0
  127. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/context_terms.py +0 -0
  128. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/__init__.py +0 -0
  129. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/bias.py +0 -0
  130. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/__init__.py +0 -0
  131. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/base.py +0 -0
  132. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/catalog.py +0 -0
  133. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
  134. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
  135. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/fetch.py +0 -0
  136. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/lanes.py +0 -0
  137. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/sherpa.py +0 -0
  138. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/decoders/whispercpp.py +0 -0
  139. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/engine.py +0 -0
  140. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/core/pipeline.py +0 -0
  141. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/corrections.py +0 -0
  142. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/data/60-voiceio-uaccess.rules +0 -0
  143. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/data/__init__.py +0 -0
  144. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/demo.py +0 -0
  145. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/display.py +0 -0
  146. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/errorlog.py +0 -0
  147. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/feedback.py +0 -0
  148. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/focus.py +0 -0
  149. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/health.py +0 -0
  150. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hints.py +0 -0
  151. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/history.py +0 -0
  152. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/__init__.py +0 -0
  153. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/base.py +0 -0
  154. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/chain.py +0 -0
  155. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/evdev.py +0 -0
  156. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/pynput_backend.py +0 -0
  157. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/hotkeys/socket_backend.py +0 -0
  158. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/__init__.py +0 -0
  159. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/engine.py +0 -0
  160. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/install.py +0 -0
  161. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/pending.py +0 -0
  162. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/session.py +0 -0
  163. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ibus/textlimit.py +0 -0
  164. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/idle_audio.py +0 -0
  165. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/install_env.py +0 -0
  166. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/__init__.py +0 -0
  167. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/augment.py +0 -0
  168. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/clean.py +0 -0
  169. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/evaluate.py +0 -0
  170. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/importer.py +0 -0
  171. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/lastrun.py +0 -0
  172. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/metrics.py +0 -0
  173. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/quiet.py +0 -0
  174. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/review.py +0 -0
  175. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/store.py +0 -0
  176. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/summary.py +0 -0
  177. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/teacher.py +0 -0
  178. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/learn/train.py +0 -0
  179. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/llm.py +0 -0
  180. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/llm_api.py +0 -0
  181. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/mic_gain.py +0 -0
  182. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/models/__init__.py +0 -0
  183. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/models/silero_vad.onnx +0 -0
  184. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/numbers.py +0 -0
  185. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/pidlock.py +0 -0
  186. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/platform.py +0 -0
  187. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/postcorrect.py +0 -0
  188. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/postprocess.py +0 -0
  189. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/power.py +0 -0
  190. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/presence.py +0 -0
  191. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/privacy.py +0 -0
  192. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/prompt.py +0 -0
  193. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/quiet_audio.py +0 -0
  194. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/recorder.py +0 -0
  195. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/replies.py +0 -0
  196. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/report.py +0 -0
  197. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/retention.py +0 -0
  198. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/server/__init__.py +0 -0
  199. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/server/__main__.py +0 -0
  200. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/server/app.py +0 -0
  201. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/server/config.py +0 -0
  202. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/server/runtime.py +0 -0
  203. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/service.py +0 -0
  204. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/__init__.py +0 -0
  205. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/configfile.py +0 -0
  206. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/extras.py +0 -0
  207. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/hotkey.py +0 -0
  208. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/noninteractive.py +0 -0
  209. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/steps.py +0 -0
  210. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/system.py +0 -0
  211. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/setup/ui.py +0 -0
  212. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/sounds/__init__.py +0 -0
  213. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/sounds/alert.wav +0 -0
  214. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/sounds/commit.wav +0 -0
  215. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/sounds/start.wav +0 -0
  216. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/sounds/stop.wav +0 -0
  217. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/spool.py +0 -0
  218. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/streaming.py +0 -0
  219. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/suggest.py +0 -0
  220. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/telemetry.py +0 -0
  221. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tokens.py +0 -0
  222. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tray/__init__.py +0 -0
  223. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tray/_icons.py +0 -0
  224. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tray/_indicator.py +0 -0
  225. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tray/_pystray.py +0 -0
  226. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/__init__.py +0 -0
  227. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/base.py +0 -0
  228. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/chain.py +0 -0
  229. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/edge_engine.py +0 -0
  230. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/espeak.py +0 -0
  231. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/piper_engine.py +0 -0
  232. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/player.py +0 -0
  233. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/tts/supertonic_engine.py +0 -0
  234. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/__init__.py +0 -0
  235. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/base.py +0 -0
  236. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/chain.py +0 -0
  237. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/clipboard.py +0 -0
  238. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/collecting.py +0 -0
  239. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/fcitx_bridge.py +0 -0
  240. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/ibus.py +0 -0
  241. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/manager.py +0 -0
  242. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/modifier_guard.py +0 -0
  243. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/paste.py +0 -0
  244. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/pynput_type.py +0 -0
  245. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/wtype.py +0 -0
  246. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/xdotool.py +0 -0
  247. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/typers/ydotool.py +0 -0
  248. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/ui.py +0 -0
  249. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/vad.py +0 -0
  250. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/vocab_stats.py +0 -0
  251. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/vocabulary.py +0 -0
  252. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/watchdog.py +0 -0
  253. {python_voiceio-1.18.15 → python_voiceio-1.18.16}/voiceio/wordfreq.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.15
3
+ Version: 1.18.16
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-voiceio"
7
- version = "1.18.15"
7
+ version = "1.18.16"
8
8
  description = "Voice dictation for Linux. Speak → text, locally, instantly."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.15
3
+ Version: 1.18.16
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -47,6 +47,7 @@ tests/test_ibus_session.py
47
47
  tests/test_ibus_textlimit.py
48
48
  tests/test_ibus_typer.py
49
49
  tests/test_idle_audio.py
50
+ tests/test_input_latency.py
50
51
  tests/test_install_env.py
51
52
  tests/test_learn_clean.py
52
53
  tests/test_learn_import.py
@@ -114,13 +114,20 @@ def test_release_tail_keeps_recording_briefly():
114
114
  assert _wait_stopped(vio)
115
115
 
116
116
 
117
- def test_press_during_tail_stops_once():
117
+ def test_press_during_tail_keeps_recording():
118
+ """Pressed again before the tail ran out: not done yet. The same
119
+ recording goes on, and the new press is push-to-talk again."""
118
120
  vio = _make_app("hold", tail_ms=100)
119
121
  vio.on_hotkey_press()
120
122
  vio.on_hotkey_release()
121
123
  _after_debounce(vio)
122
- vio.on_hotkey_press() # stops now
123
- time.sleep(0.2) # tail timer fires: stale
124
+ vio.on_hotkey_press() # withdraws the stop
125
+ time.sleep(0.2) # tail timer would have fired
126
+ assert vio.stops == [] and vio._state == _State.RECORDING
127
+ assert vio._recording == 1
128
+ vio.on_hotkey_release()
129
+ assert _wait_stopped(vio)
130
+ time.sleep(0.15)
124
131
  assert vio.stops == [1]
125
132
 
126
133
 
@@ -0,0 +1,212 @@
1
+ """audio.input_latency_ms: stopping waits out the audio still on its way."""
2
+ from __future__ import annotations
3
+
4
+ import time
5
+ from unittest.mock import MagicMock, patch
6
+
7
+ import pytest
8
+ from test_hotkey_modes import _after_debounce, _make_app, _wait_stopped
9
+
10
+ from voiceio.app import _State
11
+ from voiceio.config import AudioConfig, load
12
+
13
+
14
+ @pytest.fixture
15
+ def tray():
16
+ with patch("voiceio.app.tray") as t:
17
+ yield t
18
+
19
+
20
+ def _app(mode="toggle", latency_ms=0, tail_ms=0):
21
+ """Hotkey-level app (start/stop stubbed) with the stop feedback observable."""
22
+ vio = _make_app(mode, tail_ms=tail_ms)
23
+ vio.cfg.audio.input_latency_ms = latency_ms
24
+ vio._play_record_cue = MagicMock()
25
+ vio._quiet = MagicMock()
26
+ vio._quiet.stop.side_effect = lambda then=None: then and then()
27
+ vio.recorder = MagicMock()
28
+ vio._typers = MagicMock()
29
+ vio._spool = MagicMock()
30
+ return vio
31
+
32
+
33
+ def _cues(vio):
34
+ return [c.kwargs["start"] for c in vio._play_record_cue.call_args_list]
35
+
36
+
37
+ def _start_then_stop(vio):
38
+ vio.on_hotkey()
39
+ _after_debounce(vio)
40
+ vio.on_hotkey()
41
+
42
+
43
+ def test_toggle_without_latency_stops_at_once(tray):
44
+ vio = _app("toggle", latency_ms=0)
45
+ _start_then_stop(vio)
46
+ assert vio.stops == [1] and vio._pending_stop is None
47
+
48
+
49
+ def test_toggle_with_latency_records_the_tail(tray):
50
+ vio = _app("toggle", latency_ms=120)
51
+ vio.on_hotkey()
52
+ _after_debounce(vio)
53
+ pressed = time.monotonic()
54
+ vio.on_hotkey()
55
+ assert vio.stops == [] and vio._state == _State.RECORDING # still capturing
56
+ # Feedback at the press, not when the tail ends.
57
+ assert _cues(vio) == [False]
58
+ tray.set_recording.assert_called_with(False)
59
+ tray.set_processing.assert_called_with(True)
60
+ assert _wait_stopped(vio)
61
+ assert time.monotonic() - pressed >= 0.11
62
+ assert vio.stops == [1] and vio._pending_stop is None
63
+
64
+
65
+ def test_auto_tap_stop_gets_the_latency_tail(tray):
66
+ vio = _app("auto", latency_ms=90, tail_ms=250)
67
+ vio.on_hotkey_press()
68
+ vio.on_hotkey_release() # a tap: latched
69
+ _after_debounce(vio)
70
+ vio.on_hotkey_press() # the stop tap
71
+ assert vio._pending_stop.timer.interval == pytest.approx(0.09)
72
+ assert _wait_stopped(vio)
73
+
74
+
75
+ @pytest.mark.parametrize("latency_ms,announced", [(0, False), (40, True)])
76
+ def test_hold_tail_is_release_tail_plus_latency(tray, latency_ms, announced):
77
+ vio = _app("hold", latency_ms=latency_ms, tail_ms=60)
78
+ vio.on_hotkey_press()
79
+ vio.on_hotkey_release()
80
+ assert vio._pending_stop.timer.interval == pytest.approx((60 + latency_ms) / 1000)
81
+ # Without latency the stop chime comes with the stop, as before.
82
+ assert _cues(vio) == ([False] if announced else [])
83
+ assert _wait_stopped(vio)
84
+ assert vio.stops == [1]
85
+
86
+
87
+ def test_toggle_press_during_tail_keeps_recording(tray):
88
+ vio = _app("toggle", latency_ms=2000)
89
+ _start_then_stop(vio)
90
+ timer = vio._pending_stop.timer
91
+ _after_debounce(vio) # a press inside the 0.8 s debounce is the same press
92
+ vio.on_hotkey() # "I'm not done"
93
+ assert vio._pending_stop is None and timer.finished.is_set()
94
+ assert vio._state == _State.RECORDING and vio._recording == 1
95
+ assert _cues(vio) == [False, True] # stop chime, then the start chime again
96
+ tray.set_recording.assert_called_with(True)
97
+ tray.set_processing.assert_called_with(False)
98
+ vio.recorder.set_on_auto_stop.assert_called_with(vio._on_auto_stop)
99
+ # The next stop press stops the same recording, after its own tail.
100
+ vio.cfg.audio.input_latency_ms = 50
101
+ _after_debounce(vio)
102
+ vio.on_hotkey()
103
+ assert _wait_stopped(vio)
104
+ assert vio.stops == [1]
105
+
106
+
107
+ def test_hold_press_during_tail_is_push_to_talk_again(tray):
108
+ vio = _app("hold", latency_ms=100, tail_ms=0)
109
+ vio.on_hotkey_press()
110
+ vio.on_hotkey_release()
111
+ _after_debounce(vio)
112
+ vio.on_hotkey_press()
113
+ assert vio._held is not None and vio._held[1] == 1
114
+ time.sleep(0.15)
115
+ assert vio.stops == []
116
+ vio.on_hotkey_release()
117
+ assert _wait_stopped(vio)
118
+ assert vio.stops == [1]
119
+
120
+
121
+ def test_stale_tail_timer_never_stops_a_newer_recording(tray):
122
+ vio = _app("toggle", latency_ms=80)
123
+ _start_then_stop(vio)
124
+ pending = vio._pending_stop
125
+ vio._do_stop() # recording 1 ends some other way
126
+ vio._do_start() # recording 2 within the tail
127
+ time.sleep(0.15)
128
+ assert vio.stops == [1] and vio._state == _State.RECORDING
129
+ vio._stop_due(pending) # fired late: still nothing
130
+ assert vio.stops == [1]
131
+
132
+
133
+ def test_withdrawn_stop_timer_does_nothing(tray):
134
+ vio = _app("toggle", latency_ms=2000)
135
+ _start_then_stop(vio)
136
+ pending = vio._pending_stop
137
+ _after_debounce(vio)
138
+ vio.on_hotkey() # withdrawn
139
+ vio._stop_due(pending) # as if the cancel lost the race
140
+ assert vio.stops == [] and vio._state == _State.RECORDING
141
+
142
+
143
+ def test_cancel_during_tail_cancels_at_once(tray):
144
+ vio = _app("toggle", latency_ms=2000)
145
+ _start_then_stop(vio)
146
+ timer = vio._pending_stop.timer
147
+ vio.cancel()
148
+ assert vio._state == _State.IDLE and vio._pending_stop is None
149
+ assert timer.finished.is_set() # timer cancelled
150
+ vio.recorder.stop.assert_called_once() # audio dropped, no finalize
151
+ assert vio.stops == []
152
+ assert _cues(vio) == [False] # one stop chime, not two
153
+ vio._quiet.stop.assert_called_once()
154
+ tray.set_processing.assert_called_with(False)
155
+
156
+
157
+ def test_auto_stop_during_tail_leaves_it_to_the_tail(tray):
158
+ vio = _app("toggle", latency_ms=100)
159
+ _start_then_stop(vio)
160
+ _after_debounce(vio)
161
+ vio._request_stop() # silence auto-stop meanwhile
162
+ assert vio.stops == []
163
+ assert _wait_stopped(vio)
164
+ assert vio.stops == [1]
165
+
166
+
167
+ def test_auto_stop_without_a_tail_stops_at_once(tray):
168
+ vio = _app("toggle", latency_ms=2000)
169
+ vio.on_hotkey()
170
+ _after_debounce(vio)
171
+ vio._request_stop()
172
+ assert vio.stops == [1]
173
+
174
+
175
+ # ── config ──────────────────────────────────────────────────────────────
176
+
177
+ @pytest.mark.parametrize("given,used", [
178
+ (0, 0), (2500, 2500), (5000, 5000), (-5, 0), (9000, 5000),
179
+ ("2 s", 0), (True, 0), (300.7, 300),
180
+ ])
181
+ def test_input_latency_is_validated(given, used):
182
+ assert AudioConfig(input_latency_ms=given).input_latency_ms == used
183
+
184
+
185
+ def test_input_latency_from_the_config_file(tmp_path):
186
+ path = tmp_path / "config.toml"
187
+ path.write_text("[audio]\ninput_latency_ms = 2000\n")
188
+ assert load(path).audio.input_latency_ms == 2000
189
+ path.write_text("[audio]\ninput_latency_ms = 60000\n")
190
+ assert load(path).audio.input_latency_ms == 5000
191
+ assert load(tmp_path / "missing.toml").audio.input_latency_ms == 0
192
+
193
+
194
+ def test_real_stop_after_the_tail_does_not_chime_twice(tray):
195
+ from test_cancel import _make_app as _full_app
196
+ vio = _full_app(streaming=False)
197
+ vio.cfg.audio.input_latency_ms = 60
198
+ vio._play_record_cue = MagicMock()
199
+ vio._quiet.stop.side_effect = lambda then=None: then and then()
200
+ vio._state, vio._recording = _State.RECORDING, 3
201
+ with patch.object(vio, "_output_thread") as spawn:
202
+ vio.on_hotkey() # stop press: chime now
203
+ assert vio._state == _State.RECORDING
204
+ deadline = time.monotonic() + 2
205
+ while vio._state != _State.IDLE and time.monotonic() < deadline:
206
+ time.sleep(0.005)
207
+ assert vio._state == _State.IDLE
208
+ spawn.assert_called_once() # the tail's audio is decoded
209
+ vio.recorder.stop.assert_called_once()
210
+ assert _cues(vio) == [False]
211
+ vio._quiet.stop.assert_called_once()
212
+ assert vio._stop_announced == 0
@@ -148,3 +148,38 @@ def test_stream_with_no_audio_says_so(run, capsys):
148
148
  ])
149
149
  def test_should_stop(elapsed, heard_at, silent, stop):
150
150
  assert speech._test_should_stop(elapsed, heard_at, silent) is stop
151
+
152
+
153
+ def test_late_voice_suggests_input_latency(run, capsys):
154
+ run(_speech(2.5, 2.0))
155
+ out = capsys.readouterr().out
156
+ assert "voiceio config set audio.input_latency_ms 1900" in out
157
+
158
+
159
+ @pytest.mark.parametrize("start", [0.5, 1.5]) # normal reaction times
160
+ def test_prompt_voice_has_no_latency_hint(run, capsys, start):
161
+ run(_speech(start, 2.0))
162
+ assert "input_latency_ms" not in capsys.readouterr().out
163
+
164
+
165
+ def test_no_sound_has_no_latency_hint(run, capsys):
166
+ run(lambda t: 0.0)
167
+ assert "input_latency_ms" not in capsys.readouterr().out
168
+
169
+
170
+ @pytest.mark.parametrize("onset,ms", [
171
+ (None, None), (0.4, None), (1.5, None), (1.8, None),
172
+ (1.84, 1200), (2.06, 1500), (2.6, 2000), (9.0, 5000),
173
+ ])
174
+ def test_latency_hint_value(onset, ms):
175
+ hint = speech._latency_hint(onset)
176
+ if ms is None:
177
+ assert hint is None
178
+ else:
179
+ assert hint.endswith(f"audio.input_latency_ms {ms}")
180
+
181
+
182
+ def test_first_loud_sample_inside_a_block():
183
+ block = np.zeros(SR // 2, dtype=np.float32)
184
+ block[4000:] = 0.1
185
+ assert speech._first_loud_sample(block.reshape(-1, 1), 0.01, SR) == 3840 # its 20 ms frame
@@ -0,0 +1 @@
1
+ __version__ = "1.18.16"
@@ -36,6 +36,16 @@ class _State(enum.Enum):
36
36
  ERROR = "error"
37
37
 
38
38
 
39
+ class _PendingStop:
40
+ """A stop that waits out a tail: the words still on their way when the
41
+ user let go or pressed stop (release_tail_ms, audio.input_latency_ms)."""
42
+
43
+ def __init__(self, rid: int, tail: float, on_due) -> None:
44
+ self.rid = rid
45
+ self.timer = threading.Timer(tail, on_due, args=(self,))
46
+ self.timer.daemon = True
47
+
48
+
39
49
  class VoiceIO:
40
50
  @property
41
51
  def _state(self) -> _State:
@@ -185,6 +195,11 @@ class VoiceIO:
185
195
  self._hotkey_mode = "toggle"
186
196
  # (press time, recording id) while the key that started it is down
187
197
  self._held: tuple[float, int] | None = None
198
+ # A stop waiting out its tail; the recording is still RECORDING.
199
+ self._pending_stop: _PendingStop | None = None
200
+ # Recording id whose stop chime and tray already played (at the
201
+ # stop press, before the tail), so _do_stop doesn't repeat them.
202
+ self._stop_announced = 0
188
203
 
189
204
  # TTS (text-to-speech)
190
205
  self._tts_engine = None
@@ -317,13 +332,16 @@ class VoiceIO:
317
332
  push-to-talk when this press started the recording."""
318
333
  pressed_at = time.monotonic()
319
334
  with self._hotkey_lock:
335
+ resumed = False
320
336
  if pressed_at - self._last_hotkey >= _DEBOUNCE_SECS:
321
337
  self._last_hotkey = pressed_at
338
+ resumed = self._stop_pending_for() is not None
322
339
  self._toggle()
323
340
  # A debounced press can be the same keypress that the DE shortcut
324
- # (socket) just used to start recording: arm for that one too.
341
+ # (socket) just used to start recording: arm for that one too. A
342
+ # press that withdrew a pending stop is held like a fresh one.
325
343
  started = (self._state == _State.RECORDING
326
- and pressed_at - self._record_start < _DEBOUNCE_SECS)
344
+ and (resumed or pressed_at - self._record_start < _DEBOUNCE_SECS))
327
345
  self._held = (pressed_at, self._recording) \
328
346
  if started and self._hotkey_mode != "toggle" else None
329
347
 
@@ -341,16 +359,78 @@ class VoiceIO:
341
359
  if (self._hotkey_mode == "auto"
342
360
  and released_at - pressed_at < self.cfg.hotkey.hold_ms / 1000):
343
361
  return # a tap: recording stays on until the next press
344
- tail = threading.Timer(max(0, self.cfg.hotkey.release_tail_ms) / 1000,
345
- self._stop_held, args=(rid,))
346
- tail.daemon = True
347
- tail.start()
362
+ latency = self.cfg.audio.input_latency_ms
363
+ self._stop_after(max(0, self.cfg.hotkey.release_tail_ms) + latency,
364
+ announce=latency > 0)
365
+
366
+ def _stop_by_hand(self) -> None:
367
+ """A stop press (toggle, or a tap in auto mode). Under _hotkey_lock."""
368
+ latency = self.cfg.audio.input_latency_ms
369
+ if latency > 0:
370
+ self._stop_after(latency, announce=True)
371
+ else:
372
+ self._do_stop()
348
373
 
349
- def _stop_held(self, rid: int) -> None:
374
+ def _stop_after(self, tail_ms: int, announce: bool) -> None:
375
+ """Keep recording ``tail_ms`` more, then stop: audio still in transit
376
+ is what the user said last. With ``announce`` the stop chime and tray
377
+ come now, at the press, not when the tail ends. A press meanwhile
378
+ withdraws the stop (_resume); cancel drops it. Under _hotkey_lock."""
379
+ if self._stop_pending_for() is not None:
380
+ return
381
+ pending = _PendingStop(self._recording, tail_ms / 1000, self._stop_due)
382
+ self._pending_stop = pending
383
+ if announce:
384
+ self._announce_stop()
385
+ pending.timer.start()
386
+ log.debug("Stopping in %d ms (audio still on its way)", tail_ms)
387
+
388
+ def _stop_pending_for(self) -> _PendingStop | None:
389
+ """The pending stop of the recording in progress, if any."""
390
+ pending = self._pending_stop
391
+ if (pending is not None and self._state == _State.RECORDING
392
+ and pending.rid == self._recording):
393
+ return pending
394
+ return None
395
+
396
+ def _take_pending_stop(self) -> None:
397
+ pending, self._pending_stop = self._pending_stop, None
398
+ if pending is not None:
399
+ pending.timer.cancel()
400
+
401
+ def _stop_due(self, pending: _PendingStop) -> None:
402
+ """The tail is over. A stale timer (its stop withdrawn, cancelled, or
403
+ overtaken by another stop or a newer recording) does nothing."""
350
404
  with self._hotkey_lock:
351
- if self._state == _State.RECORDING and self._recording == rid:
405
+ if self._pending_stop is not pending:
406
+ return
407
+ self._pending_stop = None
408
+ if self._state == _State.RECORDING and self._recording == pending.rid:
352
409
  self._do_stop()
353
410
 
411
+ def _announce_stop(self) -> None:
412
+ """What a stop shows and sounds like: volume back, stop chime, tray."""
413
+ self._quiet.stop(then=lambda: self._play_record_cue(start=False))
414
+ tray.set_recording(False)
415
+ if self._streaming:
416
+ tray.set_processing(True)
417
+ self._stop_announced = self._recording
418
+
419
+ def _resume(self) -> None:
420
+ """A press during the stop tail: not done yet, keep recording the same
421
+ dictation. Undoes what _announce_stop showed."""
422
+ self._take_pending_stop()
423
+ # An auto-stop that fired during the tail was single-shot: re-arm.
424
+ self.recorder.set_on_auto_stop(self._on_auto_stop)
425
+ if self._stop_announced == self._recording:
426
+ self._stop_announced = 0
427
+ if self._streaming:
428
+ tray.set_processing(False)
429
+ tray.set_recording(True)
430
+ self._play_record_cue(start=True)
431
+ self._quiet.start(duck_after=self._start_cue_secs())
432
+ log.info("Stop withdrawn: still recording")
433
+
354
434
  def cancel(self) -> None:
355
435
  """Abandon the current dictation: type nothing, keep nothing (no
356
436
  history, no retained audio), no commit chime. Only the stop chime
@@ -369,7 +449,13 @@ class VoiceIO:
369
449
 
370
450
  def _cancel_recording(self) -> None:
371
451
  rid = self._recording
372
- self._quiet.stop(then=lambda: self._play_record_cue(start=False))
452
+ self._take_pending_stop()
453
+ if self._stop_announced == rid: # cancelled during the stop tail
454
+ self._stop_announced = 0
455
+ if self._streaming:
456
+ tray.set_processing(False)
457
+ else:
458
+ self._quiet.stop(then=lambda: self._play_record_cue(start=False))
373
459
  self.recorder.set_on_auto_stop(None)
374
460
  self.recorder.set_on_dead_stream(None)
375
461
  self.recorder.stop() # the audio is dropped here
@@ -501,8 +587,11 @@ class VoiceIO:
501
587
  )
502
588
 
503
589
  def _request_stop(self) -> None:
504
- """Stop recording if active. Unlike on_hotkey, never starts."""
590
+ """Stop recording if active. Unlike on_hotkey, never starts. A stop
591
+ already waiting out its tail is left to finish it."""
505
592
  with self._hotkey_lock:
593
+ if self._stop_pending_for() is not None:
594
+ return
506
595
  now = time.monotonic()
507
596
  if now - self._last_hotkey < _DEBOUNCE_SECS:
508
597
  return
@@ -513,9 +602,12 @@ class VoiceIO:
513
602
  # ── State machine ───────────────────────────────────────────────────
514
603
 
515
604
  def _toggle(self) -> None:
516
- """Central state transition: IDLE/FINALIZING/ERROR → RECORDING, RECORDING → stop."""
517
- if self._state == _State.RECORDING:
518
- self._do_stop()
605
+ """Central state transition: IDLE/FINALIZING/ERROR → RECORDING, RECORDING → stop
606
+ (or, during the stop tail, back to recording)."""
607
+ if self._stop_pending_for() is not None:
608
+ self._resume()
609
+ elif self._state == _State.RECORDING:
610
+ self._stop_by_hand()
519
611
  elif self._state == _State.ERROR:
520
612
  # Attempt recovery: try to restart worker, then start recording
521
613
  log.info("Attempting recovery from error state")
@@ -633,10 +725,14 @@ class VoiceIO:
633
725
  self._generation += 1
634
726
  gen = self._generation
635
727
  rid = self._recording
728
+ self._take_pending_stop() # e.g. an auto-stop during the tail
636
729
 
637
730
  # Stop audio capture immediately; the stop chime follows the volume
638
- # restore (see _do_start), off this thread.
639
- self._quiet.stop(then=lambda: self._play_record_cue(start=False))
731
+ # restore (see _do_start), off this thread. A stop with a tail played
732
+ # it already, at the press.
733
+ if self._stop_announced != rid:
734
+ self._quiet.stop(then=lambda: self._play_record_cue(start=False))
735
+ self._stop_announced = 0
640
736
  self.recorder.set_on_auto_stop(None)
641
737
  self.recorder.set_on_dead_stream(None)
642
738
  audio = self.recorder.stop()
@@ -142,6 +142,22 @@ class AudioConfig:
142
142
  # (voiceio/mic_gain.py): down a fifth after one that clipped, up a fifth
143
143
  # after three that were very quiet, never back to a level that clipped.
144
144
  auto_gain: bool = True
145
+ # How late your audio reaches voiceio (Bluetooth headsets ~200-500 ms,
146
+ # remote desktops and KVMs up to seconds). Stopping keeps recording this
147
+ # much longer, so words still on their way aren't cut off. 0..5000.
148
+ input_latency_ms: int = 0
149
+
150
+ def __post_init__(self):
151
+ ms = self.input_latency_ms
152
+ valid = isinstance(ms, (int, float)) and not isinstance(ms, bool)
153
+ clamped = min(max(int(ms), 0), MAX_INPUT_LATENCY_MS) if valid else 0
154
+ if not valid or clamped != ms:
155
+ log.warning("audio.input_latency_ms %r: must be 0..%d ms, using %d",
156
+ ms, MAX_INPUT_LATENCY_MS, clamped)
157
+ self.input_latency_ms = clamped
158
+
159
+
160
+ MAX_INPUT_LATENCY_MS = 5000
145
161
 
146
162
 
147
163
  @dataclass
@@ -123,6 +123,11 @@ def _download_model(model_name: str) -> bool:
123
123
  _STOP_SILENCE_SECS = 1.5 # after speech: this much quiet ends the test
124
124
  _WAIT_FOR_SPEECH_SECS = 12 # before speech: give up after this long
125
125
  _MAX_SPEECH_SECS = 10 # after speech starts: record at most this long
126
+ # Voice first arriving later than this after "Speak now!" may be a delayed
127
+ # audio path rather than a slow start: suggest audio.input_latency_ms.
128
+ _LATE_VOICE_SECS = 1.8
129
+ # Typical time to start talking after the prompt; not part of the latency.
130
+ _REACTION_SECS = 0.6
126
131
 
127
132
 
128
133
  def _test_should_stop(elapsed: float, heard_at: float | None, silent_secs: float) -> bool:
@@ -168,13 +173,15 @@ def _streaming_test(model=None, language: str | None = None) -> str:
168
173
  audio_chunks: list[np.ndarray] = []
169
174
  silent_time = 0.0 # seconds of audio below the threshold, in a row
170
175
  heard_sound = False # a chunk above the threshold arrived
176
+ samples_seen = 0
177
+ onset: float | None = None # where in the audio the first sound starts, seconds
171
178
  heard_at: float | None = None
172
179
  last_text = ""
173
180
  last_text_len = 0 # characters printed on screen
174
181
  recording = True
175
182
 
176
183
  def callback(indata, frames, time_info, status):
177
- nonlocal silent_time, heard_sound
184
+ nonlocal silent_time, heard_sound, samples_seen, onset
178
185
  if not recording:
179
186
  return
180
187
  audio_chunks.append(indata.copy())
@@ -184,6 +191,10 @@ def _streaming_test(model=None, language: str | None = None) -> str:
184
191
  else:
185
192
  silent_time = 0.0
186
193
  heard_sound = True
194
+ if onset is None:
195
+ onset = (samples_seen + _first_loud_sample(
196
+ indata, silence_threshold, sample_rate)) / sample_rate
197
+ samples_seen += frames
187
198
 
188
199
  stream = sd.InputStream(
189
200
  samplerate=sample_rate, channels=1, dtype="float32",
@@ -259,10 +270,40 @@ def _streaming_test(model=None, language: str | None = None) -> str:
259
270
  print(f" {GREEN}✓{RESET} Transcribed successfully!")
260
271
  else:
261
272
  print(f" {YELLOW}⚠{RESET} {_no_speech_message(elapsed, bool(audio_chunks), heard_sound)}")
273
+ hint = _latency_hint(onset)
274
+ if hint:
275
+ print(f" {DIM}{hint}{RESET}")
262
276
 
263
277
  return last_text
264
278
 
265
279
 
280
+ def _first_loud_sample(block, threshold: float, sample_rate: int) -> int:
281
+ """Offset of the first 20 ms frame of `block` at or above `threshold` RMS
282
+ (the block as a whole is above it)."""
283
+ import numpy as np
284
+ flat = block.reshape(-1)
285
+ step = max(1, sample_rate // 50)
286
+ for start in range(0, len(flat), step):
287
+ frame = flat[start:start + step]
288
+ if np.sqrt(np.mean(frame ** 2)) >= threshold:
289
+ return start
290
+ return 0
291
+
292
+
293
+ def _latency_hint(onset: float | None) -> str | None:
294
+ """One line suggesting audio.input_latency_ms when the voice arrived late.
295
+ `onset` is where the first sound is in the test's audio (None: none).
296
+ A typical reaction time is taken off; the rest may still include a slow
297
+ start, so it is worded as a suggestion, never set automatically."""
298
+ from voiceio.config import MAX_INPUT_LATENCY_MS
299
+ if onset is None or onset <= _LATE_VOICE_SECS:
300
+ return None
301
+ ms = min(max(int(round((onset - _REACTION_SECS) * 10)) * 100, 100), MAX_INPUT_LATENCY_MS)
302
+ return (f"Your voice arrived {onset:.1f}s after the test began. If your audio goes "
303
+ "through a remote desktop, KVM or Bluetooth link, keep your last words "
304
+ f"with: voiceio config set audio.input_latency_ms {ms}")
305
+
306
+
266
307
  def _no_speech_message(elapsed: float, got_audio: bool, heard_sound: bool) -> str:
267
308
  if not got_audio:
268
309
  return (f"The microphone delivered no audio in {elapsed:.0f}s. "
@@ -1 +0,0 @@
1
- __version__ = "1.18.15"