python-voiceio 1.18.18__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.
Files changed (255) hide show
  1. {python_voiceio-1.18.18/python_voiceio.egg-info → python_voiceio-1.18.19}/PKG-INFO +1 -1
  2. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/pyproject.toml +1 -1
  3. {python_voiceio-1.18.18 → python_voiceio-1.18.19/python_voiceio.egg-info}/PKG-INFO +1 -1
  4. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/python_voiceio.egg-info/SOURCES.txt +1 -0
  5. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_app_wiring.py +1 -1
  6. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_cancel.py +2 -2
  7. python_voiceio-1.18.19/tests/test_silent_tail.py +373 -0
  8. python_voiceio-1.18.19/voiceio/__init__.py +1 -0
  9. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/app.py +17 -6
  10. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/audio_source.py +83 -1
  11. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/recorder.py +21 -1
  12. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/streaming.py +46 -13
  13. python_voiceio-1.18.18/voiceio/__init__.py +0 -1
  14. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/LICENSE +0 -0
  15. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/README.md +0 -0
  16. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/python_voiceio.egg-info/dependency_links.txt +0 -0
  17. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/python_voiceio.egg-info/entry_points.txt +0 -0
  18. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/python_voiceio.egg-info/requires.txt +0 -0
  19. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/python_voiceio.egg-info/top_level.txt +0 -0
  20. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/setup.cfg +0 -0
  21. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_announce.py +0 -0
  22. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_audio_devices.py +0 -0
  23. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_audio_quality.py +0 -0
  24. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_audio_source.py +0 -0
  25. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_backend_probes.py +0 -0
  26. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_cli.py +0 -0
  27. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_clipboard_read.py +0 -0
  28. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_clipboard_typer.py +0 -0
  29. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_commands.py +0 -0
  30. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_concurrency_lockdown.py +0 -0
  31. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_config.py +0 -0
  32. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_context_terms.py +0 -0
  33. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_corrections.py +0 -0
  34. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_cuda_setup_hint.py +0 -0
  35. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_dead_mic.py +0 -0
  36. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_decoders.py +0 -0
  37. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_engine.py +0 -0
  38. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_errorlog.py +0 -0
  39. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_evdev_uaccess.py +0 -0
  40. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_evdev_x11_optional.py +0 -0
  41. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_fallback.py +0 -0
  42. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_fcitx_bridge.py +0 -0
  43. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_feedback_stream.py +0 -0
  44. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_focus.py +0 -0
  45. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_gpu_fallback.py +0 -0
  46. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_health.py +0 -0
  47. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_hints.py +0 -0
  48. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_history.py +0 -0
  49. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_hotkey_modes.py +0 -0
  50. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_engine_limits.py +0 -0
  51. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_engine_listener.py +0 -0
  52. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_pending.py +0 -0
  53. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_pids.py +0 -0
  54. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_ping.py +0 -0
  55. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_session.py +0 -0
  56. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_textlimit.py +0 -0
  57. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_ibus_typer.py +0 -0
  58. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_idle_audio.py +0 -0
  59. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_input_latency.py +0 -0
  60. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_install_env.py +0 -0
  61. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_clean.py +0 -0
  62. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_import.py +0 -0
  63. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_language.py +0 -0
  64. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_metrics.py +0 -0
  65. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_pipeline.py +0 -0
  66. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_quiet.py +0 -0
  67. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_resume.py +0 -0
  68. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_review.py +0 -0
  69. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_summary.py +0 -0
  70. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_learn_targets.py +0 -0
  71. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_llm.py +0 -0
  72. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_llm_api.py +0 -0
  73. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_mic_gain.py +0 -0
  74. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_mic_test.py +0 -0
  75. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_modifier_guard.py +0 -0
  76. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_numbers.py +0 -0
  77. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_paste_last.py +0 -0
  78. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_pipeline.py +0 -0
  79. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_platform.py +0 -0
  80. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_postcorrect.py +0 -0
  81. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_postprocess.py +0 -0
  82. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_prebuffer.py +0 -0
  83. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_presence.py +0 -0
  84. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_prompt.py +0 -0
  85. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_quiet_audio.py +0 -0
  86. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_recorder_integration.py +0 -0
  87. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_replies.py +0 -0
  88. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_report.py +0 -0
  89. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_retention.py +0 -0
  90. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_robustness.py +0 -0
  91. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_security_hardening.py +0 -0
  92. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_server.py +0 -0
  93. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_service.py +0 -0
  94. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_setup.py +0 -0
  95. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_setup_sherpa_install.py +0 -0
  96. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_sherpa.py +0 -0
  97. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_spool.py +0 -0
  98. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_streaming.py +0 -0
  99. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_suggest.py +0 -0
  100. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_telemetry.py +0 -0
  101. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_tokens.py +0 -0
  102. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_transcriber.py +0 -0
  103. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_tray.py +0 -0
  104. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_tts.py +0 -0
  105. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_tts_socket.py +0 -0
  106. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_typer_manager.py +0 -0
  107. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_vad.py +0 -0
  108. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_vocabulary.py +0 -0
  109. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_wordfreq.py +0 -0
  110. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/tests/test_worker_decode.py +0 -0
  111. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/__main__.py +0 -0
  112. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/announce.py +0 -0
  113. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/audio_devices.py +0 -0
  114. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/backends.py +0 -0
  115. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/__init__.py +0 -0
  116. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/configcmd.py +0 -0
  117. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/corrections.py +0 -0
  118. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/doctor.py +0 -0
  119. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/history.py +0 -0
  120. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/learn.py +0 -0
  121. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/models.py +0 -0
  122. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/replies.py +0 -0
  123. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/servicecmd.py +0 -0
  124. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/uninstall.py +0 -0
  125. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/cli/vocab.py +0 -0
  126. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/clipboard_read.py +0 -0
  127. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/commands.py +0 -0
  128. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/config.py +0 -0
  129. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/consent.py +0 -0
  130. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/context_terms.py +0 -0
  131. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/__init__.py +0 -0
  132. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/bias.py +0 -0
  133. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/__init__.py +0 -0
  134. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/base.py +0 -0
  135. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/catalog.py +0 -0
  136. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/faster_whisper/__init__.py +0 -0
  137. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/faster_whisper/worker.py +0 -0
  138. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/fetch.py +0 -0
  139. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/lanes.py +0 -0
  140. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/sherpa.py +0 -0
  141. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/decoders/whispercpp.py +0 -0
  142. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/engine.py +0 -0
  143. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/core/pipeline.py +0 -0
  144. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/corrections.py +0 -0
  145. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/data/60-voiceio-uaccess.rules +0 -0
  146. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/data/__init__.py +0 -0
  147. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/demo.py +0 -0
  148. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/display.py +0 -0
  149. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/errorlog.py +0 -0
  150. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/feedback.py +0 -0
  151. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/focus.py +0 -0
  152. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/health.py +0 -0
  153. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hints.py +0 -0
  154. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/history.py +0 -0
  155. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/__init__.py +0 -0
  156. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/base.py +0 -0
  157. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/chain.py +0 -0
  158. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/evdev.py +0 -0
  159. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/pynput_backend.py +0 -0
  160. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/hotkeys/socket_backend.py +0 -0
  161. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/__init__.py +0 -0
  162. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/engine.py +0 -0
  163. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/install.py +0 -0
  164. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/pending.py +0 -0
  165. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/session.py +0 -0
  166. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ibus/textlimit.py +0 -0
  167. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/idle_audio.py +0 -0
  168. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/install_env.py +0 -0
  169. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/__init__.py +0 -0
  170. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/augment.py +0 -0
  171. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/clean.py +0 -0
  172. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/evaluate.py +0 -0
  173. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/importer.py +0 -0
  174. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/lastrun.py +0 -0
  175. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/metrics.py +0 -0
  176. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/quiet.py +0 -0
  177. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/review.py +0 -0
  178. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/store.py +0 -0
  179. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/summary.py +0 -0
  180. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/teacher.py +0 -0
  181. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/learn/train.py +0 -0
  182. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/llm.py +0 -0
  183. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/llm_api.py +0 -0
  184. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/mic_gain.py +0 -0
  185. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/models/__init__.py +0 -0
  186. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/models/silero_vad.onnx +0 -0
  187. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/numbers.py +0 -0
  188. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/pidlock.py +0 -0
  189. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/platform.py +0 -0
  190. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/postcorrect.py +0 -0
  191. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/postprocess.py +0 -0
  192. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/power.py +0 -0
  193. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/presence.py +0 -0
  194. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/privacy.py +0 -0
  195. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/prompt.py +0 -0
  196. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/quiet_audio.py +0 -0
  197. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/replies.py +0 -0
  198. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/report.py +0 -0
  199. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/retention.py +0 -0
  200. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/server/__init__.py +0 -0
  201. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/server/__main__.py +0 -0
  202. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/server/app.py +0 -0
  203. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/server/config.py +0 -0
  204. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/server/runtime.py +0 -0
  205. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/service.py +0 -0
  206. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/__init__.py +0 -0
  207. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/configfile.py +0 -0
  208. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/extras.py +0 -0
  209. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/hotkey.py +0 -0
  210. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/noninteractive.py +0 -0
  211. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/speech.py +0 -0
  212. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/steps.py +0 -0
  213. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/system.py +0 -0
  214. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/setup/ui.py +0 -0
  215. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/sounds/__init__.py +0 -0
  216. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/sounds/alert.wav +0 -0
  217. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/sounds/commit.wav +0 -0
  218. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/sounds/start.wav +0 -0
  219. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/sounds/stop.wav +0 -0
  220. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/spool.py +0 -0
  221. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/suggest.py +0 -0
  222. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/telemetry.py +0 -0
  223. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tokens.py +0 -0
  224. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tray/__init__.py +0 -0
  225. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tray/_icons.py +0 -0
  226. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tray/_indicator.py +0 -0
  227. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tray/_pystray.py +0 -0
  228. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/__init__.py +0 -0
  229. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/base.py +0 -0
  230. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/chain.py +0 -0
  231. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/edge_engine.py +0 -0
  232. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/espeak.py +0 -0
  233. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/piper_engine.py +0 -0
  234. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/player.py +0 -0
  235. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/tts/supertonic_engine.py +0 -0
  236. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/__init__.py +0 -0
  237. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/base.py +0 -0
  238. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/chain.py +0 -0
  239. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/clipboard.py +0 -0
  240. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/collecting.py +0 -0
  241. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/fcitx_bridge.py +0 -0
  242. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/ibus.py +0 -0
  243. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/manager.py +0 -0
  244. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/modifier_guard.py +0 -0
  245. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/paste.py +0 -0
  246. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/pynput_type.py +0 -0
  247. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/wtype.py +0 -0
  248. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/xdotool.py +0 -0
  249. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/typers/ydotool.py +0 -0
  250. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/ui.py +0 -0
  251. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/vad.py +0 -0
  252. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/vocab_stats.py +0 -0
  253. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/vocabulary.py +0 -0
  254. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/watchdog.py +0 -0
  255. {python_voiceio-1.18.18 → python_voiceio-1.18.19}/voiceio/wordfreq.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-voiceio
