braidio 0.0.75__tar.gz → 0.0.77__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.
- {braidio-0.0.75 → braidio-0.0.77}/PKG-INFO +1 -1
- {braidio-0.0.75 → braidio-0.0.77}/braidio/bodies/_domain.py +9 -4
- {braidio-0.0.75 → braidio-0.0.77}/braidio/delivery.py +13 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/tools.py +1 -1
- {braidio-0.0.75 → braidio-0.0.77}/braidio/render.py +20 -13
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/__init__.py +27 -1
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_common.py +5 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_episode.py +7 -13
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_ingest.py +1 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_narration.py +81 -17
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_voice.py +6 -6
- {braidio-0.0.75 → braidio-0.0.77}/braidio/weave_config.py +13 -5
- {braidio-0.0.75 → braidio-0.0.77}/pyproject.toml +1 -1
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_body_schema_stability.py +1 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_pacing.py +52 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms.py +5 -1
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms_rights.py +45 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_turn_overlap.py +105 -2
- {braidio-0.0.75 → braidio-0.0.77}/.editorconfig +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/.gitattributes +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/.gitignore +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/LICENSE +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/README.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/_paths.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/bodies/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/bodies/_render_nodes.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/bodies/_tiers.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/captions.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/compose.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/conversation.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/cost.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/defaults.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/downloads.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/formats.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/genre.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/kinds.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/markdown_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/multivoice.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/music.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/pacing.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/project.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/provenance.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/relevance.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/rights.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/sources.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/style.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/textprep.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/timeline.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_asset_refs.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_video_cut.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/tts.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/voice_library.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/braidio/weave.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/conftest.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/README.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/_audio.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_conversation.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_cost.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_credits_card.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_defaults.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_delivery.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_downloads.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_formats.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_importing.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_mcp.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_media_auth.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_multivoice.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_music.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_nw_app.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_packaging.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_render_settings.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_sources.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_timeline.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_video_footage.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_video_transforms.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_voice_library.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_weave.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_weave_config.py +0 -0
- {braidio-0.0.75 → braidio-0.0.77}/tests/test_wire_descriptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: braidio
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.77
|
|
4
4
|
Summary: Weave narration with extracted media segments into audiovisual productions
|
|
5
5
|
Project-URL: Homepage, https://github.com/thorwhalen/braidio
|
|
6
6
|
Project-URL: Repository, https://github.com/thorwhalen/braidio
|
|
@@ -113,14 +113,19 @@ class NarrativeBeatBodyV1(BaseModel):
|
|
|
113
113
|
voice: Optional[str] = Field(
|
|
114
114
|
None, description="Per-beat voice id; overrides the weave-config pool."
|
|
115
115
|
)
|
|
116
|
+
voice_settings: Optional[dict] = Field(
|
|
117
|
+
None, description="Per-beat ElevenLabs voice settings; override the config's."
|
|
118
|
+
)
|
|
116
119
|
|
|
117
120
|
@model_serializer(mode="wrap")
|
|
118
121
|
def _omit_unset_voice(self, handler):
|
|
119
|
-
"""Leave ``voice`` out while unset, so a body written
|
|
120
|
-
existed is byte-identical on re-write (every writer,
|
|
122
|
+
"""Leave ``voice`` / ``voice_settings`` out while unset, so a body written
|
|
123
|
+
before the fields existed is byte-identical on re-write (every writer,
|
|
124
|
+
not one call site)."""
|
|
121
125
|
data = handler(self)
|
|
122
|
-
|
|
123
|
-
data.
|
|
126
|
+
for key in ("voice", "voice_settings"):
|
|
127
|
+
if data.get(key) is None:
|
|
128
|
+
data.pop(key, None)
|
|
124
129
|
return data
|
|
125
130
|
|
|
126
131
|
plays_clip: Optional[str] = Field(
|
|
@@ -16,6 +16,19 @@ from __future__ import annotations
|
|
|
16
16
|
from dataclasses import dataclass, field
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
#: Models that ignore ``voice_settings["speed"]`` (eleven v3 has no speed control).
|
|
20
|
+
SPEEDLESS_MODELS = frozenset({"eleven_v3"})
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def model_supports_speed(model_id: str) -> bool:
|
|
24
|
+
"""Whether ``model_id`` honors ``voice_settings["speed"]``.
|
|
25
|
+
|
|
26
|
+
>>> model_supports_speed("eleven_v3"), model_supports_speed("eleven_multilingual_v2")
|
|
27
|
+
(False, True)
|
|
28
|
+
"""
|
|
29
|
+
return model_id not in SPEEDLESS_MODELS
|
|
30
|
+
|
|
31
|
+
|
|
19
32
|
@dataclass(frozen=True)
|
|
20
33
|
class Delivery:
|
|
21
34
|
"""A named narration delivery: which model + voice settings to synthesize with."""
|
|
@@ -100,26 +100,28 @@ def _tail_gap(src: Path, dst: Path, *, gap_s: float) -> Path:
|
|
|
100
100
|
return dst
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def
|
|
103
|
+
def plan_beat_turns(
|
|
104
104
|
text: str,
|
|
105
105
|
*,
|
|
106
106
|
config: WeaveConfig | None,
|
|
107
|
-
|
|
107
|
+
supports_speed: bool,
|
|
108
108
|
settings: dict,
|
|
109
109
|
seed_offset: int,
|
|
110
110
|
) -> list[NarrationTurn]:
|
|
111
111
|
"""Plan one narration beat's turns, or ``[]`` for the unpaced single call.
|
|
112
112
|
|
|
113
|
-
The speed each turn is jittered around is the
|
|
113
|
+
The speed each turn is jittered around is the beat's own ``speed`` setting
|
|
114
114
|
when it sets one (so a grave ``v2-narrator``'s 0.94 survives being paced),
|
|
115
115
|
falling back to ``WeaveConfig.speed_base``. A model with no speed control
|
|
116
|
-
(eleven v3 — :attr:`braidio.delivery.Delivery.supports_speed
|
|
116
|
+
(eleven v3 — :attr:`braidio.delivery.Delivery.supports_speed`,
|
|
117
|
+
:func:`braidio.delivery.model_supports_speed`) plans none.
|
|
118
|
+
|
|
119
|
+
Shared by the fast path and the graph's ``narration_render.tts``, which is
|
|
120
|
+
what keeps their per-beat durations (and so their timelines) equal.
|
|
117
121
|
"""
|
|
118
122
|
if config is None or not config.paces_narration:
|
|
119
123
|
return []
|
|
120
|
-
speed_base = (
|
|
121
|
-
settings.get("speed", config.speed_base) if delivery.supports_speed else None
|
|
122
|
-
)
|
|
124
|
+
speed_base = settings.get("speed", config.speed_base) if supports_speed else None
|
|
123
125
|
return plan_turns(
|
|
124
126
|
text,
|
|
125
127
|
unit=config.segmentation_unit,
|
|
@@ -132,7 +134,7 @@ def _plan_beat_turns(
|
|
|
132
134
|
)
|
|
133
135
|
|
|
134
136
|
|
|
135
|
-
def
|
|
137
|
+
def narrate_turns(
|
|
136
138
|
turns: list[NarrationTurn],
|
|
137
139
|
*,
|
|
138
140
|
stem: Path,
|
|
@@ -140,6 +142,7 @@ def _narrate_turns(
|
|
|
140
142
|
voice_id: str | None,
|
|
141
143
|
model_id: str,
|
|
142
144
|
voice_settings: dict,
|
|
145
|
+
narrate_fn=None,
|
|
143
146
|
) -> Path:
|
|
144
147
|
"""Synthesize a paced narration beat: one TTS call per turn, real silence between.
|
|
145
148
|
|
|
@@ -147,13 +150,17 @@ def _narrate_turns(
|
|
|
147
150
|
varies (a fresh prosodic arc per turn, a per-turn speed where the model has
|
|
148
151
|
one) and the silence between turns is proportional to how strongly the
|
|
149
152
|
boundary closes, instead of one flat arc with nothing inside it.
|
|
153
|
+
|
|
154
|
+
``narrate_fn`` is the synthesis call (default: this module's ``narrate``);
|
|
155
|
+
a caller that wants the cache status, or a stub, passes its own.
|
|
150
156
|
"""
|
|
157
|
+
synthesize = narrate_fn or narrate
|
|
151
158
|
parts: list[Path] = []
|
|
152
159
|
for j, turn in enumerate(turns):
|
|
153
160
|
settings = dict(voice_settings)
|
|
154
161
|
if turn.speed is not None:
|
|
155
162
|
settings["speed"] = turn.speed
|
|
156
|
-
part =
|
|
163
|
+
part = synthesize(
|
|
157
164
|
turn.text,
|
|
158
165
|
stem.with_name(f"{stem.name}-turn{j:02d}.mp3"),
|
|
159
166
|
api_key=api_key,
|
|
@@ -375,15 +382,15 @@ def render_production(
|
|
|
375
382
|
)
|
|
376
383
|
# Intra-beat pacing — empty plan (the default `segmentation_unit=
|
|
377
384
|
# "beat"`) keeps the historical one-call-per-beat path untouched.
|
|
378
|
-
turns =
|
|
385
|
+
turns = plan_beat_turns(
|
|
379
386
|
pb.content,
|
|
380
387
|
config=config,
|
|
381
|
-
|
|
388
|
+
supports_speed=delivery.supports_speed,
|
|
382
389
|
settings=beat_settings,
|
|
383
|
-
seed_offset=
|
|
390
|
+
seed_offset=pb.from_index, # the script position, as the graph's beat_id
|
|
384
391
|
)
|
|
385
392
|
if turns:
|
|
386
|
-
raw =
|
|
393
|
+
raw = narrate_turns(
|
|
387
394
|
turns,
|
|
388
395
|
stem=beat_stem,
|
|
389
396
|
api_key=api_key,
|
|
@@ -38,6 +38,7 @@ from __future__ import annotations
|
|
|
38
38
|
from nw import TransformInputs
|
|
39
39
|
|
|
40
40
|
from braidio.transforms._common import ELEVENLABS_SECRET
|
|
41
|
+
from braidio.weave_config import WeaveConfig
|
|
41
42
|
from braidio.transforms._ingest import ingest_script, IngestedScript
|
|
42
43
|
from braidio.transforms import ( # noqa: F401
|
|
43
44
|
_asset_refs,
|
|
@@ -89,6 +90,7 @@ VIDEO_CUT_FINISH_TRANSFORM = _video_cut.FINISH_NAME
|
|
|
89
90
|
video_cut_reuses_existing = _video_cut.reuses_existing_cut
|
|
90
91
|
|
|
91
92
|
__all__ = [
|
|
93
|
+
"format_config",
|
|
92
94
|
"ingest_script",
|
|
93
95
|
"IngestedScript",
|
|
94
96
|
"weave_project",
|
|
@@ -120,6 +122,23 @@ __all__ = [
|
|
|
120
122
|
]
|
|
121
123
|
|
|
122
124
|
|
|
125
|
+
def format_config(fmt=None, *, config=None, voice_id=None):
|
|
126
|
+
"""The weave-config a production records: one rule for every writer.
|
|
127
|
+
|
|
128
|
+
``config`` else the format's ``weave``, carrying the narration voice —
|
|
129
|
+
``voice_id`` else ``fmt.narration_voice`` — when there is one. ``weave_project``
|
|
130
|
+
and ``save_script`` both resolve through here, so saving and then weaving a
|
|
131
|
+
format never rewrites the config node (and so never re-stales its renders).
|
|
132
|
+
"""
|
|
133
|
+
if config is None and fmt is not None:
|
|
134
|
+
config = fmt.weave
|
|
135
|
+
if voice_id is None and fmt is not None:
|
|
136
|
+
voice_id = fmt.narration_voice
|
|
137
|
+
if voice_id is not None:
|
|
138
|
+
config = (config or WeaveConfig()).with_(narration_voice=voice_id)
|
|
139
|
+
return config
|
|
140
|
+
|
|
141
|
+
|
|
123
142
|
def weave_project(
|
|
124
143
|
project,
|
|
125
144
|
script,
|
|
@@ -132,6 +151,7 @@ def weave_project(
|
|
|
132
151
|
profile=None,
|
|
133
152
|
rights=None,
|
|
134
153
|
cast=None,
|
|
154
|
+
voice_id=None,
|
|
135
155
|
api_key=None,
|
|
136
156
|
):
|
|
137
157
|
"""Ingest ``script`` and run the whole commentary-weave chain, in order.
|
|
@@ -161,6 +181,12 @@ def weave_project(
|
|
|
161
181
|
``dialogue-cast/v1`` node only when the script has a dialogue beat, and
|
|
162
182
|
each ``dialogue-render/v1`` derives from it (thorwhalen/braidio#46).
|
|
163
183
|
|
|
184
|
+
``voice_id`` is the narration voice, resolved as on the fast path: the
|
|
185
|
+
beat's own voice, else ``voice_id``, else the format's ``narration_voice``,
|
|
186
|
+
else the config's pool. It is recorded in the weave-config, so changing it
|
|
187
|
+
re-stales (and re-bills) every narration render that did not name its own
|
|
188
|
+
voice. Left unset it writes nothing (thorwhalen/braidio#115).
|
|
189
|
+
|
|
164
190
|
``profile`` (a :class:`~braidio.rights.Profile`) and ``rights`` (a
|
|
165
191
|
:class:`~braidio.rights.RightsPolicy`) are the rights seam, and they mean
|
|
166
192
|
exactly what they mean on :func:`braidio.render.render_production`: the
|
|
@@ -192,8 +218,8 @@ def weave_project(
|
|
|
192
218
|
"""
|
|
193
219
|
import nw
|
|
194
220
|
|
|
221
|
+
config = format_config(fmt, config=config, voice_id=voice_id)
|
|
195
222
|
if fmt is not None:
|
|
196
|
-
config = config if config is not None else fmt.weave
|
|
197
223
|
structure = structure if structure is not None else fmt.structure
|
|
198
224
|
cast = cast if cast is not None else fmt.cast
|
|
199
225
|
|
|
@@ -141,6 +141,11 @@ def beat_id(index: int) -> str:
|
|
|
141
141
|
return f"{index:0{BEAT_ID_WIDTH}d}"
|
|
142
142
|
|
|
143
143
|
|
|
144
|
+
def beat_ordinal(beat: Annotation) -> int:
|
|
145
|
+
"""A narrative beat's script position — what casting and pacing seed on."""
|
|
146
|
+
return int(beat.body.get("beat_id", "0") or 0)
|
|
147
|
+
|
|
148
|
+
|
|
144
149
|
def planned_value(ann: Annotation) -> dict:
|
|
145
150
|
"""``ann.body`` minus its :data:`RENDER_OUTPUT_KEYS` — what its plan decided.
|
|
146
151
|
|
|
@@ -67,7 +67,7 @@ from nw.transforms._provenance import derive_provenance
|
|
|
67
67
|
|
|
68
68
|
from braidio.weave import TimelineItem
|
|
69
69
|
from braidio.timeline import TimelineBreakdown, build_timeline
|
|
70
|
-
from braidio.weave_config import WeaveConfig, speaker_key
|
|
70
|
+
from braidio.weave_config import WeaveConfig, speaker_key
|
|
71
71
|
from braidio.bodies._domain import SCENE_BREAK_V1
|
|
72
72
|
from braidio.rights import (
|
|
73
73
|
DEFAULT_PROFILE,
|
|
@@ -142,12 +142,6 @@ def _structure_and_bed(node: Annotation | None):
|
|
|
142
142
|
return MusicStructure(sting=sting, **(body.get("structure") or {})), bed
|
|
143
143
|
|
|
144
144
|
|
|
145
|
-
def _layout_knobs(config: dict) -> tuple[float, float]:
|
|
146
|
-
"""``(clip_edge_overlap_s, narration_crossfade_s)`` from a weave-config snapshot."""
|
|
147
|
-
cfg = WeaveConfig.from_snapshot(config)
|
|
148
|
-
return cfg.clip_edge_overlap_s, cfg.crossfade_s
|
|
149
|
-
|
|
150
|
-
|
|
151
145
|
def _member_role(member: Annotation, index: dict, *, structure):
|
|
152
146
|
"""``(role, label, source_span)`` for one episode member — the timeline's
|
|
153
147
|
per-beat metadata, mirroring ``braidio.render``'s conventions exactly.
|
|
@@ -215,7 +209,8 @@ def member_timeline(
|
|
|
215
209
|
roles.append(role)
|
|
216
210
|
labels.append(label)
|
|
217
211
|
spans.append(span)
|
|
218
|
-
|
|
212
|
+
weave = WeaveConfig.from_snapshot(config) # omitted knobs → the defaults
|
|
213
|
+
edge_overlap_s, crossfade_s = weave.clip_edge_overlap_s, weave.crossfade_s
|
|
219
214
|
speakers = [_member_speaker(m, index) for m in members]
|
|
220
215
|
return build_timeline(
|
|
221
216
|
kinds=roles,
|
|
@@ -225,7 +220,7 @@ def member_timeline(
|
|
|
225
220
|
clip_edge_overlap_s=edge_overlap_s,
|
|
226
221
|
narration_crossfade_s=crossfade_s,
|
|
227
222
|
speakers=speakers,
|
|
228
|
-
overlap=
|
|
223
|
+
overlap=weave.turn_overlap(),
|
|
229
224
|
title=title,
|
|
230
225
|
settings={
|
|
231
226
|
"weave": dict(config),
|
|
@@ -678,7 +673,6 @@ class WeaveToEpisode(BaseTransform):
|
|
|
678
673
|
# The timeline is built from the SAME parts the mixer is about to lay
|
|
679
674
|
# out — probed the way weave_timeline probes them — and persisted on
|
|
680
675
|
# the episode, so the cut points survive the process (plan §3).
|
|
681
|
-
edge_overlap_s, crossfade_s = _layout_knobs(config)
|
|
682
676
|
timeline = member_timeline(
|
|
683
677
|
members,
|
|
684
678
|
[braidio.duration_s(it.path) for it in items],
|
|
@@ -693,13 +687,13 @@ class WeaveToEpisode(BaseTransform):
|
|
|
693
687
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
694
688
|
# Interruption is off unless the config asks: leave the call exactly as
|
|
695
689
|
# it was for a project that never set it (the absence rule, as above).
|
|
696
|
-
overlap =
|
|
690
|
+
overlap = weave.turn_overlap() # also what member_timeline laid out
|
|
697
691
|
overlap_kw = {"overlap": overlap} if overlap.is_on else {}
|
|
698
692
|
braidio.weave_timeline(
|
|
699
693
|
items,
|
|
700
694
|
out_path,
|
|
701
|
-
clip_edge_overlap_s=
|
|
702
|
-
narration_crossfade_s=crossfade_s,
|
|
695
|
+
clip_edge_overlap_s=weave.clip_edge_overlap_s,
|
|
696
|
+
narration_crossfade_s=weave.crossfade_s,
|
|
703
697
|
target_lufs=target_lufs,
|
|
704
698
|
true_peak=weave.true_peak_dbtp,
|
|
705
699
|
sample_rate=weave.sample_rate,
|
|
@@ -21,7 +21,9 @@ audio-affecting input). ``None`` falls back to the process environment
|
|
|
21
21
|
from __future__ import annotations
|
|
22
22
|
|
|
23
23
|
import json
|
|
24
|
+
import shutil
|
|
24
25
|
import uuid
|
|
26
|
+
from dataclasses import asdict
|
|
25
27
|
from pathlib import Path
|
|
26
28
|
|
|
27
29
|
from falaw import Plan
|
|
@@ -37,12 +39,16 @@ from braidio.bodies._render_nodes import (
|
|
|
37
39
|
NarrationRenderBodyV1,
|
|
38
40
|
)
|
|
39
41
|
from braidio.cost import tts_cost_usd
|
|
42
|
+
from braidio.delivery import model_supports_speed
|
|
43
|
+
from braidio.render import narrate_turns, plan_beat_turns
|
|
40
44
|
from braidio.tts import DEFAULT_MODEL_ID, DEFAULT_VOICE_ID
|
|
45
|
+
from braidio.weave_config import WeaveConfig
|
|
41
46
|
from braidio.transforms._common import (
|
|
42
47
|
TIER_NARRATIVE_BEAT,
|
|
43
48
|
TIER_VOICE_ASSIGNMENT,
|
|
44
49
|
TIER_WEAVE_CONFIG,
|
|
45
50
|
TIER_NARRATION_RENDER,
|
|
51
|
+
beat_ordinal,
|
|
46
52
|
child_at_tier,
|
|
47
53
|
singleton,
|
|
48
54
|
graph_index,
|
|
@@ -61,7 +67,7 @@ NAME = "narration_render.tts"
|
|
|
61
67
|
|
|
62
68
|
|
|
63
69
|
def _narration_cache_key(
|
|
64
|
-
transform, text: str, voice_id: str, model_id: str, settings
|
|
70
|
+
transform, text: str, voice_id: str, model_id: str, settings, turns=()
|
|
65
71
|
) -> str:
|
|
66
72
|
"""The output identity for one TTS render — nw's shared derivation.
|
|
67
73
|
|
|
@@ -71,16 +77,45 @@ def _narration_cache_key(
|
|
|
71
77
|
bump — which is then the first salt (nw#54; drift in the previous
|
|
72
78
|
private ``mixing._cache`` import would have silently changed cache keys
|
|
73
79
|
on PAID calls).
|
|
80
|
+
|
|
81
|
+
``turns`` is the paced plan (:func:`_beat_turns`): what is synthesized when
|
|
82
|
+
the config paces narration. Unpaced, it is empty and adds nothing, so an
|
|
83
|
+
unpaced project keeps its keys.
|
|
74
84
|
"""
|
|
75
85
|
from nw.transforms import cache_key as transform_cache_key
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
transform,
|
|
87
|
+
parts = [
|
|
79
88
|
"narration",
|
|
80
89
|
text,
|
|
81
90
|
voice_id,
|
|
82
91
|
model_id,
|
|
83
92
|
json.dumps(settings or {}, sort_keys=True),
|
|
93
|
+
]
|
|
94
|
+
if turns:
|
|
95
|
+
parts.append(json.dumps([asdict(t) for t in turns], sort_keys=True))
|
|
96
|
+
return transform_cache_key(transform, *parts)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def _beat_settings(beat, config: dict) -> dict:
|
|
100
|
+
"""The beat's own voice settings, else the config's — the fast path's rule."""
|
|
101
|
+
return beat.body.get("voice_settings") or config.get("voice_settings", {})
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _beat_turns(beat, config: dict, *, model_id: str, settings: dict) -> list:
|
|
105
|
+
"""The beat's paced turns — ``[]`` when the config does not pace narration.
|
|
106
|
+
|
|
107
|
+
The fast path's planner (:func:`braidio.render.plan_beat_turns`), so a
|
|
108
|
+
``segmentation_unit`` other than ``"beat"`` cuts a beat the same way on both
|
|
109
|
+
paths. Seeded by the beat's script position (``beat_id`` here,
|
|
110
|
+
``PlannedBeat.from_index`` on the fast path), which a dropped beat leaves
|
|
111
|
+
unchanged.
|
|
112
|
+
"""
|
|
113
|
+
return plan_beat_turns(
|
|
114
|
+
beat.body.get("text", ""),
|
|
115
|
+
config=WeaveConfig.from_snapshot(config),
|
|
116
|
+
supports_speed=model_supports_speed(model_id),
|
|
117
|
+
settings=settings,
|
|
118
|
+
seed_offset=beat_ordinal(beat),
|
|
84
119
|
)
|
|
85
120
|
|
|
86
121
|
|
|
@@ -102,9 +137,10 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
102
137
|
config = cfg.body.get("config", {})
|
|
103
138
|
voice_id = va.body.get("voice_id") or DEFAULT_VOICE_ID
|
|
104
139
|
model_id = config.get("model_id", DEFAULT_MODEL_ID)
|
|
105
|
-
settings =
|
|
140
|
+
settings = _beat_settings(beat, config)
|
|
141
|
+
turns = _beat_turns(beat, config, model_id=model_id, settings=settings)
|
|
106
142
|
cache_key = _narration_cache_key(
|
|
107
|
-
self, beat.body.get("text", ""), voice_id, model_id, settings
|
|
143
|
+
self, beat.body.get("text", ""), voice_id, model_id, settings, turns
|
|
108
144
|
)
|
|
109
145
|
|
|
110
146
|
full = TransformInputs(
|
|
@@ -175,18 +211,46 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
175
211
|
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
176
212
|
# was_cached: mixing served this from its on-disk cache (no ElevenLabs call
|
|
177
213
|
# = $0 real spend) even though our graph cache missed — braidio#8.
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
214
|
+
voice_id = va.body.get("voice_id") or DEFAULT_VOICE_ID
|
|
215
|
+
settings = _beat_settings(beat, config)
|
|
216
|
+
# The caller's key, if the driver handed one in (nw's `secrets=` seam;
|
|
217
|
+
# thorwhalen/braidio#58) — else None, the process env. Never persisted:
|
|
218
|
+
# not in the node, not in the cache_key.
|
|
219
|
+
api_key = elevenlabs_key(secrets)
|
|
220
|
+
turns = _beat_turns(beat, config, model_id=model_id, settings=settings)
|
|
221
|
+
if turns: # paced: one call per turn, real silence between (braidio#118)
|
|
222
|
+
cached: list[bool] = []
|
|
223
|
+
|
|
224
|
+
def synthesize(turn_text, turn_path, **kwargs):
|
|
225
|
+
path, hit = braidio.narrate(
|
|
226
|
+
turn_text, turn_path, return_cache_status=True, **kwargs
|
|
227
|
+
)
|
|
228
|
+
cached.append(hit)
|
|
229
|
+
return path
|
|
230
|
+
|
|
231
|
+
paced = narrate_turns(
|
|
232
|
+
turns,
|
|
233
|
+
stem=out_path.with_suffix(""),
|
|
234
|
+
api_key=api_key,
|
|
235
|
+
voice_id=voice_id,
|
|
236
|
+
model_id=model_id,
|
|
237
|
+
voice_settings=settings,
|
|
238
|
+
narrate_fn=synthesize,
|
|
239
|
+
)
|
|
240
|
+
shutil.move(paced, out_path)
|
|
241
|
+
for leftover in out_path.parent.glob(f"{skel.id}-turn*"):
|
|
242
|
+
leftover.unlink() # per-turn parts and gaps: only the mix is a node
|
|
243
|
+
was_cached = all(cached)
|
|
244
|
+
else:
|
|
245
|
+
_, was_cached = braidio.narrate(
|
|
246
|
+
text,
|
|
247
|
+
out_path,
|
|
248
|
+
api_key=api_key,
|
|
249
|
+
voice_id=voice_id,
|
|
250
|
+
model_id=model_id,
|
|
251
|
+
voice_settings=settings,
|
|
252
|
+
return_cache_status=True,
|
|
253
|
+
)
|
|
190
254
|
duration = safe_duration(out_path)
|
|
191
255
|
artifact = audio_artifact(
|
|
192
256
|
out_path,
|
|
@@ -28,10 +28,11 @@ from braidio.bodies._render_nodes import (
|
|
|
28
28
|
VOICE_ASSIGNMENT_V1,
|
|
29
29
|
VoiceAssignmentBodyV1,
|
|
30
30
|
)
|
|
31
|
-
from braidio.tts import
|
|
31
|
+
from braidio.tts import resolve_voice_id
|
|
32
32
|
from braidio.weave_config import WeaveConfig
|
|
33
33
|
from braidio.transforms._common import (
|
|
34
34
|
TIER_VOICE_ASSIGNMENT,
|
|
35
|
+
beat_ordinal,
|
|
35
36
|
fresh_equivalent,
|
|
36
37
|
singleton,
|
|
37
38
|
)
|
|
@@ -53,12 +54,11 @@ class BeatToVoiceAssignment(BaseTransform):
|
|
|
53
54
|
beat = inputs.primary[0]
|
|
54
55
|
cfg = singleton(project, "weave-configs")
|
|
55
56
|
config = WeaveConfig.from_snapshot(cfg.body.get("config", {}))
|
|
56
|
-
ordinal =
|
|
57
|
+
ordinal = beat_ordinal(beat)
|
|
57
58
|
# the beat's own override, else the pool — the fast path's rule exactly
|
|
58
|
-
voice_id = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
59
|
+
voice_id = config.cast_voice(
|
|
60
|
+
ordinal, override=beat.body.get("voice")
|
|
61
|
+
) or resolve_voice_id(None) # unset: BRAIDIO_TTS_VOICE, else the default
|
|
62
62
|
pool_label, seed = config.pool_label, config.voice_seed
|
|
63
63
|
|
|
64
64
|
full = TransformInputs(primary=(beat,), context={WEAVE_CONFIG_V1: (cfg,)})
|
|
@@ -21,7 +21,7 @@ from typing import Any, Mapping, Sequence
|
|
|
21
21
|
|
|
22
22
|
from braidio.multivoice import POOL_4, POOL_MANY
|
|
23
23
|
from braidio.pacing import SEGMENTATION_UNITS
|
|
24
|
-
from braidio.tts import DEFAULT_VOICE_ID
|
|
24
|
+
from braidio.tts import DEFAULT_VOICE_ID, resolve_voice_id
|
|
25
25
|
|
|
26
26
|
# The interruption value object lives with the layout that consumes it (so the
|
|
27
27
|
# weave stays free of this module's TTS imports); re-exported here for callers.
|
|
@@ -46,6 +46,10 @@ class WeaveConfig:
|
|
|
46
46
|
pool_label: str = "single"
|
|
47
47
|
voice_seed: int = 7
|
|
48
48
|
avoid_immediate_repeat: bool = True
|
|
49
|
+
# The voice narration speaks with when a beat names none — a production
|
|
50
|
+
# decision that outranks the pool (the fast path's ``voice_id``). ``None`` =
|
|
51
|
+
# unset: left out of ``to_dict`` so a config written before it is unchanged.
|
|
52
|
+
narration_voice: str | None = None
|
|
49
53
|
|
|
50
54
|
# --- Delivery (TTS) -----------------------------------------------------
|
|
51
55
|
model_id: str = "eleven_multilingual_v2"
|
|
@@ -150,13 +154,15 @@ class WeaveConfig:
|
|
|
150
154
|
return tuple(self.voices) != (DEFAULT_VOICE_ID,)
|
|
151
155
|
|
|
152
156
|
def cast_voice(self, ordinal: int, *, override: str | None = None) -> str | None:
|
|
153
|
-
"""The voice beat ``ordinal`` speaks with: ``override``, else the
|
|
157
|
+
"""The voice beat ``ordinal`` speaks with: ``override``, else the
|
|
158
|
+
production's ``narration_voice``, else the pool pick.
|
|
154
159
|
|
|
155
160
|
``None`` means "the renderer's default voice". One definition for both
|
|
156
161
|
render paths, so a script is cast (and so interrupts) the same on each.
|
|
157
162
|
"""
|
|
158
|
-
|
|
159
|
-
|
|
163
|
+
voice = override or self.narration_voice
|
|
164
|
+
if voice:
|
|
165
|
+
return voice
|
|
160
166
|
if not self.casts_voices:
|
|
161
167
|
return None
|
|
162
168
|
return pick_voice(self.voices, seed=self.voice_seed, ordinal=ordinal)
|
|
@@ -185,6 +191,8 @@ class WeaveConfig:
|
|
|
185
191
|
d = asdict(self)
|
|
186
192
|
d["voices"] = list(self.voices)
|
|
187
193
|
d["voice_settings"] = dict(self.voice_settings)
|
|
194
|
+
if d["narration_voice"] is None: # the absence rule: unset writes nothing
|
|
195
|
+
del d["narration_voice"]
|
|
188
196
|
return d
|
|
189
197
|
|
|
190
198
|
|
|
@@ -207,7 +215,7 @@ def speaker_key(voice: str | None) -> str:
|
|
|
207
215
|
>>> speaker_key(None) == speaker_key("") == DEFAULT_VOICE_ID
|
|
208
216
|
True
|
|
209
217
|
"""
|
|
210
|
-
return voice or
|
|
218
|
+
return resolve_voice_id(voice or None) # unset: the env voice, else the default
|
|
211
219
|
|
|
212
220
|
|
|
213
221
|
def turn_overlap_of(config: Mapping[str, Any]) -> TurnOverlap:
|
|
@@ -284,3 +284,55 @@ def test_config_crossfade_is_honoured_on_the_concat_path(
|
|
|
284
284
|
tight = _render(script2, tmp_path, config=cfg.with_(crossfade_s=0.0), name="cf0")
|
|
285
285
|
wide = _render(script2, tmp_path, config=cfg.with_(crossfade_s=0.3), name="cf3")
|
|
286
286
|
assert duration_s(tight) - duration_s(wide) == pytest.approx(0.3, abs=0.1)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
# --- the graph path paces too (braidio#118) ----------------------------------
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@needs_ffmpeg
|
|
293
|
+
def test_graph_narration_render_paces_like_the_fast_path(
|
|
294
|
+
script, tmp_path, tone_narration, monkeypatch
|
|
295
|
+
):
|
|
296
|
+
"""``segmentation_unit`` reaches ``narration_render.tts``: same turns, one
|
|
297
|
+
call each, and a rendered file as long as the fast path's."""
|
|
298
|
+
import nw
|
|
299
|
+
from nw import TransformInputs
|
|
300
|
+
|
|
301
|
+
graph_calls: list[str] = []
|
|
302
|
+
|
|
303
|
+
def graph_narrate(text, out_path, *, return_cache_status=False, **kw):
|
|
304
|
+
graph_calls.append(text)
|
|
305
|
+
path = tone(Path(out_path), 440, 0.5)
|
|
306
|
+
return (path, False) if return_cache_status else path
|
|
307
|
+
|
|
308
|
+
monkeypatch.setattr(braidio, "narrate", graph_narrate)
|
|
309
|
+
cfg = WeaveConfig(
|
|
310
|
+
segmentation_unit="sentence", min_turn=1, max_turn=1, gap_turn_s=0.2
|
|
311
|
+
)
|
|
312
|
+
fast = _render(script, tmp_path, config=cfg, name="fast")
|
|
313
|
+
|
|
314
|
+
project = braidio.Project.init(tmp_path / "proj", title="t")
|
|
315
|
+
braidio.transforms.ingest_script(project, script, source=None, config=cfg)
|
|
316
|
+
beat = nw.annotations_at_tier(project.root, "narrative-beats")[0]
|
|
317
|
+
voice = nw.get_transform("beat_to_voice_assignment.default")
|
|
318
|
+
narration = nw.get_transform("narration_render.tts")
|
|
319
|
+
voice.execute(project, *voice.plan(project, TransformInputs(primary=(beat,))))
|
|
320
|
+
plan, skel = narration.plan(project, TransformInputs(primary=(beat,)))
|
|
321
|
+
node = narration.execute(project, plan, skel).annotations[0]
|
|
322
|
+
|
|
323
|
+
assert graph_calls == [c["text"] for c in tone_narration] # the fast path's turns
|
|
324
|
+
assert len(graph_calls) == 4
|
|
325
|
+
assert node.body["duration_s"] == pytest.approx(duration_s(fast), abs=0.15)
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def test_unpaced_graph_cache_key_is_unchanged_by_the_pacing_plan():
|
|
329
|
+
from braidio.transforms._narration import _narration_cache_key
|
|
330
|
+
|
|
331
|
+
class _T:
|
|
332
|
+
name = "narration_render.tts"
|
|
333
|
+
impl_version = 1
|
|
334
|
+
|
|
335
|
+
plain = _narration_cache_key(_T, "t", "v", "m", {})
|
|
336
|
+
assert plain == _narration_cache_key(_T, "t", "v", "m", {}, ())
|
|
337
|
+
paced = plan_turns("One. Two.", unit="sentence", min_turn=1, max_turn=1)
|
|
338
|
+
assert plain != _narration_cache_key(_T, "t", "v", "m", {}, paced)
|
|
@@ -634,7 +634,11 @@ def test_weave_project_applies_a_format_and_its_declared_structure(
|
|
|
634
634
|
}
|
|
635
635
|
assert structure.body["sting_asset_id"] is None # no asset supplied
|
|
636
636
|
(cfg,) = nw.annotations_at_tier(project.root, "weave-configs")
|
|
637
|
-
|
|
637
|
+
# the format's narration voice rides in the config now (braidio#115)
|
|
638
|
+
expected = braidio.SOLO_EXPLAINER.weave.with_(
|
|
639
|
+
narration_voice=braidio.SOLO_EXPLAINER.narration_voice
|
|
640
|
+
)
|
|
641
|
+
assert cfg.body["config"] == expected.to_dict()
|
|
638
642
|
|
|
639
643
|
|
|
640
644
|
# --- re-ingest: identity, freshness, retry (braidio#49, braidio#51) ------------
|