sonicproof 0.1.0__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 (60) hide show
  1. sonicproof-0.1.0/.gitignore +30 -0
  2. sonicproof-0.1.0/LICENSE +202 -0
  3. sonicproof-0.1.0/NOTICE +18 -0
  4. sonicproof-0.1.0/PKG-INFO +341 -0
  5. sonicproof-0.1.0/README.md +300 -0
  6. sonicproof-0.1.0/examples/stable_audio_loop.py +141 -0
  7. sonicproof-0.1.0/pyproject.toml +98 -0
  8. sonicproof-0.1.0/src/sonicproof/__init__.py +1 -0
  9. sonicproof-0.1.0/src/sonicproof/audio.py +284 -0
  10. sonicproof-0.1.0/src/sonicproof/cache.py +87 -0
  11. sonicproof-0.1.0/src/sonicproof/cli.py +978 -0
  12. sonicproof-0.1.0/src/sonicproof/data/refbank.npz +0 -0
  13. sonicproof-0.1.0/src/sonicproof/errors.py +40 -0
  14. sonicproof-0.1.0/src/sonicproof/judge.py +411 -0
  15. sonicproof-0.1.0/src/sonicproof/library.py +669 -0
  16. sonicproof-0.1.0/src/sonicproof/mcp_server.py +186 -0
  17. sonicproof-0.1.0/src/sonicproof/model.py +284 -0
  18. sonicproof-0.1.0/src/sonicproof/qc.py +530 -0
  19. sonicproof-0.1.0/src/sonicproof/server.py +1231 -0
  20. sonicproof-0.1.0/src/sonicproof/service.py +505 -0
  21. sonicproof-0.1.0/src/sonicproof/skill/SKILL.md +117 -0
  22. sonicproof-0.1.0/src/sonicproof/thumbs.py +82 -0
  23. sonicproof-0.1.0/src/sonicproof/visual.py +166 -0
  24. sonicproof-0.1.0/src/sonicproof/vocab.py +494 -0
  25. sonicproof-0.1.0/src/sonicproof/web/assets/index-CiLt6BfN.css +1 -0
  26. sonicproof-0.1.0/src/sonicproof/web/assets/index-j8h5oOAC.js +3 -0
  27. sonicproof-0.1.0/src/sonicproof/web/index.html +15 -0
  28. sonicproof-0.1.0/tests/test_audio.py +175 -0
  29. sonicproof-0.1.0/tests/test_cache.py +91 -0
  30. sonicproof-0.1.0/tests/test_cli.py +202 -0
  31. sonicproof-0.1.0/tests/test_judge.py +150 -0
  32. sonicproof-0.1.0/tests/test_library.py +427 -0
  33. sonicproof-0.1.0/tests/test_mcp.py +103 -0
  34. sonicproof-0.1.0/tests/test_model.py +117 -0
  35. sonicproof-0.1.0/tests/test_qc.py +259 -0
  36. sonicproof-0.1.0/tests/test_security.py +279 -0
  37. sonicproof-0.1.0/tests/test_server.py +452 -0
  38. sonicproof-0.1.0/tests/test_service.py +194 -0
  39. sonicproof-0.1.0/tests/test_thumbs.py +50 -0
  40. sonicproof-0.1.0/tests/test_visual.py +101 -0
  41. sonicproof-0.1.0/web/index.html +14 -0
  42. sonicproof-0.1.0/web/package-lock.json +1137 -0
  43. sonicproof-0.1.0/web/package.json +15 -0
  44. sonicproof-0.1.0/web/src/api.ts +344 -0
  45. sonicproof-0.1.0/web/src/dom.ts +114 -0
  46. sonicproof-0.1.0/web/src/drop.ts +90 -0
  47. sonicproof-0.1.0/web/src/i18n/en.ts +435 -0
  48. sonicproof-0.1.0/web/src/i18n/index.ts +128 -0
  49. sonicproof-0.1.0/web/src/i18n/ja.ts +435 -0
  50. sonicproof-0.1.0/web/src/i18n/vocab.ja.json +455 -0
  51. sonicproof-0.1.0/web/src/main.ts +266 -0
  52. sonicproof-0.1.0/web/src/store.ts +130 -0
  53. sonicproof-0.1.0/web/src/style.css +1826 -0
  54. sonicproof-0.1.0/web/src/views/common.ts +201 -0
  55. sonicproof-0.1.0/web/src/views/inbox.ts +453 -0
  56. sonicproof-0.1.0/web/src/views/library.ts +482 -0
  57. sonicproof-0.1.0/web/src/views/picture.ts +308 -0
  58. sonicproof-0.1.0/web/src/viz.ts +376 -0
  59. sonicproof-0.1.0/web/tsconfig.json +16 -0
  60. sonicproof-0.1.0/web/vite.config.ts +16 -0