3
- Version: 1.18.18
3
+ Version: 1.18.19
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.18"
7
+ version = "1.18.19"
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.18
3
+ Version: 1.18.19
4
4
  Summary: Voice dictation for Linux. Speak → text, locally, instantly.
5
5
  Author: Hugo Montenegro
6
6
  License-Expression: MIT
@@ -85,6 +85,7 @@ tests/test_service.py
85
85
  tests/test_setup.py
86
86
  tests/test_setup_sherpa_install.py
87
87
  tests/test_sherpa.py
88
+ tests/test_silent_tail.py
88
89
  tests/test_spool.py
89
90
  tests/test_streaming.py
90
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,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"
@@ -11,6 +11,7 @@ import time
11
11
  import numpy as np
12
12
 
13
13
  from voiceio import config, platform as plat, tray
14
+ from voiceio.audio_source import SpeechSpans, speech_of
14
15
  from voiceio.commands import CommandProcessor
15
16
  from voiceio.core.decoders.base import Bias
16
17
  from voiceio.hotkeys import chain as hotkey_chain
@@ -380,6 +381,7 @@ class VoiceIO:
380
381
  return
381
382
  pending = _PendingStop(self._recording, tail_ms / 1000, self._stop_due)
382
383
  self._pending_stop = pending
384
+ self.recorder.mark_stop_press()
383
385
  if announce:
