Spaces:
Sleeping
Sleeping
Adam Copeland commited on
Commit ·
aff6f3d
1
Parent(s): 96ea016
push
Browse files- .gitignore +4 -2
- README.md +1 -1
- scripts/__pycache__/e2e_smoke.cpython-313.pyc +0 -0
- scripts/__pycache__/e2e_smoke.cpython-314.pyc +0 -0
- scripts/e2e_smoke.py +45 -0
- test_assets/README.md +2 -2
.gitignore
CHANGED
|
@@ -1,2 +1,4 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
|
|
|
|
|
| 1 |
+
verification_outputs/
|
| 2 |
+
test_assets/*.wav
|
| 3 |
+
__pycache__/
|
| 4 |
+
*.pyc
|
README.md
CHANGED
|
@@ -39,7 +39,7 @@ The UI exposes three explicit inference runtime modes:
|
|
| 39 |
|
| 40 |
## E2E Smoke Test
|
| 41 |
|
| 42 |
-
A small reproducible test sample is
|
| 43 |
|
| 44 |
Run one-file smoke tests across all runtime modes and write file-backed artifacts:
|
| 45 |
|
|
|
|
| 39 |
|
| 40 |
## E2E Smoke Test
|
| 41 |
|
| 42 |
+
A small reproducible test sample is generated on demand at `test_assets/public_domain_tone.wav`.
|
| 43 |
|
| 44 |
Run one-file smoke tests across all runtime modes and write file-backed artifacts:
|
| 45 |
|
scripts/__pycache__/e2e_smoke.cpython-313.pyc
DELETED
|
Binary file (7.2 kB)
|
|
|
scripts/__pycache__/e2e_smoke.cpython-314.pyc
DELETED
|
Binary file (7.49 kB)
|
|
|
scripts/e2e_smoke.py
CHANGED
|
@@ -1,7 +1,10 @@
|
|
| 1 |
import argparse
|
|
|
|
| 2 |
import os
|
|
|
|
| 3 |
import sys
|
| 4 |
import time
|
|
|
|
| 5 |
from datetime import datetime, timezone
|
| 6 |
|
| 7 |
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
@@ -20,6 +23,45 @@ def _slug(text):
|
|
| 20 |
return text.lower().replace(" + ", "_plus_").replace(" ", "_")
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
def run_mode(audio_path, extraction_mode, inference_mode, out_dir):
|
| 24 |
started = time.time()
|
| 25 |
print(f"[start] mode={inference_mode}", flush=True)
|
|
@@ -101,6 +143,9 @@ def main():
|
|
| 101 |
if os.path.exists(repo_relative):
|
| 102 |
audio_path = repo_relative
|
| 103 |
|
|
|
|
|
|
|
|
|
|
| 104 |
if not os.path.exists(audio_path):
|
| 105 |
raise SystemExit(f"Audio file not found: {audio_path}")
|
| 106 |
|
|
|
|
| 1 |
import argparse
|
| 2 |
+
import math
|
| 3 |
import os
|
| 4 |
+
import struct
|
| 5 |
import sys
|
| 6 |
import time
|
| 7 |
+
import wave
|
| 8 |
from datetime import datetime, timezone
|
| 9 |
|
| 10 |
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
| 23 |
return text.lower().replace(" + ", "_plus_").replace(" ", "_")
|
| 24 |
|
| 25 |
|
| 26 |
+
def _ensure_synthetic_sample(audio_path):
|
| 27 |
+
if os.path.exists(audio_path):
|
| 28 |
+
return
|
| 29 |
+
|
| 30 |
+
if os.path.basename(audio_path) != "public_domain_tone.wav":
|
| 31 |
+
return
|
| 32 |
+
|
| 33 |
+
os.makedirs(os.path.dirname(audio_path), exist_ok=True)
|
| 34 |
+
sample_rate = 22050
|
| 35 |
+
segment_sec = 2.0
|
| 36 |
+
progression = [
|
| 37 |
+
(261.63, 329.63, 392.00),
|
| 38 |
+
(293.66, 369.99, 440.00),
|
| 39 |
+
(349.23, 440.00, 523.25),
|
| 40 |
+
(392.00, 493.88, 587.33),
|
| 41 |
+
]
|
| 42 |
+
|
| 43 |
+
frames = []
|
| 44 |
+
for chord in progression:
|
| 45 |
+
total = int(segment_sec * sample_rate)
|
| 46 |
+
for i in range(total):
|
| 47 |
+
t = i / sample_rate
|
| 48 |
+
attack = min(1.0, i / (0.05 * sample_rate))
|
| 49 |
+
release = min(1.0, (total - i) / (0.05 * sample_rate))
|
| 50 |
+
envelope = attack * release
|
| 51 |
+
mixed = 0.0
|
| 52 |
+
for freq in chord:
|
| 53 |
+
mixed += math.sin(2.0 * math.pi * freq * t)
|
| 54 |
+
mixed = (mixed / len(chord)) * 0.35 * envelope
|
| 55 |
+
sample = int(max(-1.0, min(1.0, mixed)) * 32767)
|
| 56 |
+
frames.append(struct.pack("<h", sample))
|
| 57 |
+
|
| 58 |
+
with wave.open(audio_path, "wb") as wf:
|
| 59 |
+
wf.setnchannels(1)
|
| 60 |
+
wf.setsampwidth(2)
|
| 61 |
+
wf.setframerate(sample_rate)
|
| 62 |
+
wf.writeframes(b"".join(frames))
|
| 63 |
+
|
| 64 |
+
|
| 65 |
def run_mode(audio_path, extraction_mode, inference_mode, out_dir):
|
| 66 |
started = time.time()
|
| 67 |
print(f"[start] mode={inference_mode}", flush=True)
|
|
|
|
| 143 |
if os.path.exists(repo_relative):
|
| 144 |
audio_path = repo_relative
|
| 145 |
|
| 146 |
+
if not os.path.exists(audio_path):
|
| 147 |
+
_ensure_synthetic_sample(audio_path)
|
| 148 |
+
|
| 149 |
if not os.path.exists(audio_path):
|
| 150 |
raise SystemExit(f"Audio file not found: {audio_path}")
|
| 151 |
|
test_assets/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
# Test Assets
|
| 2 |
|
| 3 |
-
- `public_domain_tone.wav`
|
| 4 |
-
- Rights:
|
|
|
|
| 1 |
# Test Assets
|
| 2 |
|
| 3 |
+
- `public_domain_tone.wav` is generated on demand by `scripts/e2e_smoke.py` if missing.
|
| 4 |
+
- Rights: generated in-repo from synthesized sine tones (no third-party copyrighted source audio).
|