@@ -0,0 +1,30 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ .venv/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ .mypy_cache/
11
+
12
+ # Models / media / outputs (never commit)
13
+ .cache/
14
+ samples/
15
+ out/
16
+ *.wav
17
+ *.flac
18
+ *.mp3
19
+ *.ogg
20
+ *.mp4
21
+ !tests/fixtures/**
22
+
23
+ # OS / runtime
24
+ .DS_Store
25
+ Thumbs.db
26
+ .claude/
27
+
28
+ # Web UI sources (the build in src/sonicproof/web is shipped)
29
+ web/node_modules/
30
+
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,18 @@
1
+ Sonicproof
2
+ Copyright 2026 Sonicproof contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ Reference bank
7
+ --------------
8
+ src/sonicproof/data/refbank.npz contains embeddings computed with Google's
9
+ EmbeddingGemma 2 from short clips generated with Stable Audio 3 Medium.
10
+ No audio is included, only the embeddings and short text titles.
11
+
12
+ Model
13
+ -----
14
+ The EmbeddingGemma 2 model (google/embeddinggemma-2) is not bundled with
15
+ Sonicproof. It is downloaded from Hugging Face on first run. The model is
16
+ released by Google under the Apache License, Version 2.0; its model card asks
17
+ that deployments follow the Gemma Prohibited Use Policy:
18
+ https://ai.google.dev/gemma/prohibited_use_policy
@@ -0,0 +1,341 @@
1
+ Metadata-Version: 2.5
2
+ Name: sonicproof
3
+ Version: 0.1.0
4
+ Summary: The audio QA layer for generative audio — check, rank and QC AI-generated sound with EmbeddingGemma 2.
5
+ Project-URL: Homepage, https://github.com/kanaworksai-hue/sonicproof
6
+ Project-URL: Repository, https://github.com/kanaworksai-hue/sonicproof
7
+ Project-URL: Issues, https://github.com/kanaworksai-hue/sonicproof/issues
8
+ Project-URL: Changelog, https://github.com/kanaworksai-hue/sonicproof/releases
9
+ Author: Sonicproof contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: audio,audio-qa,embeddinggemma,embeddings,generative-audio,loudness,mcp,sound-effects,sound-library,stable-audio
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
24
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: fastapi>=0.115
27
+ Requires-Dist: mcp>=2.3
28
+ Requires-Dist: numpy>=2.1
29
+ Requires-Dist: pyloudnorm>=0.1.1
30
+ Requires-Dist: python-multipart>=0.0.9
31
+ Requires-Dist: rich>=13
32
+ Requires-Dist: scipy>=1.11
33
+ Requires-Dist: soundfile>=0.12
34
+ Requires-Dist: typer>=0.12
35
+ Requires-Dist: uvicorn>=0.30
36
+ Provides-Extra: model
37
+ Requires-Dist: sentence-transformers[image]>=6.1; extra == 'model'
38
+ Requires-Dist: torch>=2.6; extra == 'model'
39
+ Requires-Dist: transformers<6,>=5; extra == 'model'
40
+ Description-Content-Type: text/markdown
41
+
42
+ # Sonicproof
43
+
44
+ **Does your AI-generated sound match what you asked for?**
45
+
46
+ Sonicproof is a local QA tool for generative audio — sound effects, music and ambience from Stable Audio and
47
+ friends. It listens with one multilingual model, Google's
48
+ [EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2), which puts text, sound, images and video in
49
+ one shared space:
50
+
51
+ - **check** — does this clip sound like the prompt? Prompts can be English, 中文, 日本語 or any other language.
52
+ - **rank** — you generated four seeds; which one should you keep?
53
+ - **qc** — is it technically clean? Loudness, true peak, clipping, DC, silence, cut-off tails, clicks, phase,
54
+ loop seams — with a one-line fix for every problem.
55
+ - **fit** — does this sound suit the picture? A frame, a piece of concept art, a video clip, or a video's own
56
+ soundtrack.
57
+ - **search** — find sounds in your own library by words (any language), by example, or by picture.
58
+ - **dedupe** — find the re-encoded, re-levelled and trimmed copies cluttering your library, and which one to keep.
59
+
60
+ Everything runs on your machine. No uploads, no API keys. Use it three ways:
61
+
62
+ - **Workbench** — `sonicproof serve` opens a local web app: drop files in, see waveforms, spectrograms,
63
+ scores and one-line fixes. English and 日本語.
64
+ - **Agents** — an MCP server and an agent skill, so Claude Code, Codex and friends can listen to what they
65
+ generate. See [Use it from your AI agent](#use-it-from-your-ai-agent).
66
+ - **CLI / Python** — every analysis command has `--json`.
67
+
68
+ ![The Sonicproof workbench: generated takes grouped by prompt, the best take of each group marked “Use this one”](https://raw.githubusercontent.com/kanaworksai-hue/sonicproof/main/docs/images/workbench.jpg)
69
+
70
+ ```text
71
+ $ sp check dog_bark.wav "狗在叫" # output trimmed: 3 of the 5 "Heard as" lines
72
+ ╭─ dog_bark.wav ─────────────────────────────────────────────────────╮
73
+ │ │
74
+ │ STRONG +2.97σ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━ │
75
+ │ clearly sounds like the prompt │
76
+ │ │
77
+ │ prompt “狗在叫” │
78
+ │ ranking #2 of 438 descriptions for this clip │
79
+ │ evidence cos 0.736 · clip-side +3.19σ · prompt-side +2.74σ │
80
+ │ │
81
+ │ Heard as │
82
+ │ +3.24σ a dog barking ✓ animals │
83
+ │ +2.85σ a dog whining ✓ animals │
84
+ │ +2.69σ a dog growling ✓ animals │
85
+ │ │
86
+ ╰────────────────────────────────────────────────────────────────────╯
87
+ ```
88
+
89
+ ## Install
90
+
91
+ ```bash
92
+ uv tool install "sonicproof[model]" # or: pip install "sonicproof[model]"
93
+ sonicproof doctor --load # first run downloads the model once (~1.5 GB)
94
+ ```
95
+
96
+ Until the first release, install from source: `git clone https://github.com/kanaworksai-hue/sonicproof`, run
97
+ `uv sync --extra model` inside it,
98
+ and run commands with `uv run sp …` (or `uv run --project /path/to/sonicproof sp …` from any other folder).
99
+
100
+ - **Python 3.11+.** Apple Silicon (MPS), CUDA and CPU all work. `sp` is a short alias for `sonicproof`.
101
+ - **The model** — [EmbeddingGemma 2](https://huggingface.co/google/embeddinggemma-2), about 1.5 GB — is
102
+ downloaded from Hugging Face into its usual cache on first use. No Hugging Face account or token is needed.
103
+ - **ffmpeg** is only needed for M4A / AAC / MP4 and other formats libsndfile can't read, and for video in
104
+ `fit` / `search`. WAV, FLAC, OGG and MP3 work without it.
105
+ - **Windows + NVIDIA GPU:** the PyPI build of PyTorch for Windows is CPU-only. Install PyTorch with CUDA first,
106
+ following [pytorch.org](https://pytorch.org/get-started/locally/), then install Sonicproof.
107
+ - `qc` needs no model at all: `pip install sonicproof` (without `[model]`) is enough for technical checks.
108
+
109
+ ## Use
110
+
111
+ ```bash
112
+ # Prompt adherence. Omit the prompt to read it from a Stable Audio .json sidecar.
113
+ sp check explosion.wav "a huge explosion with debris"
114
+ sp check door_v2.wav "木の扉がきしみながら開く"
115
+ sp check thunder.wav
116
+
117
+ # Pick the best take
118
+ sp rank "a wooden door creaking open" door_v1.wav door_v2.wav door_v3.wav door_v4.wav
119
+
120
+ # Technical checks (no model needed). Exit code 1 if anything fails — handy in scripts.
121
+ sp qc *.wav
122
+ sp qc ambience_loop.wav --loop --target-lufs -16
123
+
124
+ # Everything in one scorecard: SHIP / REVIEW / REDO. --strict exits 1 unless it is SHIP.
125
+ sp report footsteps.wav "footsteps on gravel"
126
+ sp report footsteps.wav "footsteps on gravel" --strict
127
+
128
+ # Does the sound suit the picture? Words about the scene are optional, any language.
129
+ sp fit sizzle.wav --image kitchen.png
130
+ sp fit rumble.wav --video storm.mp4 "暴风雨夜,雷声"
131
+ sp fit trailer.mp4 # a video's own soundtrack against its own picture
132
+ ```
133
+
134
+ ### Your sound library
135
+
136
+ ```bash
137
+ sp index ~/SFX # once; re-runs only read new or changed files
138
+ sp search "rain on a tin roof" --in ~/SFX
139
+ sp search "木の床を歩く足音" --in ~/SFX
140
+ sp search --like take_03.wav --in ~/SFX # sounds like this one
141
+ sp search --image frame.png --in ~/SFX # sounds that suit this picture
142
+ sp dedupe ~/SFX # duplicates and near-duplicates (nothing is deleted)
143
+ ```
144
+
145
+ The library folder is always given explicitly: `index DIR`, `search … --in DIR`, `dedupe DIR` (your home
146
+ folder or a drive root are refused — point at the folder that holds your sounds).
147
+ The index lives in `~/SFX/.sonicproof/` (use `--in-cache` to keep it in `~/.cache/sonicproof` instead, e.g. for
148
+ read-only folders). `search` and `dedupe` bring it up to date on the fly, so `sp index` is optional.
149
+ The workbench always keeps its indexes in the cache, so opening a folder there never writes into it.
150
+
151
+ ### Scripting: `--json` and exit codes
152
+
153
+ The analysis commands — `check`, `rank`, `qc`, `report`, `fit`, `index`, `search`, `dedupe` — take `--json` for scripts and agents (`doctor`, `serve`, `mcp` and `skill` are for people). `qc --json` always prints an array, one record per file,
154
+ even for a single file. A file that can't be read gets `"status": "error"` in that array and the rest are
155
+ still checked.
156
+
157
+ | Exit code | Meaning |
158
+ |---|---|
159
+ | `0` | Done. `check` / `rank` / `fit` exit 0 whatever the verdict — read the verdict. |
160
+ | `1` | `qc` found a failure, or `report --strict` did not say SHIP. |
161
+ | `2` | A problem with the input: missing or unreadable file, empty audio, bad option value. |
162
+ | `3` | A problem with the setup: model extra not installed, model not downloaded and offline, ffmpeg needed, port busy. |
163
+
164
+ With `--json`, errors are JSON too — `{"error": {"code": "not_found", "message": "…", "file": "…"}}` on stdout
165
+ — so a script never has to parse a traceback. Set `SONICPROOF_DEBUG=1` to see the full traceback.
166
+
167
+ Silent clips (nothing above −60 dBFS) are never scored as a match: `check`, `rank`, `fit` and `search` give
168
+ them `"verdict": "miss"` with `"note": "silent"` and rank them last. Short one-shots such as UI clicks are
169
+ judged normally.
170
+
171
+ ## Workbench
172
+
173
+ ```bash
174
+ sonicproof serve # opens http://localhost:7788
175
+ ```
176
+
177
+ - **Inbox** — drop audio files or whole folders. Prompts are read from Stable Audio `.json` sidecars (or type
178
+ your own, in any language). Takes of the same prompt are grouped, ranked, and the best one is marked
179
+ **Use this one**. When nothing in a group sounds right, it says so and suggests a wording to try next.
180
+ Each card shows the waveform over a spectrogram, a plain verdict (◎ Very close · ○ Close · △ Somewhat ·
181
+ ✕ Not a match), a 0–100 match bar and a dot per technical check; technical findings are spelled out in
182
+ plain words with the fix.
183
+ - **Library** — choose a folder, index it (with progress), then search by words, by dropping a sound, or by
184
+ picture. The **Duplicates** tab lists copies and which one to keep (nothing is deleted).
185
+ - **Picture** — drop an image or a video: see what it shows in sound words, score your Inbox sounds against
186
+ it, find matching sounds in your library, or judge a video's own soundtrack.
187
+
188
+ The raw numbers (σ scores, cosines, every measurement) are one click away under **Details**, or everywhere
189
+ with **Settings → Pro mode**. Settings also shows how much the cache uses and clears it; removing files from the
190
+ Inbox deletes the copies made when they were dropped (your originals are never touched).
191
+
192
+ The language follows your browser and can be switched (English / 日本語). Sound only plays when you press play.
193
+ The server listens on `localhost` only and refuses requests from other sites.
194
+
195
+ ![The workbench in Japanese](https://raw.githubusercontent.com/kanaworksai-hue/sonicproof/main/docs/images/workbench-ja.jpg)
196
+
197
+ ## Use it from your AI agent
198
+
199
+ The quickest way: give your agent the link to this repository (or the skill below) and ask it to check the
200
+ sounds it generates. Everything it needs is in this section.
201
+
202
+ **1. Download the model once, in a terminal.** The MCP server never starts a 1.5 GB download inside a tool
203
+ call (it would look like a hang); it asks you to run this instead:
204
+
205
+ ```bash
206
+ uvx --from "sonicproof[model]" sonicproof doctor --load
207
+ ```
208
+
209
+ **2. Add the MCP server** — tools `check`, `rank`, `qc`, `report`, `fit`, `search`, `dedupe`, `index`. Each returns
210
+ the same records the matching CLI command prints with `--json`. The model loads once and stays loaded.
211
+
212
+ ```bash
213
+ # Claude Code
214
+ claude mcp add sonicproof -e HF_HOME="${HF_HOME:-$HOME/.cache/huggingface}" -- uvx --from "sonicproof[model]" sonicproof mcp
215
+ # Codex
216
+ codex mcp add sonicproof --env HF_HOME="${HF_HOME:-$HOME/.cache/huggingface}" -- uvx --from "sonicproof[model]" sonicproof mcp
217
+ # any client: streamable HTTP at http://127.0.0.1:7789/mcp
218
+ sonicproof mcp --http --port 7789
219
+ ```
220
+
221
+ Other clients take the same command in their JSON config (write out the absolute path of your cache):
222
+
223
+ ```json
224
+ { "mcpServers": { "sonicproof": {
225
+ "command": "uvx", "args": ["--from", "sonicproof[model]", "sonicproof", "mcp"],
226
+ "env": { "HF_HOME": "/Users/you/.cache/huggingface" } } } }
227
+ ```
228
+
229
+ - **Why `HF_HOME`:** MCP clients start servers with a reduced environment. Passing it makes the server use
230
+ the same Hugging Face cache as your terminal, so the model is not downloaded a second time.
231
+ - **Use absolute paths** in tool calls. A relative path resolves against the server's working directory, which
232
+ is usually not yours.
233
+ - **HTTP mode** listens on `127.0.0.1` only and refuses requests from web pages on other sites, but it has no
234
+ authentication: any process on your machine can call it. Use stdio when that matters.
235
+ - **Before the PyPI release**, run from a clone: `uv sync --extra model` inside it, then use
236
+ `uv run --project /absolute/path/to/sonicproof --extra model sonicproof mcp` as the server command
237
+ (`--project` keeps the caller's working directory; `--directory` would change it).
238
+
239
+ **If you are an agent reading this repository:** install with `uv tool install "sonicproof[model]"` (or
240
+ `uv sync --extra model` inside a clone and prefix commands with `uv run --project /absolute/path/to/sonicproof`),
241
+ run `sonicproof doctor --load` once, then follow the skill (`sp skill show` prints it). Without MCP, every
242
+ analysis command works from the shell with `--json` — `sp rank "prompt" a.wav b.wav --json`,
243
+ `sp report take.wav "prompt" --json`, `sp qc *.wav --json`. Pass absolute local file paths; never play audio
244
+ to "listen" — Sonicproof is your ears.
245
+
246
+ **Agent skill** — the skill teaches an agent the loop that makes generated audio trustworthy: *generate
247
+ several takes → rank them → check the best one → rephrase or reseed when nothing matches → deliver the pick
248
+ with its scorecard*. It ships with the package:
249
+
250
+ ```bash
251
+ sp skill install # → ~/.claude/skills/sonicproof/SKILL.md
252
+ sp skill install --project # → ./.claude/skills/sonicproof/SKILL.md (this project only)
253
+ sp skill show # print it, for agents that read skills from elsewhere
254
+ ```
255
+
256
+ In a clone it lives at [`src/sonicproof/skill/SKILL.md`](https://github.com/kanaworksai-hue/sonicproof/blob/main/src/sonicproof/skill/SKILL.md).
257
+
258
+ [`examples/stable_audio_loop.py`](https://github.com/kanaworksai-hue/sonicproof/blob/main/examples/stable_audio_loop.py) runs the same loop as a script, with one MCP
259
+ client for a Stable Audio server and one for Sonicproof.
260
+
261
+ ## How to read a score
262
+
263
+ Raw similarity between a prompt and a clip is not very informative — almost any caption scores about the same
264
+ against any clip. Sonicproof turns it into a **calibrated score in σ** by asking two relative questions:
265
+
266
+ 1. **Clip side** — compared with ~440 everyday sound descriptions, how well does *your prompt* describe *this clip*?
267
+ 2. **Prompt side** — compared with a bank of 110 reference sounds, how much closer is *this clip* to *your prompt*?
268
+
269
+ The two are averaged:
270
+
271
+ | Verdict | Score | Meaning |
272
+ |---|---|---|
273
+ | **strong** | ≥ 2.0σ | clearly sounds like the prompt |
274
+ | **plausible** | ≥ 1.1σ | sounds like the prompt |
275
+ | **weak** | ≥ 0.3σ | only loosely matches |
276
+ | **miss** | < 0.3σ | does not sound like the prompt |
277
+
278
+ **Heard as** lists what the clip sounds most like; ✓ marks descriptions that agree with your prompt. When a
279
+ verdict surprises you, that list usually explains why.
280
+
281
+ ### fit
282
+
283
+ `fit` weighs two pieces of evidence, both calibrated the same way and read on the same verdict scale:
284
+
285
+ - **direct** — how much closer is the picture to *this clip* than to the reference sounds?
286
+ - **described** — the picture is first described in words (**Pictured as**), and the clip is checked against
287
+ those descriptions as if they were the prompt. Add your own words about the scene and they count too.
288
+
289
+ **Pictured as** marks with ✓ what the clip also sounds like; **Heard as** marks what the picture also shows.
290
+ When the fit is weak, Sonicproof suggests a prompt drawn from the picture — useful for regenerating.
291
+ Videos are sampled at one frame per second (up to 32 frames, spread evenly over longer clips).
292
+
293
+ ### dedupe
294
+
295
+ Two sounds can be close in meaning without being the same file — four seeds of the same prompt, say.
296
+ `dedupe` therefore uses the embeddings only to find candidates, then compares the signals themselves
297
+ (time-aligned spectral fingerprints), so it groups copies that differ in format, codec, level, sample rate,
298
+ channel count or trimmed ends, and leaves different takes alone. In each group it keeps the best copy —
299
+ lossless over lossy, not clipped, higher sample rate, more channels, longest — and says why.
300
+
301
+ Sonicproof is a second opinion, not a judge: short, concrete prompts ("glass shattering") work better than long
302
+ ones full of mixing notes, and very short transient sounds are the hardest to tell apart. Always listen
303
+ before you ship.
304
+
305
+ ## Python
306
+
307
+ ```python
308
+ from sonicproof.judge import Judge
309
+
310
+ judge = Judge(vision=True) # one model for everything; Judge() alone is lighter but can't see pictures
311
+ result = judge.check("door.wav", "a creaky wooden door")
312
+ print(result.verdict, result.score, [a.text for a in result.heard_as])
313
+
314
+ fit = judge.fit("sizzle.wav", "kitchen.png", "image")
315
+ print(fit.verdict, [a.text for a in fit.pictured_as])
316
+
317
+ from sonicproof.library import Library, find_duplicates, search_text
318
+
319
+ lib = Library("~/SFX")
320
+ lib.update(lambda wave: judge.embedder.embed_audio([wave])[0])
321
+ for hit in search_text(lib, judge, "rain on a tin roof"):
322
+ print(hit.path, hit.score, hit.verdict)
323
+ ```
324
+
325
+ ## Development
326
+
327
+ ```bash
328
+ uv sync --extra model --group dev && uv run pytest
329
+ cd web && npm ci && npm run dev # UI with hot reload; proxies /api to `sp serve` on :7788
330
+ npm run build # writes the bundled UI into src/sonicproof/web
331
+ ```
332
+
333
+ UI strings live in `web/src/i18n/` (`en.ts`, `ja.ts`); the type checker makes sure both have the same keys.
334
+ See [CONTRIBUTING.md](https://github.com/kanaworksai-hue/sonicproof/blob/main/CONTRIBUTING.md) for tests, linting and pull requests.
335
+
336
+ ## License
337
+
338
+ Sonicproof is licensed under the [Apache License 2.0](https://github.com/kanaworksai-hue/sonicproof/blob/main/LICENSE) (see also [NOTICE](https://github.com/kanaworksai-hue/sonicproof/blob/main/NOTICE)). It downloads
339
+ EmbeddingGemma 2 from Hugging Face on first run — the model is not bundled. The model is released by Google
340
+ under Apache 2.0, and its model card asks that deployments follow the
341
+ [Gemma Prohibited Use Policy](https://ai.google.dev/gemma/prohibited_use_policy).