384
386
  self._announce_stop()
385
387
  pending.timer.start()
@@ -420,6 +422,7 @@ class VoiceIO:
420
422
  """A press during the stop tail: not done yet, keep recording the same
421
423
  dictation. Undoes what _announce_stop showed."""
422
424
  self._take_pending_stop()
425
+ self.recorder.mark_stop_press(False)
423
426
  # An auto-stop that fired during the tail was single-shot: re-arm.
424
427
  self.recorder.set_on_auto_stop(self._on_auto_stop)
425
428
  if self._stop_announced == self._recording:
@@ -736,6 +739,10 @@ class VoiceIO:
736
739
  self.recorder.set_on_auto_stop(None)
737
740
  self.recorder.set_on_dead_stream(None)
738
741
  audio = self.recorder.stop()
742
+ # Where the VAD heard speech and the stop press began the tail, read
743
+ # now: the recorder may be on the next dictation by the time the
744
+ # finalizer runs. A stop without a tail marked no press: no trimming.
745
+ speech = speech_of(self.recorder)
739
746
  tray.set_recording(False)
740
747
  self._idle_audio.touch()
741
748
  self._check_input_level(time.monotonic() - self._record_start)
@@ -753,13 +760,15 @@ class VoiceIO:
753
760
  session.set_is_current(lambda g=gen: self._generation == g)
