voiceveritas 0.1.5__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 (91) hide show
  1. voiceveritas-0.1.5/.gitignore +63 -0
  2. voiceveritas-0.1.5/LICENSE +201 -0
  3. voiceveritas-0.1.5/PKG-INFO +258 -0
  4. voiceveritas-0.1.5/README.md +202 -0
  5. voiceveritas-0.1.5/configs/baseline.yaml +36 -0
  6. voiceveritas-0.1.5/configs/baseline_asr.yaml +41 -0
  7. voiceveritas-0.1.5/configs/baseline_asr_align.yaml +39 -0
  8. voiceveritas-0.1.5/configs/deep.yaml +24 -0
  9. voiceveritas-0.1.5/demo/hf-space/README.md +30 -0
  10. voiceveritas-0.1.5/demo/hf-space/app.py +104 -0
  11. voiceveritas-0.1.5/demo/hf-space/examples/example_read.wav +0 -0
  12. voiceveritas-0.1.5/demo/hf-space/examples/example_spontaneous.wav +0 -0
  13. voiceveritas-0.1.5/demo/hf-space/requirements.txt +5 -0
  14. voiceveritas-0.1.5/docs/assets/terminal-predict.png +0 -0
  15. voiceveritas-0.1.5/docs/benchmark.md +108 -0
  16. voiceveritas-0.1.5/docs/data.md +63 -0
  17. voiceveritas-0.1.5/docs/ethics.md +70 -0
  18. voiceveritas-0.1.5/docs/model_card.md +66 -0
  19. voiceveritas-0.1.5/docs/release.md +70 -0
  20. voiceveritas-0.1.5/docs/robustness.md +195 -0
  21. voiceveritas-0.1.5/docs/usage.md +146 -0
  22. voiceveritas-0.1.5/examples/README.md +24 -0
  23. voiceveritas-0.1.5/examples/example_read.wav +0 -0
  24. voiceveritas-0.1.5/examples/example_spontaneous.wav +0 -0
  25. voiceveritas-0.1.5/pyproject.toml +159 -0
  26. voiceveritas-0.1.5/scripts/bench_api.py +89 -0
  27. voiceveritas-0.1.5/scripts/make_assets.py +121 -0
  28. voiceveritas-0.1.5/scripts/make_examples.py +47 -0
  29. voiceveritas-0.1.5/scripts/serve_entrypoint.py +21 -0
  30. voiceveritas-0.1.5/src/voiceveritas/__init__.py +10 -0
  31. voiceveritas-0.1.5/src/voiceveritas/api/__init__.py +5 -0
  32. voiceveritas-0.1.5/src/voiceveritas/api/app.py +183 -0
  33. voiceveritas-0.1.5/src/voiceveritas/asr/__init__.py +29 -0
  34. voiceveritas-0.1.5/src/voiceveritas/asr/char_align.py +230 -0
  35. voiceveritas-0.1.5/src/voiceveritas/asr/features.py +233 -0
  36. voiceveritas-0.1.5/src/voiceveritas/asr/lexical.py +215 -0
  37. voiceveritas-0.1.5/src/voiceveritas/asr/transcribe.py +116 -0
  38. voiceveritas-0.1.5/src/voiceveritas/audio/__init__.py +17 -0
  39. voiceveritas-0.1.5/src/voiceveritas/audio/io.py +133 -0
  40. voiceveritas-0.1.5/src/voiceveritas/cli.py +358 -0
  41. voiceveritas-0.1.5/src/voiceveritas/config.py +134 -0
  42. voiceveritas-0.1.5/src/voiceveritas/data_prep/__init__.py +27 -0
  43. voiceveritas-0.1.5/src/voiceveritas/data_prep/ami.py +188 -0
  44. voiceveritas-0.1.5/src/voiceveritas/data_prep/chunking.py +94 -0
  45. voiceveritas-0.1.5/src/voiceveritas/data_prep/download.py +72 -0
  46. voiceveritas-0.1.5/src/voiceveritas/data_prep/librispeech.py +111 -0
  47. voiceveritas-0.1.5/src/voiceveritas/eval/__init__.py +21 -0
  48. voiceveritas-0.1.5/src/voiceveritas/eval/robustness.py +258 -0
  49. voiceveritas-0.1.5/src/voiceveritas/features/__init__.py +5 -0
  50. voiceveritas-0.1.5/src/voiceveritas/features/prosody.py +324 -0
  51. voiceveritas-0.1.5/src/voiceveritas/manifest/__init__.py +16 -0
  52. voiceveritas-0.1.5/src/voiceveritas/manifest/io.py +85 -0
  53. voiceveritas-0.1.5/src/voiceveritas/manifest/schema.py +82 -0
  54. voiceveritas-0.1.5/src/voiceveritas/manifest/split.py +79 -0
  55. voiceveritas-0.1.5/src/voiceveritas/metrics/__init__.py +9 -0
  56. voiceveritas-0.1.5/src/voiceveritas/metrics/binary.py +118 -0
  57. voiceveritas-0.1.5/src/voiceveritas/model_hub.py +72 -0
  58. voiceveritas-0.1.5/src/voiceveritas/models/__init__.py +17 -0
  59. voiceveritas-0.1.5/src/voiceveritas/models/base.py +114 -0
  60. voiceveritas-0.1.5/src/voiceveritas/models/ensemble.py +135 -0
  61. voiceveritas-0.1.5/src/voiceveritas/models/prosody_asr_lgbm.py +137 -0
  62. voiceveritas-0.1.5/src/voiceveritas/models/prosody_lgbm.py +137 -0
  63. voiceveritas-0.1.5/src/voiceveritas/models/registry.py +48 -0
  64. voiceveritas-0.1.5/src/voiceveritas/models/wav2vec_head.py +166 -0
  65. voiceveritas-0.1.5/src/voiceveritas/train/__init__.py +6 -0
  66. voiceveritas-0.1.5/src/voiceveritas/train/augment.py +46 -0
  67. voiceveritas-0.1.5/src/voiceveritas/train/dataset.py +266 -0
  68. voiceveritas-0.1.5/src/voiceveritas/train/deep_trainer.py +208 -0
  69. voiceveritas-0.1.5/src/voiceveritas/train/trainer.py +203 -0
  70. voiceveritas-0.1.5/src/voiceveritas/utils/__init__.py +1 -0
  71. voiceveritas-0.1.5/src/voiceveritas/utils/synth.py +130 -0
  72. voiceveritas-0.1.5/src/voiceveritas/vad/__init__.py +6 -0
  73. voiceveritas-0.1.5/src/voiceveritas/vad/energy_vad.py +151 -0
  74. voiceveritas-0.1.5/src/voiceveritas/vad/snr.py +48 -0
  75. voiceveritas-0.1.5/tests/__init__.py +1 -0
  76. voiceveritas-0.1.5/tests/conftest.py +113 -0
  77. voiceveritas-0.1.5/tests/test_api.py +67 -0
  78. voiceveritas-0.1.5/tests/test_asr_features.py +141 -0
  79. voiceveritas-0.1.5/tests/test_asr_pipeline.py +207 -0
  80. voiceveritas-0.1.5/tests/test_audio_io.py +73 -0
  81. voiceveritas-0.1.5/tests/test_char_align.py +185 -0
  82. voiceveritas-0.1.5/tests/test_data_prep.py +96 -0
  83. voiceveritas-0.1.5/tests/test_ensemble.py +71 -0
  84. voiceveritas-0.1.5/tests/test_manifest.py +157 -0
  85. voiceveritas-0.1.5/tests/test_metrics.py +66 -0
  86. voiceveritas-0.1.5/tests/test_model_hub.py +82 -0
  87. voiceveritas-0.1.5/tests/test_prosody.py +101 -0
  88. voiceveritas-0.1.5/tests/test_robustness.py +152 -0
  89. voiceveritas-0.1.5/tests/test_snr_augment.py +145 -0
  90. voiceveritas-0.1.5/tests/test_train_smoke.py +164 -0
  91. voiceveritas-0.1.5/tests/test_vad.py +50 -0
