braidio 0.0.75__tar.gz → 0.0.76__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.76}/PKG-INFO +1 -1
- {braidio-0.0.75 → braidio-0.0.76}/braidio/bodies/_domain.py +9 -4
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/tools.py +1 -1
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/__init__.py +27 -1
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_episode.py +7 -13
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_ingest.py +1 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_narration.py +7 -2
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_voice.py +4 -5
- {braidio-0.0.75 → braidio-0.0.76}/braidio/weave_config.py +13 -5
- {braidio-0.0.75 → braidio-0.0.76}/pyproject.toml +1 -1
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_body_schema_stability.py +1 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms.py +5 -1
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_turn_overlap.py +105 -2
- {braidio-0.0.75 → braidio-0.0.76}/.editorconfig +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/.gitattributes +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/.gitignore +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/LICENSE +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/README.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/_paths.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/bodies/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/bodies/_render_nodes.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/bodies/_tiers.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/bodies/_video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/captions.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/compose.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/conversation.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/cost.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/data/skills/braidio/SKILL.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/data/skills/braidio-commentary-video/SKILL.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/defaults.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/delivery.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/downloads.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/formats.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/genre.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/importing/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/importing/__main__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/importing/_catalog.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/importing/_manifest.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/importing/_writer.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/kinds.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/markdown_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/__init__.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/_docs.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/_guide.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/_helpers.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/_media.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/credentials.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/metering.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/mcp/workspace.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/multivoice.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/music.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/pacing.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/project.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/provenance.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/relevance.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/render.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/rights.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/sources.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/style.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/textprep.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/timeline.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_asset_refs.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_common.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_dialogue.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_segment.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_video_cut.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/transforms/_video_panels.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/tts.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/voice_library.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/braidio/weave.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/conftest.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/Extraction and nw-App Design.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/research/commentary-formats-and-styles.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/research/conversational-vs-narration-tts.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/research/notebooklm-and-conversational-pacing.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/README.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/anti-platitude-checklist.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/commentary-voice-guide.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/_style-groups.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/amanda-dobbins.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/david-sims.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/griffin-newman.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/helen-molesworth.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/hrishikesh-hirway.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/jason-mantzoukas.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/john-mcwhorter.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/jon-caramanica.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/june-diane-raphael.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/karina-longworth.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/katy-hessel.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/louis-theroux.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/mallory-rubin.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/melvyn-bragg.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/michael-barbaro.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/nate-sloan-charlie-harding.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/paul-scheer.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/sean-fennessey.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/talk-art.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/style/voices/yasi-salek.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/misc/docs/youtube_ingest_credentials.md +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/_audio.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_conversation.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_cost.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_credits_card.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_defaults.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_delivery.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_downloads.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_expressiveness.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_formats.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_genre_placement.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_importing.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_markdown_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_mcp.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_mcp_caller_key.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_media_auth.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_multivoice.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_music.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_namespaced_source.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_nw_app.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_pacing.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_packaging.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_render_settings.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_script.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_sources.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_textprep_style.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_timeline.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms_dialogue.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms_episode_members.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms_rights.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms_secrets.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_transforms_structure.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_tts_api_key.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_video.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_video_bodies.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_video_footage.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_video_transforms.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_voice_library.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_weave.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/tests/test_weave_config.py +0 -0
- {braidio-0.0.75 → braidio-0.0.76}/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.76
|
|
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(
|
|
@@ -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
|
|
|
@@ -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,
|
|
@@ -84,6 +84,11 @@ def _narration_cache_key(
|
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
|
|
87
|
+
def _beat_settings(beat, config: dict) -> dict:
|
|
88
|
+
"""The beat's own voice settings, else the config's — the fast path's rule."""
|
|
89
|
+
return beat.body.get("voice_settings") or config.get("voice_settings", {})
|
|
90
|
+
|
|
91
|
+
|
|
87
92
|
@register_transform(NAME)
|
|
88
93
|
class NarrationRenderTTS(BaseTransform):
|
|
89
94
|
"""Narrative beat (+ voice-assignment + weave-config) → ``narration-render/v1``."""
|
|
@@ -102,7 +107,7 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
102
107
|
config = cfg.body.get("config", {})
|
|
103
108
|
voice_id = va.body.get("voice_id") or DEFAULT_VOICE_ID
|
|
104
109
|
model_id = config.get("model_id", DEFAULT_MODEL_ID)
|
|
105
|
-
settings =
|
|
110
|
+
settings = _beat_settings(beat, config)
|
|
106
111
|
cache_key = _narration_cache_key(
|
|
107
112
|
self, beat.body.get("text", ""), voice_id, model_id, settings
|
|
108
113
|
)
|
|
@@ -184,7 +189,7 @@ class NarrationRenderTTS(BaseTransform):
|
|
|
184
189
|
api_key=elevenlabs_key(secrets),
|
|
185
190
|
voice_id=va.body.get("voice_id") or DEFAULT_VOICE_ID,
|
|
186
191
|
model_id=model_id,
|
|
187
|
-
voice_settings=
|
|
192
|
+
voice_settings=_beat_settings(beat, config),
|
|
188
193
|
return_cache_status=True,
|
|
189
194
|
)
|
|
190
195
|
duration = safe_duration(out_path)
|
|
@@ -28,7 +28,7 @@ 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,
|
|
@@ -55,10 +55,9 @@ class BeatToVoiceAssignment(BaseTransform):
|
|
|
55
55
|
config = WeaveConfig.from_snapshot(cfg.body.get("config", {}))
|
|
56
56
|
ordinal = int(beat.body.get("beat_id", "0") or 0)
|
|
57
57
|
# the beat's own override, else the pool — the fast path's rule exactly
|
|
58
|
-
voice_id = (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
58
|
+
voice_id = config.cast_voice(
|
|
59
|
+
ordinal, override=beat.body.get("voice")
|
|
60
|
+
) or resolve_voice_id(None) # unset: BRAIDIO_TTS_VOICE, else the default
|
|
62
61
|
pool_label, seed = config.pool_label, config.voice_seed
|
|
63
62
|
|
|
64
63
|
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:
|
|
@@ -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) ------------
|
|
@@ -368,7 +368,7 @@ def _parity_script(**voices):
|
|
|
368
368
|
)
|
|
369
369
|
|
|
370
370
|
|
|
371
|
-
def _starts_both_ways(monkeypatch, tmp_path, script, config):
|
|
371
|
+
def _starts_both_ways(monkeypatch, tmp_path, script, config, **kw):
|
|
372
372
|
"""Offsets of one script rendered on the fast path and through the graph."""
|
|
373
373
|
import braidio.render as render_mod
|
|
374
374
|
|
|
@@ -389,9 +389,10 @@ def _starts_both_ways(monkeypatch, tmp_path, script, config):
|
|
|
389
389
|
return_timeline=True,
|
|
390
390
|
tts_dir=tmp_path / "tts",
|
|
391
391
|
clips_dir=tmp_path / "clips",
|
|
392
|
+
**kw,
|
|
392
393
|
)
|
|
393
394
|
project = braidio.Project.init(tmp_path / "graph", title="graph")
|
|
394
|
-
ep = braidio.weave_project(project, script, config=config)
|
|
395
|
+
ep = braidio.weave_project(project, script, config=config, **kw)
|
|
395
396
|
graph = braidio.transforms._episode.episode_timeline(project, ep)
|
|
396
397
|
return [b.start for b in fast.beats], [b.start for b in graph.beats]
|
|
397
398
|
|
|
@@ -469,3 +470,105 @@ def test_the_importer_writes_no_voice_key_for_a_beat_without_one():
|
|
|
469
470
|
assert "voice" in NarrativeBeatBodyV1(
|
|
470
471
|
beat_id="0001", text="x", voice="v"
|
|
471
472
|
).model_dump(mode="json")
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
@needs_ffmpeg
|
|
476
|
+
def test_both_paths_honour_the_narration_voice(monkeypatch, tmp_path):
|
|
477
|
+
"""``voice_id`` casts the same on both paths (braidio#115): beat 2 names the
|
|
478
|
+
default voice, so it is a different speaker from the narration voice."""
|
|
479
|
+
from braidio.tts import DEFAULT_VOICE_ID
|
|
480
|
+
|
|
481
|
+
cfg = WeaveConfig(overlap_turn_s=0.3, overlap_jitter=0.0)
|
|
482
|
+
script = _parity_script(two={"voice": DEFAULT_VOICE_ID})
|
|
483
|
+
fast, graph = _starts_both_ways(monkeypatch, tmp_path, script, cfg, voice_id="vn")
|
|
484
|
+
assert graph == pytest.approx(fast, abs=1e-3)
|
|
485
|
+
assert fast[1] - fast[0] < 1.0 - 0.12 # vn -> default: interrupts
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
def test_a_format_narration_voice_reaches_the_graph(monkeypatch, tmp_path):
|
|
489
|
+
from braidio.formats import FORMATS
|
|
490
|
+
|
|
491
|
+
seen = []
|
|
492
|
+
|
|
493
|
+
def fake(text, out, *, return_cache_status=False, **kw):
|
|
494
|
+
seen.append(kw["voice_id"])
|
|
495
|
+
path = tone(Path(out), 440, 0.2)
|
|
496
|
+
return (path, False) if return_cache_status else path
|
|
497
|
+
|
|
498
|
+
monkeypatch.setattr(braidio, "narrate", fake)
|
|
499
|
+
fmt = FORMATS["debate"] # narrates in a voice other than the default
|
|
500
|
+
assert fmt.narration_voice != braidio.tts.DEFAULT_VOICE_ID
|
|
501
|
+
project = braidio.Project.init(tmp_path / "g", title="g")
|
|
502
|
+
braidio.weave_project(project, _parity_script(), fmt=fmt)
|
|
503
|
+
assert set(seen) == {fmt.narration_voice}
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
def test_the_env_voice_is_the_graph_default_too(monkeypatch, tmp_path):
|
|
507
|
+
from braidio.tts import VOICE_ENV_VAR
|
|
508
|
+
|
|
509
|
+
seen = []
|
|
510
|
+
|
|
511
|
+
def fake(text, out, *, return_cache_status=False, **kw):
|
|
512
|
+
seen.append(kw["voice_id"])
|
|
513
|
+
path = tone(Path(out), 440, 0.2)
|
|
514
|
+
return (path, False) if return_cache_status else path
|
|
515
|
+
|
|
516
|
+
monkeypatch.setattr(braidio, "narrate", fake)
|
|
517
|
+
monkeypatch.setenv(VOICE_ENV_VAR, "venv")
|
|
518
|
+
project = braidio.Project.init(tmp_path / "g", title="g")
|
|
519
|
+
braidio.weave_project(project, _parity_script())
|
|
520
|
+
assert set(seen) == {"venv"}
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
def test_a_beat_voice_settings_reach_the_graph_render(monkeypatch, tmp_path):
|
|
524
|
+
seen = []
|
|
525
|
+
|
|
526
|
+
def fake(text, out, *, return_cache_status=False, **kw):
|
|
527
|
+
seen.append((text, kw["voice_settings"]))
|
|
528
|
+
path = tone(Path(out), 440, 0.2)
|
|
529
|
+
return (path, False) if return_cache_status else path
|
|
530
|
+
|
|
531
|
+
monkeypatch.setattr(braidio, "narrate", fake)
|
|
532
|
+
script = _parity_script(two={"voice_settings": {"stability": 0.9}})
|
|
533
|
+
project = braidio.Project.init(tmp_path / "g", title="g")
|
|
534
|
+
braidio.weave_project(project, script)
|
|
535
|
+
by_text = dict(seen)
|
|
536
|
+
import nw
|
|
537
|
+
|
|
538
|
+
keys = {
|
|
539
|
+
a.body["cache_key"]
|
|
540
|
+
for a in nw.iter_all_annotations(project.root)
|
|
541
|
+
if a.body_schema_uri == braidio.bodies.NARRATION_RENDER_V1
|
|
542
|
+
}
|
|
543
|
+
assert len(keys) == 4 # the settings are part of the render's identity
|
|
544
|
+
assert by_text["Two."] == {"stability": 0.9}
|
|
545
|
+
assert by_text["One."] == dict(WeaveConfig().voice_settings)
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
def test_the_narration_voice_outranks_the_pool_and_an_unset_one_writes_nothing():
|
|
549
|
+
cfg = WeaveConfig(voices=("a", "b"), voice_seed=1, narration_voice="n")
|
|
550
|
+
assert cfg.cast_voice(0) == "n"
|
|
551
|
+
assert cfg.cast_voice(0, override="z") == "z"
|
|
552
|
+
assert "narration_voice" not in WeaveConfig().to_dict()
|
|
553
|
+
assert WeaveConfig.from_snapshot(cfg.to_dict()).narration_voice == "n"
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
@needs_ffmpeg
|
|
557
|
+
def test_both_paths_agree_when_the_env_voice_is_set(monkeypatch, tmp_path):
|
|
558
|
+
from braidio.tts import DEFAULT_VOICE_ID, VOICE_ENV_VAR
|
|
559
|
+
|
|
560
|
+
monkeypatch.setenv(VOICE_ENV_VAR, "venv")
|
|
561
|
+
cfg = WeaveConfig(overlap_turn_s=0.3, overlap_jitter=0.0)
|
|
562
|
+
script = _parity_script(two={"voice": DEFAULT_VOICE_ID})
|
|
563
|
+
fast, graph = _starts_both_ways(monkeypatch, tmp_path, script, cfg)
|
|
564
|
+
assert graph == pytest.approx(fast, abs=1e-3)
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def test_save_script_and_weave_project_record_one_config(tmp_path):
|
|
568
|
+
from braidio.formats import FORMATS
|
|
569
|
+
|
|
570
|
+
fmt = FORMATS["debate"]
|
|
571
|
+
assert braidio.transforms.format_config(fmt).narration_voice == fmt.narration_voice
|
|
572
|
+
assert braidio.transforms.format_config(None) is None
|
|
573
|
+
explicit = braidio.transforms.format_config(fmt, voice_id="vx")
|
|
574
|
+
assert explicit.narration_voice == "vx"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{braidio-0.0.75 → braidio-0.0.76}/misc/docs/research/notebooklm-and-conversational-pacing.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|