754
761
  # Finalize in background. Pass audio snapshot — session no longer
755
762
  # touches the recorder. Generation check cancels if superseded.
756
- self._output_thread(self._finalize_streaming, session, audio, elapsed, gen, rid)
763
+ self._output_thread(self._finalize_streaming, session, audio, elapsed, gen, rid,
764
+ speech)
757
765
  elif not self._streaming:
758
766
  self._state = _State.IDLE
759
767
  log.info("Stopped recording (%.1fs)", elapsed)
760
768
  if audio is not None:
761
769
  # _process owns deactivation (its finally block).
762
- self._output_thread(self._process, audio, gen, rid, self._recording_bias)
770
+ self._output_thread(self._process, audio, gen, rid, self._recording_bias,
771
+ speech)
763
772
  else:
764
773
  # No processing thread will run — release the source here.
765
774
  self._end_recording(rid)
@@ -856,7 +865,7 @@ class VoiceIO:
856
865
 
857
866
  def _finalize_streaming(
858
867
  self, session: StreamingSession, audio: np.ndarray | None,
859
- elapsed: float, gen: int, rid: int,
868
+ elapsed: float, gen: int, rid: int, speech: SpeechSpans | None = None,
860
869
  ) -> None:
861
870
  """Run final transcription and commit in background thread."""
862
871
  t_final = time.monotonic()
@@ -867,7 +876,7 @@ class VoiceIO:
867
876
  from voiceio import clipboard_read
868
877
  clipboard_read.copy_text(session.interim_text)
869
878
  extra = self._retention_extra(audio)
870
- final_text = session.stop(audio)
879
+ final_text = session.stop(audio, speech)
871
880
  with self._hotkey_lock:
872
881
  if self._finalizing is session:
873
882
  self._finalizing = None
@@ -916,14 +925,16 @@ class VoiceIO:
916
925
  tray.set_processing(False)
917
926
 
918
927
  def _process(self, audio: np.ndarray, gen: int, rid: int = 0,
919
- bias: Bias | None = None) -> None:
928
+ bias: Bias | None = None, speech: SpeechSpans | None = None) -> None:
920
929
  """Batch transcription (non-streaming mode)."""
921
930
  try:
922
931
  if self._generation != gen:
923
932
  self._cancelled.discard(gen)
924
933
  return
925
934
  extra = self._retention_extra(audio)
926
- result = self.engine.transcribe(audio, bias=bias)
935
+ # Trailing silence makes decoders hallucinate (see SpeechSpans).
936
+ voiced = audio[:speech.voiced_end(0, len(audio))] if speech else audio
937
+ result = self.engine.transcribe(voiced, bias=bias)
927
938
  # Superseded by a newer recording, cancelled, or a voice command
928
939
  # discarded it: do not touch the typer.
929
940
  if self._discard_cancelled(gen, extra):
@@ -25,7 +25,7 @@ from typing import Callable, Protocol, runtime_checkable
25
25
 
26
26
  import numpy as np
27
27
 
28
- __all__ = ["AudioSource", "PushAudioSource", "pcm16_to_float32"]
28
+ __all__ = ["AudioSource", "PushAudioSource", "SpeechSpans", "pcm16_to_float32", "speech_of"]
29
29
 
30
30
  # The only sample rate Whisper accepts. Everything upstream resamples to it.
31
31
  SAMPLE_RATE = 16000
