python-voiceio 1.18.14__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.14/python_voiceio.egg-info → python_voiceio-1.18.16}/PKG-INFO +1 -1
  2. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/pyproject.toml +1 -1
  3. {python_voiceio-1.18.14 → python_voiceio-1.18.16/python_voiceio.egg-info}/PKG-INFO +1 -1
  4. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/python_voiceio.egg-info/SOURCES.txt +3 -0
  5. python_voiceio-1.18.16/tests/test_audio_devices.py +290 -0
  6. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_hotkey_modes.py +10 -3
  7. python_voiceio-1.18.16/tests/test_input_latency.py +212 -0
  8. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_mic_test.py +35 -0
  9. python_voiceio-1.18.16/voiceio/__init__.py +1 -0
  10. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/app.py +111 -15
  11. python_voiceio-1.18.16/voiceio/audio_devices.py +121 -0
  12. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/config.py +16 -0
  13. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/feedback.py +10 -5
  14. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/recorder.py +34 -13
  15. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/speech.py +42 -1
  16. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/player.py +18 -15
  17. python_voiceio-1.18.14/voiceio/__init__.py +0 -1
  18. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/LICENSE +0 -0
  19. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/README.md +0 -0
  20. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/python_voiceio.egg-info/dependency_links.txt +0 -0
  21. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/python_voiceio.egg-info/entry_points.txt +0 -0
  22. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/python_voiceio.egg-info/requires.txt +0 -0
  23. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/python_voiceio.egg-info/top_level.txt +0 -0
  24. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/setup.cfg +0 -0
  25. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_announce.py +0 -0
  26. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_app_wiring.py +0 -0
  27. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_audio_quality.py +0 -0
  28. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_audio_source.py +0 -0
  29. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_backend_probes.py +0 -0
  30. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_cancel.py +0 -0
  31. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_cli.py +0 -0
  32. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_clipboard_read.py +0 -0
  33. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_clipboard_typer.py +0 -0
  34. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_commands.py +0 -0
  35. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_concurrency_lockdown.py +0 -0
  36. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_config.py +0 -0
  37. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_context_terms.py +0 -0
  38. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_corrections.py +0 -0
  39. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_cuda_setup_hint.py +0 -0
  40. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_dead_mic.py +0 -0
  41. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_decoders.py +0 -0
  42. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_engine.py +0 -0
  43. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_errorlog.py +0 -0
  44. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_evdev_uaccess.py +0 -0
  45. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_evdev_x11_optional.py +0 -0
  46. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_fallback.py +0 -0
  47. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_fcitx_bridge.py +0 -0
  48. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_feedback_stream.py +0 -0
  49. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_focus.py +0 -0
  50. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_gpu_fallback.py +0 -0
  51. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_health.py +0 -0
  52. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_hints.py +0 -0
  53. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_history.py +0 -0
  54. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_engine_limits.py +0 -0
  55. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_engine_listener.py +0 -0
  56. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_pending.py +0 -0
  57. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_pids.py +0 -0
  58. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_ping.py +0 -0
  59. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_session.py +0 -0
  60. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_textlimit.py +0 -0
  61. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_ibus_typer.py +0 -0
  62. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_idle_audio.py +0 -0
  63. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_install_env.py +0 -0
  64. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_clean.py +0 -0
  65. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_import.py +0 -0
  66. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_language.py +0 -0
  67. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_metrics.py +0 -0
  68. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_pipeline.py +0 -0
  69. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_quiet.py +0 -0
  70. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_resume.py +0 -0
  71. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_review.py +0 -0
  72. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_summary.py +0 -0
  73. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_learn_targets.py +0 -0
  74. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_llm.py +0 -0
  75. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_llm_api.py +0 -0
  76. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_mic_gain.py +0 -0
  77. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_modifier_guard.py +0 -0
  78. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_numbers.py +0 -0
  79. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_paste_last.py +0 -0
  80. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_pipeline.py +0 -0
  81. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_platform.py +0 -0
  82. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_postcorrect.py +0 -0
  83. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_postprocess.py +0 -0
  84. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_prebuffer.py +0 -0
  85. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_presence.py +0 -0
  86. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_prompt.py +0 -0
  87. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_quiet_audio.py +0 -0
  88. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_recorder_integration.py +0 -0
  89. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_replies.py +0 -0
  90. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_report.py +0 -0
  91. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_retention.py +0 -0
  92. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_robustness.py +0 -0
  93. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_security_hardening.py +0 -0
  94. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_server.py +0 -0
  95. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_service.py +0 -0
  96. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_setup.py +0 -0
  97. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_sherpa.py +0 -0
  98. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_spool.py +0 -0
  99. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_streaming.py +0 -0
  100. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_suggest.py +0 -0
  101. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_telemetry.py +0 -0
  102. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_tokens.py +0 -0
  103. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_transcriber.py +0 -0
  104. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_tray.py +0 -0
  105. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_tts.py +0 -0
  106. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_tts_socket.py +0 -0
  107. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_typer_manager.py +0 -0
  108. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_vad.py +0 -0
  109. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_vocabulary.py +0 -0
  110. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_wordfreq.py +0 -0
  111. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/tests/test_worker_decode.py +0 -0
  112. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/__main__.py +0 -0
  113. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/announce.py +0 -0
  114. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/audio_source.py +0 -0
  115. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/backends.py +0 -0
  116. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/__init__.py +0 -0
  117. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/configcmd.py +0 -0
  118. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/corrections.py +0 -0
  119. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/doctor.py +0 -0
  120. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/history.py +0 -0
  121. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/learn.py +0 -0
  122. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/models.py +0 -0
  123. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/replies.py +0 -0
  124. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/servicecmd.py +0 -0
  125. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/uninstall.py +0 -0
  126. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/cli/vocab.py +0 -0
  127. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/clipboard_read.py +0 -0
  128. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/commands.py +0 -0
  129. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/consent.py +0 -0
  130. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/context_terms.py +0 -0
  131. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/__init__.py +0 -0
  132. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/bias.py +0 -0
  133. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/__init__.py +0 -0
  134. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/base.py +0 -0
  135. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/catalog.py +0 -0
  136. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
  137. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
  138. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/fetch.py +0 -0
  139. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/lanes.py +0 -0
  140. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/sherpa.py +0 -0
  141. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/decoders/whispercpp.py +0 -0
  142. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/engine.py +0 -0
  143. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/core/pipeline.py +0 -0
  144. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/corrections.py +0 -0
  145. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/data/60-voiceio-uaccess.rules +0 -0
  146. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/data/__init__.py +0 -0
  147. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/demo.py +0 -0
  148. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/display.py +0 -0
  149. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/errorlog.py +0 -0
  150. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/focus.py +0 -0
  151. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/health.py +0 -0
  152. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hints.py +0 -0
  153. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/history.py +0 -0
  154. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/__init__.py +0 -0
  155. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/base.py +0 -0
  156. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/chain.py +0 -0
  157. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/evdev.py +0 -0
  158. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/pynput_backend.py +0 -0
  159. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/hotkeys/socket_backend.py +0 -0
  160. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/__init__.py +0 -0
  161. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/engine.py +0 -0
  162. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/install.py +0 -0
  163. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/pending.py +0 -0
  164. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/session.py +0 -0
  165. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ibus/textlimit.py +0 -0
  166. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/idle_audio.py +0 -0
  167. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/install_env.py +0 -0
  168. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/__init__.py +0 -0
  169. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/augment.py +0 -0
  170. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/clean.py +0 -0
  171. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/evaluate.py +0 -0
  172. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/importer.py +0 -0
  173. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/lastrun.py +0 -0
  174. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/metrics.py +0 -0
  175. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/quiet.py +0 -0
  176. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/review.py +0 -0
  177. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/store.py +0 -0
  178. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/summary.py +0 -0
  179. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/teacher.py +0 -0
  180. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/learn/train.py +0 -0
  181. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/llm.py +0 -0
  182. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/llm_api.py +0 -0
  183. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/mic_gain.py +0 -0
  184. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/models/__init__.py +0 -0
  185. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/models/silero_vad.onnx +0 -0
  186. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/numbers.py +0 -0
  187. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/pidlock.py +0 -0
  188. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/platform.py +0 -0
  189. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/postcorrect.py +0 -0
  190. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/postprocess.py +0 -0
  191. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/power.py +0 -0
  192. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/presence.py +0 -0
  193. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/privacy.py +0 -0
  194. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/prompt.py +0 -0
  195. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/quiet_audio.py +0 -0
  196. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/replies.py +0 -0
  197. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/report.py +0 -0
  198. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/retention.py +0 -0
  199. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/server/__init__.py +0 -0
  200. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/server/__main__.py +0 -0
  201. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/server/app.py +0 -0
  202. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/server/config.py +0 -0
  203. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/server/runtime.py +0 -0
  204. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/service.py +0 -0
  205. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/__init__.py +0 -0
  206. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/configfile.py +0 -0
  207. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/extras.py +0 -0
  208. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/hotkey.py +0 -0
  209. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/noninteractive.py +0 -0
  210. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/steps.py +0 -0
  211. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/system.py +0 -0
  212. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/setup/ui.py +0 -0
  213. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/sounds/__init__.py +0 -0
  214. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/sounds/alert.wav +0 -0
  215. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/sounds/commit.wav +0 -0
  216. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/sounds/start.wav +0 -0
  217. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/sounds/stop.wav +0 -0
  218. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/spool.py +0 -0
  219. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/streaming.py +0 -0
  220. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/suggest.py +0 -0
  221. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/telemetry.py +0 -0
  222. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tokens.py +0 -0
  223. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tray/__init__.py +0 -0
  224. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tray/_icons.py +0 -0
  225. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tray/_indicator.py +0 -0
  226. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tray/_pystray.py +0 -0
  227. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/__init__.py +0 -0
  228. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/base.py +0 -0
  229. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/chain.py +0 -0
  230. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/edge_engine.py +0 -0
  231. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/espeak.py +0 -0
  232. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/piper_engine.py +0 -0
  233. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/tts/supertonic_engine.py +0 -0
  234. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/__init__.py +0 -0
  235. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/base.py +0 -0
  236. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/chain.py +0 -0
  237. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/clipboard.py +0 -0
  238. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/collecting.py +0 -0
  239. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/fcitx_bridge.py +0 -0
  240. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/ibus.py +0 -0
  241. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/manager.py +0 -0
  242. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/modifier_guard.py +0 -0
  243. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/paste.py +0 -0
  244. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/pynput_type.py +0 -0
  245. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/wtype.py +0 -0
  246. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/xdotool.py +0 -0
  247. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/typers/ydotool.py +0 -0
  248. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/ui.py +0 -0
  249. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/vad.py +0 -0
  250. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/vocab_stats.py +0 -0
  251. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/vocabulary.py +0 -0
  252. {python_voiceio-1.18.14 → python_voiceio-1.18.16}/voiceio/watchdog.py +0 -0
  253. {python_voiceio-1.18.14 → 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.14
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.14"
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.14
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
@@ -9,6 +9,7 @@ python_voiceio.egg-info/requires.txt
9
9
  python_voiceio.egg-info/top_level.txt
10
10
  tests/test_announce.py
11
11
  tests/test_app_wiring.py
12
+ tests/test_audio_devices.py
12
13
  tests/test_audio_quality.py
13
14
  tests/test_audio_source.py
14
15
  tests/test_backend_probes.py
@@ -46,6 +47,7 @@ tests/test_ibus_session.py
46
47
  tests/test_ibus_textlimit.py
47
48
  tests/test_ibus_typer.py
48
49
  tests/test_idle_audio.py
50
+ tests/test_input_latency.py
49
51
  tests/test_install_env.py
50
52
  tests/test_learn_clean.py
51
53
  tests/test_learn_import.py
@@ -100,6 +102,7 @@ voiceio/__init__.py
100
102
  voiceio/__main__.py
101
103
  voiceio/announce.py
102
104
  voiceio/app.py
105
+ voiceio/audio_devices.py
103
106
  voiceio/audio_source.py
104
107
  voiceio/backends.py
105
108
  voiceio/clipboard_read.py
@@ -0,0 +1,290 @@
1
+ """A reopened mic re-resolves its device against a fresh PortAudio device list.
2
+
3
+ The real failure: the user switched to a USB mic (new default source) while
4
+ the daemon had been up for days; every dead-stream reopen landed on the old
5
+ device PortAudio had cached at import, and only a restart fixed it.
6
+ """
7
+ from __future__ import annotations
8
+
9
+ import logging
10
+ import sys
11
+ import threading
12
+
13
+ import pytest
14
+
15
+ from voiceio import audio_devices, feedback
16
+ from voiceio.config import AudioConfig
17
+ from voiceio.recorder import AudioRecorder
18
+
19
+ # Taken at import, before conftest's per-test stub replaces it.
20
+ _REAL_REINITIALIZE = audio_devices._reinitialize
21
+
22
+
23
+ class FakeStream:
24
+ def __init__(self, pa: FakePortAudio, device: int, samplerate: int = 16000):
25
+ self._pa = pa
26
+ self.device = device
27
+ self.samplerate = samplerate
28
+ self.latency = 0.08
29
+ self.closed = False
30
+ self.active = False
31
+ self.stopped = True
32
+ self.written = 0
33
+
34
+ def start(self):
35
+ self.active, self.stopped = True, False
36
+
37
+ def stop(self):
38
+ self.active, self.stopped = False, True
39
+
40
+ def close(self):
41
+ self.closed = True
42
+
43
+ def write(self, data):
44
+ assert not self.closed and self._pa._initialized, "write on a freed stream"
45
+ self.written += len(data)
46
+
47
+
48
+ class FakePortAudio:
49
+ """sounddevice over a device list that only refreshes at Pa_Initialize,
50
+ like the real one. Pa_Terminate with a stream still open is a failure."""
51
+
52
+ PortAudioError = RuntimeError
53
+
54
+ def __init__(self, devices: list[str], default: int):
55
+ self.live_devices, self.live_default = list(devices), default
56
+ self._initialized = 1
57
+ self.inits = 0
58
+ self.streams: list[FakeStream] = []
59
+ self._snapshot()
60
+
61
+ def _snapshot(self):
62
+ self.devices, self.default = list(self.live_devices), self.live_default
63
+
64
+ def plug(self, devices: list[str], default: int):
65
+ self.live_devices, self.live_default = list(devices), default
66
+
67
+ def _terminate(self):
68
+ still_open = [s for s in self.streams if not s.closed]
69
+ assert not still_open, f"Pa_Terminate with open streams: {still_open}"
70
+ self._initialized -= 1
71
+
72
+ def _initialize(self):
73
+ self._initialized += 1
74
+ self.inits += 1
75
+ self._snapshot()
76
+
77
+ def _resolve(self, device):
78
+ if device is None:
79
+ return self.default
80
+ if isinstance(device, int):
81
+ return device
82
+ for i, name in enumerate(self.devices):
83
+ if device.lower() in name.lower():
84
+ return i
85
+ raise ValueError(f"No input device matching {device!r}")
86
+
87
+ def query_devices(self, device=None, kind=None):
88
+ index = self.default if kind == "input" else device
89
+ return {"name": self.devices[index], "index": index}
90
+
91
+ def InputStream(self, device=None, samplerate=16000, **_):
92
+ stream = FakeStream(self, self._resolve(device), samplerate)
93
+ self.streams.append(stream)
94
+ return stream
95
+
96
+ def OutputStream(self, device=None, samplerate=44100, **_):
97
+ stream = FakeStream(self, 0, samplerate)
98
+ self.streams.append(stream)
99
+ return stream
100
+
101
+
102
+ @pytest.fixture
103
+ def pa(monkeypatch):
104
+ fake = FakePortAudio(["HDA Intel PCH: ALC257 Analog", "HD Pro Webcam C920"], default=0)
105
+ monkeypatch.setitem(sys.modules, "sounddevice", fake)
106
+ monkeypatch.setattr("voiceio.recorder.sd", fake)
107
+ monkeypatch.setattr(feedback, "sd", fake)
108
+ monkeypatch.setattr(feedback, "_stream", None)
109
+ # The real re-init, against the fake module (conftest stubs it out).
110
+ monkeypatch.setattr(audio_devices, "_reinitialize", _REAL_REINITIALIZE)
111
+ return fake
112
+
113
+
114
+ def _recorder(device: str = "default") -> AudioRecorder:
115
+ return AudioRecorder(AudioConfig(sample_rate=16000, device=device, prebuffer_secs=0.5,
116
+ auto_stop_silence_secs=0, auto_stop_no_speech_secs=0))
117
+
118
+
119
+ HYPERX = ["HDA Intel PCH: ALC257 Analog", "HD Pro Webcam C920", "HyperX SoloCast"]
120
+
121
+
122
+ def test_dead_stream_reopen_lands_on_the_new_default(pa):
123
+ rec = _recorder()
124
+ rec.open_stream()
125
+ assert rec._stream.device == 0
126
+ pa.plug(HYPERX, default=2) # USB mic plugged in, made default
127
+
128
+ rec.revive_stream() # the dead-mic (exact zeros) path
129
+
130
+ assert pa.inits == 1
131
+ assert rec._stream.device == 2
132
+ assert not rec._stream.closed and rec._stream.active
133
+
134
+
135
+ def test_reopen_without_reinit_would_keep_the_stale_default(pa, monkeypatch):
136
+ """The bug itself: PortAudio's cached list knows nothing of the new mic."""
137
+ monkeypatch.setattr(audio_devices, "_reinitialize", lambda: None)
138
+ rec = _recorder()
139
+ rec.open_stream()
140
+ pa.plug(HYPERX, default=2)
141
+ rec.reopen_stream()
142
+ assert rec._stream.device == 0
143
+
144
+
145
+ def test_named_device_is_re_resolved_by_name(pa):
146
+ pa.plug(["HyperX SoloCast", "HDA Intel PCH: ALC257 Analog"], default=1)
147
+ pa._snapshot()
148
+ rec = _recorder("HyperX")
149
+ rec.open_stream()
150
+ assert rec._stream.device == 0
151
+ pa.plug(HYPERX, default=0) # replugged: its index moved
152
+
153
+ rec.reopen_stream()
154
+
155
+ assert rec._stream.device == 2
156
+ assert pa.query_devices(rec._stream.device)["name"] == "HyperX SoloCast"
157
+
158
+
159
+ def test_cue_stream_closed_before_reinit_and_usable_after(pa):
160
+ assert feedback.open_cue_stream()
161
+ old_cue = feedback._stream
162
+ rec = _recorder()
163
+ rec.open_stream()
164
+ old_mic = rec._stream
165
+
166
+ rec.reopen_stream() # FakePortAudio asserts nothing is open
167
+
168
+ assert pa.inits == 1
169
+ assert old_cue.closed and old_mic.closed
170
+ assert feedback._stream is not None and feedback._stream is not old_cue
171
+ feedback._play_sync("start")
172
+ assert feedback._stream.written > 0
173
+
174
+
175
+ def test_a_closed_cue_stream_stays_closed(pa):
176
+ rec = _recorder()
177
+ rec.open_stream()
178
+ rec.reopen_stream()
179
+ assert pa.inits == 1
180
+ assert feedback._stream is None
181
+
182
+
183
+ def test_reinit_backoff(pa):
184
+ rec = _recorder()
185
+ rec.open_stream()
186
+ pa.plug(HYPERX, default=2)
187
+ rec.revive_stream()
188
+ assert pa.inits == 1
189
+ pa.plug(HYPERX, default=1)
190
+ rec.revive_stream() # still dead right after: no second re-init
191
+ assert pa.inits == 1
192
+ assert rec._stream.device == 2 # reopened, on the list it already has
193
+ audio_devices._last_refresh -= audio_devices.REFRESH_MIN_INTERVAL_SECS + 1
194
+ rec.revive_stream()
195
+ assert pa.inits == 2
196
+ assert rec._stream.device == 1
197
+
198
+
199
+ def test_refresh_is_skipped_while_tts_plays(pa):
200
+ playing, done = threading.Event(), threading.Event()
201
+
202
+ def tts():
203
+ with audio_devices.stream_in_use():
204
+ stream = pa.OutputStream()
205
+ playing.set()
206
+ done.wait(2)
207
+ stream.close()
208
+
209
+ t = threading.Thread(target=tts)
210
+ t.start()
211
+ assert playing.wait(2)
212
+ closed = []
213
+ assert audio_devices.refresh(close=lambda: closed.append(1)) is False
214
+ assert closed == [1] # the caller's stream still closes
215
+ assert pa.inits == 0
216
+ done.set()
217
+ t.join(2)
218
+ assert audio_devices.refresh() is True
219
+ assert pa.inits == 1
220
+
221
+
222
+ def test_an_open_waits_for_a_refresh_in_progress(pa, monkeypatch):
223
+ monkeypatch.setattr(audio_devices, "_refreshing", True)
224
+ entered = threading.Event()
225
+
226
+ def opener():
227
+ with audio_devices.stream_in_use():
228
+ entered.set()
229
+
230
+ t = threading.Thread(target=opener, daemon=True)
231
+ t.start()
232
+ assert not entered.wait(0.2)
233
+ with audio_devices._cond:
234
+ audio_devices._refreshing = False
235
+ audio_devices._cond.notify_all()
236
+ assert entered.wait(2)
237
+ t.join(2)
238
+
239
+
240
+ def test_refresh_backoff_with_a_clock(pa):
241
+ now = [1000.0]
242
+ assert audio_devices.refresh(clock=lambda: now[0]) is True
243
+ now[0] += audio_devices.REFRESH_MIN_INTERVAL_SECS - 1
244
+ assert audio_devices.refresh(clock=lambda: now[0]) is False
245
+ now[0] += 2
246
+ assert audio_devices.refresh(clock=lambda: now[0]) is True
247
+ assert pa.inits == 2
248
+
249
+
250
+ def test_a_failed_reinit_does_not_raise_and_next_one_recovers(pa, monkeypatch):
251
+ working = pa._initialize
252
+ calls = []
253
+
254
+ def flaky():
255
+ calls.append(1)
256
+ if len(calls) == 1:
257
+ raise RuntimeError("Error initializing PortAudio")
258
+ working()
259
+
260
+ monkeypatch.setattr(pa, "_initialize", flaky)
261
+ assert audio_devices.refresh() is False
262
+ assert pa._initialized == 0 # terminated, the init failed
263
+ audio_devices._last_refresh = float("-inf")
264
+ assert audio_devices.refresh() is True
265
+ assert pa._initialized == 1
266
+
267
+
268
+ def test_every_open_logs_the_device(pa, caplog):
269
+ rec = _recorder()
270
+ with caplog.at_level(logging.INFO, logger="voiceio.recorder"):
271
+ rec.open_stream()
272
+ pa.plug(HYPERX, default=2)
273
+ rec.reopen_stream()
274
+ opens = [r.getMessage() for r in caplog.records if r.getMessage().startswith("Mic open:")]
275
+ assert opens == [
276
+ "Mic open: 'HDA Intel PCH: ALC257 Analog' (index 0, audio.device = default)",
277
+ "Mic open: 'HyperX SoloCast' (index 2, audio.device = default)",
278
+ ]
279
+
280
+
281
+ def test_a_close_that_raises_propagates_and_skips_the_reinit(pa):
282
+ def broken():
283
+ raise RuntimeError("stop failed")
284
+
285
+ with pytest.raises(RuntimeError):
286
+ audio_devices.refresh(close=broken)
287
+ assert pa.inits == 0
288
+ assert audio_devices.refresh() is not None # not left "refreshing"
289
+ with audio_devices.stream_in_use():
290
+ pass
@@ -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"