@@ -0,0 +1,63 @@
1
+ # --- Data & artifacts (never commit audio, datasets, checkpoints) ---
2
+ # Anchored to repo root: a bare "models/" pattern also swallowed
3
+ # src/voiceveritas/models/ and shipped a broken wheel (learned the hard way).
4
+ /data/
5
+ /datasets/
6
+ /runs/
7
+ /models/
8
+ /checkpoints/
9
+ *.wav
10
+ *.flac
11
+ *.mp3
12
+ *.m4a
13
+ *.ogg
14
+ *.opus
15
+ *.npy
16
+ *.npz
17
+ *.ckpt
18
+ *.pt
19
+ *.onnx
20
+ *.joblib
21
+
22
+ # --- Deliberate exceptions: tiny synthetic demo clips (~380 KB caricatures,
23
+ # generated by scripts/make_examples.py — not data, safe to commit) ---
24
+ !examples/*.wav
25
+ !demo/hf-space/examples/*.wav
26
+
27
+ # --- Python ---
28
+ __pycache__/
29
+ *.py[cod]
30
+ *.egg-info/
31
+ *.egg
32
+ build/
33
+ dist/
34
+ .eggs/
35
+ .venv/
36
+ venv/
37
+ env/
38
+ .python-version
39
+
40
+ # --- Tooling caches ---
41
+ .pytest_cache/
42
+ .mypy_cache/
43
+ .ruff_cache/
44
+ .coverage
45
+ coverage.xml
46
+ htmlcov/
47
+ uv.lock.bak
48
+
49
+ # --- Editors / OS ---
50
+ .idea/
51
+ .vscode/
52
+ *.swp
53
+ .DS_Store
54
+ Thumbs.db
55
+
56
+ # --- Local secrets / environment ---
57
+ .env
58
+ .env.*
59
+ *.local.yaml
60
+
61
+ # --- Session / editor tooling ---
62
+ .zcode/
63
+ *.log
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 VoiceVeritas Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,258 @@
1
+ Metadata-Version: 2.5
2
+ Name: voiceveritas
3
+ Version: 0.1.5
4
+ Summary: Detect whether interview answers are read/recited from a script or spoken spontaneously. Audio-only, open-source anti-cheat for AI interviews.
5
+ Project-URL: Homepage, https://github.com/StanleyChanH/VoiceVeritas
6
+ Project-URL: Repository, https://github.com/StanleyChanH/VoiceVeritas
7
+ Project-URL: Issues, https://github.com/StanleyChanH/VoiceVeritas/issues
8
+ Project-URL: Changelog, https://github.com/StanleyChanH/VoiceVeritas/releases
9
+ Author: VoiceVeritas Contributors
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: anti-cheating,audio-classification,interview,prosody,read-speech-detection,speech,spontaneous-speech,wav2vec2
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: joblib>=1.3
26
+ Requires-Dist: librosa>=0.10.2
27
+ Requires-Dist: lightgbm>=4.1
28
+ Requires-Dist: numpy<3,>=1.26
29
+ Requires-Dist: pandas>=2.0
30
+ Requires-Dist: praat-parselmouth>=0.4.3
31
+ Requires-Dist: pyyaml>=6.0
32
+ Requires-Dist: scikit-learn>=1.3
33
+ Requires-Dist: scipy>=1.11
34
+ Requires-Dist: soundfile>=0.12.1
35
+ Requires-Dist: tqdm>=4.66
36
+ Provides-Extra: api
37
+ Requires-Dist: fastapi>=0.110; extra == 'api'
38
+ Requires-Dist: python-multipart>=0.0.9; extra == 'api'
39
+ Requires-Dist: uvicorn[standard]>=0.29; extra == 'api'
40
+ Provides-Extra: asr
41
+ Requires-Dist: faster-whisper>=1.0; extra == 'asr'
42
+ Provides-Extra: deep
43
+ Requires-Dist: safetensors>=0.4; extra == 'deep'
44
+ Requires-Dist: torch>=2.1; extra == 'deep'
45
+ Requires-Dist: transformers>=4.38; extra == 'deep'
46
+ Provides-Extra: dev
47
+ Requires-Dist: httpx>=0.27; extra == 'dev'
48
+ Requires-Dist: mypy>=1.8; extra == 'dev'
49
+ Requires-Dist: pre-commit>=3.6; extra == 'dev'
50
+ Requires-Dist: pytest-cov>=4.1; extra == 'dev'
51
+ Requires-Dist: pytest>=8.0; extra == 'dev'
52
+ Requires-Dist: ruff>=0.5; extra == 'dev'
53
+ Requires-Dist: types-pyyaml; extra == 'dev'
54
+ Requires-Dist: types-tqdm; extra == 'dev'
55
+ Description-Content-Type: text/markdown
56
+
57
+ <div align="center">
58
+
59
+ # 🎙️ VoiceVeritas
60
+
61
+ **Detect whether an interview answer is being read from a script — or genuinely spoken.**
62
+
63
+ [![CI](https://github.com/StanleyChanH/VoiceVeritas/actions/workflows/ci.yml/badge.svg)](https://github.com/StanleyChanH/VoiceVeritas/actions/workflows/ci.yml)
64
+ [![PyPI](https://img.shields.io/pypi/v/voiceveritas.svg)](https://pypi.org/project/voiceveritas/)
65
+ [![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-blue.svg)](LICENSE)
66
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](pyproject.toml)
67
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-261230.svg)](https://github.com/astral-sh/ruff)
68
+
69
+ *Audio-only read-speech detection for AI interview anti-cheating.*
70
+ **[Try the live demo →](https://huggingface.co/spaces/StanleyChanH/VoiceVeritas)** · English speech, uploads not stored.
71
+
72
+ ![vv predict output](docs/assets/terminal-predict.png)
73
+
74
+ **English** | [简体中文](README.zh-CN.md)
75
+
76
+ </div>
77
+
78
+ ---
79
+
80
+ ## Why
81
+
82
+ Online interviews are increasingly vulnerable to a simple cheat: the candidate **reads a prepared answer** (or a ChatGPT-generated one) off-screen. Human reviewers struggle to tell scripted from spontaneous speech reliably — but the acoustic signatures differ measurably.
83
+
84
+ VoiceVeritas is an **open-source, audio-only** system that takes an interview answer recording and returns
85
+
86
+ ```
87
+ P(read | audio) ∈ [0, 1] — the probability the audio was read/recited
88
+ ```
89
+
90
+ plus per-segment scores, confidence, and (for the interpretable baseline) the prosodic cues that drove the decision.
91
+
92
+ > 📌 **State of research** — the approach follows the SLT 2024 paper [*Classification of Spontaneous and Scripted Speech for Multilingual Audio*](https://arxiv.org/abs/2412.11896): frozen pretrained speech-transformer embeddings + a light classifier beat handcrafted prosodic features. To our knowledge, **no open-source implementation of interview read-speech detection existed before this project.**
93
+
94
+ > 🌐 **Scope: English speech.** The project targets English interview audio only — by design, not by omission. Speech-style cues (pause rhythm, F0 dynamics, disfluency patterns) are language-specific; extending to other languages requires *native spontaneous+read corpora per language*, not just machine translation of docs. PRs for new languages are welcome following [data.md](docs/data.md).
95
+
96
+ ## Results
97
+
98
+ > ⚠️ **Known limitations — read before quoting any number below.**
99
+ > The benchmark is **cross-domain** (LibriSpeech audiobook *read* vs AMI meeting *spontaneous*) and small (65 test utterances from unseen speakers). Real interview audio sits between those domains: treat these numbers as an *upper bound*, recalibrate on your own traffic, and expect degradation below ~15 dB SNR. Details: [benchmark.md](docs/benchmark.md) · [robustness.md](docs/robustness.md).
100
+
101
+ Speaker-disjoint benchmark (LibriSpeech *read* vs AMI *spontaneous*, 65 test utterances from unseen speakers; full details & caveats in [benchmark.md](docs/benchmark.md)):
102
+
103
+ | Model | Test AUC-ROC | EER | FPR@TPR95 |
104
+ |---|---|---|---|
105
+ | Track A · prosody + LightGBM (interpretable) | **0.978** | 4% | 4% |
106
+ | Track A · + noise-aware augmentation (default) | **0.998** | 4% | 4% |
107
+ | Track A+ASR · + lexical/alignment features (`[asr]` extra) | **0.998** | 5% | **0%** |
108
+ | Track B · frozen wav2vec2-base + MLP | **1.000** | 0% | 0% |
109
+ | **Ensemble** · median(prosody-aug, wav2vec-aug) | 0.997 | 7.5% | 4% |
110
+
111
+ Noise-robustness (white noise 10 dB): Track A 0.644 → 0.965 with
112
+ augmentation; Track B's white-noise inversion (0.137) fixed to **0.998**;
113
+ the robust ensemble holds **0.994**. Every prediction carries an
114
+ `estimated_snr_db` and a below-15 dB reliability warning. Latency (Track A
115
+ API, 10 s audio, CPU-only): **p50 243 ms** end-to-end.
116
+
117
+ ```console
118
+ $ vv predict runs/<run>/model.joblib answer.wav
119
+ model : prosody_lgbm
120
+ P(read) : 0.000
121
+ verdict@0.5 : SPONTANEOUS
122
+ top contributors :
123
+ speechseg_mean -0.832 ← long speech runs = spontaneous planning
124
+ pause_total_ratio -0.776 ← natural pause structure
125
+ ```
126
+
127
+ ⚠️ These are *cross-domain* research numbers — recalibrate on your own traffic before any operational use ([ethics](docs/ethics.md)). **Neither track survives ≤10 dB SNR** — see the [robustness report](docs/robustness.md) before deploying.
128
+
129
+ ## Architecture
130
+
131
+ ```mermaid
132
+ flowchart LR
133
+ A["Audio (.wav .mp3 .m4a)"] --> B["Preprocess\n16 kHz mono"]
134
+ B --> C["Track A · Prosody\nVAD · F0 · Jitter/Shimmer\nPause stats · nPVI · rate"]
135
+ B --> D["Track B · SSL backbone\nfrozen wav2vec2\nmean+std pooled embeddings"]
136
+ C --> E["LightGBM\n+ calibration"]
137
+ D --> F["MLP head\n(BCE)"]
138
+ E --> G["Segment scores →\nmedian aggregation"]
139
+ F --> G
140
+ G --> H["P(read) · confidence\nfeature attribution"]
141
+ ```
142
+
143
+ - **Track A (interpretable baseline)**: energy VAD + 34 handcrafted prosodic features (F0 statistics, jitter, shimmer, pause/silence distribution, nPVI rhythm, syllable-rate variability) → LightGBM with isotonic calibration.
144
+ - **Track B (performance)**: frozen self-supervised backbone ([wav2vec 2.0](https://arxiv.org/abs/2006.11477)) embeddings, chunk-level scoring, median aggregation — the SOTA recipe from the literature.
145
+ - **Metrics that respect candidates**: besides AUC-ROC/AUC-PR we report **EER and FPR@TPR95**, because flagging a fluent honest candidate is worse than missing a subtle reader.
146
+
147
+ ## Quickstart
148
+
149
+ **Option A — pretrained model, zero training** (Track A, ~140 KB artifact):
150
+
151
+ ```bash
152
+ # Python 3.10+; also works with pip/pipx, uvx, or any virtualenv
153
+ pip install voiceveritas
154
+ vv download-model # fetches the pretrained artifact
155
+ vv predict "$(vv download-model)" examples/example_spontaneous.wav
156
+ ```
157
+
158
+ Two synthetic example clips ship in [`examples/`](examples/) so the pipeline
159
+ can be exercised in seconds — real-speech benchmarks live in
160
+ [benchmark.md](docs/benchmark.md).
161
+
162
+ **Option B — reproduce the full pipeline from source:**
163
+
164
+ ```bash
165
+ # 1. Install (Python 3.10+; uv recommended — or: pip install -e ".[api,deep]")
166
+ uv sync --extra api --extra deep
167
+
168
+ # 2. Prepare the public benchmark data (~750 MB) and train the baseline
169
+ uv run vv prepare librispeech --download
170
+ uv run vv prepare ami --download
171
+ cat data/manifests/librispeech.jsonl data/manifests/ami.jsonl > data/manifests/benchmark.jsonl
172
+ uv run vv train --config configs/baseline.yaml
173
+
174
+ # 3. Score a single file (segment scores + feature attribution)
175
+ uv run vv predict runs/<timestamp>_baseline/model.joblib answer.wav
176
+
177
+ # 4. Serve the REST API (Swagger UI at http://localhost:8000/docs)
178
+ uv run vv serve runs/<timestamp>_baseline
179
+
180
+ # 5. Stress a model under noise / telephony / resampling conditions
181
+ uv run vv robustness runs/<timestamp>_baseline --manifest data/manifests/benchmark.jsonl
182
+ ```
183
+
184
+ <details>
185
+ <summary><b>API example</b></summary>
186
+
187
+ ```bash
188
+ curl -X POST http://localhost:8000/v1/predict \
189
+ -F "audio=@answer.wav" \
190
+ -F "reference_text=optional (reserved, unused by audio-only models)"
191
+ ```
192
+
193
+ ```json
194
+ {
195
+ "read_probability": 0.87,
196
+ "label": "read",
197
+ "confidence": 0.72,
198
+ "segmented_scores": [{"start_s": 0, "end_s": 25.7, "score": 0.87}],
199
+ "processing_ms": 184,
200
+ "model": {"name": "prosody_lgbm", "package_version": "0.1.0"}
201
+ }
202
+ ```
203
+
204
+ </details>
205
+
206
+ ## Repository layout
207
+
208
+ ```
209
+ src/voiceveritas/ core package (audio IO, VAD, features, models, training, API)
210
+ configs/ experiment configs (baseline / deep)
211
+ scripts/ benchmarking utilities, examples & asset generators
212
+ examples/ two synthetic clips for instant smoke-testing
213
+ demo/hf-space/ Hugging Face Space (Gradio) web demo — deployable as-is
214
+ docs/ usage, data, benchmark, model card, ethics charter
215
+ tests/ unit + integration tests on synthetic fixtures
216
+ ```
217
+
218
+ ## Documentation
219
+
220
+ - [Usage guide](docs/usage.md)
221
+ - [Dataset preparation](docs/data.md) — LibriSpeech, AMI, SBCSAE, CORAAL (licenses documented)
222
+ - [Benchmark results](docs/benchmark.md) — including the shortcut-learning postmortem
223
+ - [Robustness report](docs/robustness.md) — noise/telephony/resampling stress tests
224
+ - [Model card](docs/model_card.md)
225
+ - [Release & deploy checklist](docs/release.md) — PyPI, model artifacts, HF Space
226
+ - [**Ethics & responsible use**](docs/ethics.md) — **read this before deploying**
227
+
228
+ ## Status & roadmap
229
+
230
+ - [x] Dual-track models, speaker-disjoint benchmark, CLI + FastAPI + Docker
231
+ - [x] Robustness suite — noise/SNR/bitrate stress tests + honest degradation report
232
+ - [x] Pretrained release — Track-A artifact via `vv download-model` + the [releases](https://github.com/StanleyChanH/VoiceVeritas/releases) page
233
+ - [x] ASR lexical/alignment features — fillers, pause-syntax misalignment, formality (faster-whisper; `[asr]` extra)
234
+ - [x] Noise-aware training (on by default) + SNR estimation & reliability warnings in every prediction
235
+ - [x] Noise-robust deep track (inversion fixed) + median ensembles (`vv ensemble`)
236
+ - [x] Character-level forced alignment (WhisperX recipe, zero extra deps) — capability shipped; benchmark evaluation exposed a coverage leak, documented and rejected
237
+ - [x] Noise-augmented ASR track — evaluated, negative result (see robustness.md)
238
+ - [x] Installable from PyPI; one-command pretrained model (`vv download-model`); live Gradio demo in [`demo/hf-space/`](demo/hf-space/)
239
+ - [ ] In-domain evaluation corpus (same-speaker read vs spontaneous, e.g. SBCSAE) — the honest generalization test
240
+
241
+ ## Contributing
242
+
243
+ Issues and PRs are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md). Please read the [ethics charter](docs/ethics.md) first: this tool is built to **assist fair human review, not to automate rejection**.
244
+
245
+ ## License
246
+
247
+ [Apache-2.0](LICENSE). Trained-model weights and manifests inherit their training-data licenses (see [docs/data.md](docs/data.md)).
248
+
249
+ ## Citation
250
+
251
+ ```bibtex
252
+ @software{voiceveritas2025,
253
+ title = {VoiceVeritas: open-source read-speech detection for interview anti-cheating},
254
+ author = {VoiceVeritas Contributors},
255
+ year = {2025},
256
+ url = {https://github.com/StanleyChanH/VoiceVeritas}
257
+ }
258
+ ```