@@ -49,6 +49,88 @@ class AudioSource(Protocol):
49
49
  results *sooner*, they are never required for correctness."""
50
50
  ...
51
51
 
52
+ # Optional: `speech_spans() -> SpeechSpans`, where a VAD heard speech so
53
+ # far (see speech_of). Without it every sample is decoded.
54
+
55
+
56
+ # Kept after the last speech the VAD heard, so a word's soft ending (which
57
+ # the VAD scores below threshold) is not clipped. faster-whisper's own VAD
58
+ # pads speech by the same 400 ms.
59
+ SPEECH_TAIL_PAD_SECS = 0.4
60
+
61
+
62
+ class SpeechSpans:
63
+ """Where a recording's VAD heard speech, and where the user pressed stop,
64
+ in samples of that recording.
65
+
66
+ A stop with a tail (audio.input_latency_ms, hotkey.release_tail_ms) keeps
67
+ recording after the press, for audio still on its way. When none comes,
68
+ that tail is silence, and Whisper or Parakeet given silence still write
69
+ something: the prompt they were conditioned on, or "Thank you for
70
+ watching." So only the tail is trimmed (`voiced_end`): everything before
71
+ the press is decoded as it always was. Audio the VAD has not judged counts
72
+ as speech, and a recording in which it heard no speech at all is decoded
73
+ whole: the VAD may be missing a quiet speaker.
74
+ """
75
+
76
+ def __init__(self, sample_rate: int = SAMPLE_RATE, unchecked: int = 0) -> None:
77
+ self.sample_rate = sample_rate
78
+ self.heard = False
79
+ # Sample position of the stop press that began the tail; None while
80
+ # no stop is pending (nothing is trimmed then).
81
+ self.press: int | None = None
82
+ # Audio before `unchecked` was never run through the VAD (the
83
+ # recorder's pre-buffer): treated as speech.
84
+ self._spans: list[list[int]] = [[0, unchecked]] if unchecked > 0 else []
85
+ self._checked = unchecked # samples the VAD has judged
86
+
87
+ def mark(self, start: int, end: int, speech: bool) -> None:
88
+ """The VAD judged samples [start, end)."""
89
+ self._checked = max(self._checked, end)
90
+ if not speech:
91
+ return
92
+ self.heard = True
93
+ if self._spans and self._spans[-1][1] >= start:
94
+ self._spans[-1][1] = max(self._spans[-1][1], end)
95
+ else:
96
+ self._spans.append([start, end])
97
+
98
+ def copy(self) -> SpeechSpans:
99
+ other = SpeechSpans(self.sample_rate)
100
+ other.heard, other.press, other._checked = self.heard, self.press, self._checked
101
+ other._spans = [list(s) for s in self._spans]
102
+ return other
103
+
104
+ def voiced_end(self, start: int, end: int) -> int:
105
+ """Where decoding [start, end) may stop. Audio before the press is
106
+ always kept; after it, only up to a pad past the last speech (a word
107
+ ending just before the press keeps its pad too). A tail with no
108
+ speech ends the decode at the press, and a span wholly inside the
109
+ tail with no speech decodes to nothing; a tail no longer than the
110
+ pad (hold mode's default release tail) is kept whole."""
111
+ pad = int(SPEECH_TAIL_PAD_SECS * self.sample_rate)
112
+ press = self.press
113
+ if (press is None or end - press <= pad or not self.heard
114
+ or self._checked < end): # unjudged audio counts as speech
115
+ return end
116
+ limit = press
117
+ for s, e in reversed(self._spans):
118
+ if s < end:
119
+ # A span that starts in the tail (after a freeze cut there)
120
+ # and holds no speech decodes to nothing, pad or not.
121
+ if e > start or start < press:
122
+ limit = max(press, min(e, end) + pad)
123
+ break
124
+ return max(start, min(end, limit))
125
+
126
+
127
+ def speech_of(source: object) -> SpeechSpans | None:
128
+ """The source's speech spans so far, if it has a VAD (optional member:
129
+ `AudioRecorder` has one, `PushAudioSource` doesn't)."""
130
+ get = getattr(source, "speech_spans", None)
131
+ spans = get() if callable(get) else None
132
+ return spans if isinstance(spans, SpeechSpans) else None
133
+
52
134
 
53
135
  class AudioBuffer:
54
136
  """Growable mono float32 buffer: O(1) amortized append, O(1) read.