Spaces:
Running on Zero
Running on Zero
Codex commited on
Commit ·
0382000
1
Parent(s): 4d5c08f
Clarify network semantic pause boundaries
Browse files- app.py +7 -1
- tests/test_release_pins.py +2 -1
app.py
CHANGED
|
@@ -137,6 +137,7 @@ NETWORK_REQUEST_ORDINARY_MAX_UNITS = 36
|
|
| 137 |
NETWORK_INTERNAL_FADE_MS = 5.0
|
| 138 |
NETWORK_INTERNAL_SILENCE_MS = 400.0
|
| 139 |
SEMANTIC_CHUNK_MIN_SILENCE_MS = 250.0
|
|
|
|
| 140 |
STOP_THRESHOLD = 0.50
|
| 141 |
STOP_LATE_THRESHOLD = 0.05
|
| 142 |
STOP_LATE_START_RATIO = 0.75
|
|
@@ -977,6 +978,11 @@ def _assemble_trajectory_audio(
|
|
| 977 |
):
|
| 978 |
raise ValueError("network boundary lacks shared identifier proof")
|
| 979 |
audio_chunks = [np.asarray(audio, dtype=np.float32).copy() for audio in trajectory]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 980 |
pauses: list[int] = []
|
| 981 |
fades_ms: list[float] = []
|
| 982 |
crossfades_ms: list[float] = []
|
|
@@ -997,7 +1003,7 @@ def _assemble_trajectory_audio(
|
|
| 997 |
if network_internal
|
| 998 |
else max(
|
| 999 |
punctuation_pause_seconds(chunk),
|
| 1000 |
-
|
| 1001 |
)
|
| 1002 |
)
|
| 1003 |
pauses.append(int(round(pause_seconds * SR)))
|
|
|
|
| 137 |
NETWORK_INTERNAL_FADE_MS = 5.0
|
| 138 |
NETWORK_INTERNAL_SILENCE_MS = 400.0
|
| 139 |
SEMANTIC_CHUNK_MIN_SILENCE_MS = 250.0
|
| 140 |
+
NETWORK_REQUEST_SEMANTIC_CHUNK_MIN_SILENCE_MS = 350.0
|
| 141 |
STOP_THRESHOLD = 0.50
|
| 142 |
STOP_LATE_THRESHOLD = 0.05
|
| 143 |
STOP_LATE_START_RATIO = 0.75
|
|
|
|
| 978 |
):
|
| 979 |
raise ValueError("network boundary lacks shared identifier proof")
|
| 980 |
audio_chunks = [np.asarray(audio, dtype=np.float32).copy() for audio in trajectory]
|
| 981 |
+
semantic_min_silence_ms = (
|
| 982 |
+
NETWORK_REQUEST_SEMANTIC_CHUNK_MIN_SILENCE_MS
|
| 983 |
+
if chunk_specs is not None and any(spec.network_conditioned for spec in chunk_specs)
|
| 984 |
+
else SEMANTIC_CHUNK_MIN_SILENCE_MS
|
| 985 |
+
)
|
| 986 |
pauses: list[int] = []
|
| 987 |
fades_ms: list[float] = []
|
| 988 |
crossfades_ms: list[float] = []
|
|
|
|
| 1003 |
if network_internal
|
| 1004 |
else max(
|
| 1005 |
punctuation_pause_seconds(chunk),
|
| 1006 |
+
semantic_min_silence_ms / 1000.0,
|
| 1007 |
)
|
| 1008 |
)
|
| 1009 |
pauses.append(int(round(pause_seconds * SR)))
|
tests/test_release_pins.py
CHANGED
|
@@ -387,12 +387,13 @@ def test_app_rejects_silent_text_and_coalesces_before_runtime_budgeting():
|
|
| 387 |
assert "NETWORK_INTERNAL_FADE_MS = 5.0" in source
|
| 388 |
assert "NETWORK_INTERNAL_SILENCE_MS = 400.0" in source
|
| 389 |
assert "SEMANTIC_CHUNK_MIN_SILENCE_MS = 250.0" in source
|
|
|
|
| 390 |
assert 'chunk_specs[index].boundary_after == "network_internal"' in (
|
| 391 |
assemble_source
|
| 392 |
)
|
| 393 |
assert "NETWORK_INTERNAL_SILENCE_MS / 1000.0" in assemble_source
|
| 394 |
assert "punctuation_pause_seconds(chunk)" in assemble_source
|
| 395 |
-
assert "
|
| 396 |
assert "pauses.append(int(round(pause_seconds * SR)))" in assemble_source
|
| 397 |
assert "join_audio_chunks_variable(" in assemble_source
|
| 398 |
assert "network_conditioned=network_flags" in synthesize_source
|
|
|
|
| 387 |
assert "NETWORK_INTERNAL_FADE_MS = 5.0" in source
|
| 388 |
assert "NETWORK_INTERNAL_SILENCE_MS = 400.0" in source
|
| 389 |
assert "SEMANTIC_CHUNK_MIN_SILENCE_MS = 250.0" in source
|
| 390 |
+
assert "NETWORK_REQUEST_SEMANTIC_CHUNK_MIN_SILENCE_MS = 350.0" in source
|
| 391 |
assert 'chunk_specs[index].boundary_after == "network_internal"' in (
|
| 392 |
assemble_source
|
| 393 |
)
|
| 394 |
assert "NETWORK_INTERNAL_SILENCE_MS / 1000.0" in assemble_source
|
| 395 |
assert "punctuation_pause_seconds(chunk)" in assemble_source
|
| 396 |
+
assert "semantic_min_silence_ms / 1000.0" in assemble_source
|
| 397 |
assert "pauses.append(int(round(pause_seconds * SR)))" in assemble_source
|
| 398 |
assert "join_audio_chunks_variable(" in assemble_source
|
| 399 |
assert "network_conditioned=network_flags" in synthesize_source
|